Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Allocs example to README #76

Merged
merged 3 commits into from
Nov 16, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
# PProf.jl

[![Build Status](https://travis-ci.com/vchuravy/PProf.jl.svg?branch=master)](https://travis-ci.com/vchuravy/PProf.jl)

[![CI][ci-img]][ci-url]

*Sometimes I need a hammer, sometimes I need a drill, this is a hammer-drill*

```julia
using Profile
using PProf

# collect a profile
# Collect a profile
Profile.clear()
@profile peakflops()

# Export pprof profile and open interactive profiling web interface.
Expand All @@ -18,6 +17,16 @@ pprof()

This prints a link to a local webserver where you can inspect the profile you've collected. It produces a file called `profile.pb.gz` in the [`pprof`](https://github.com/google/pprof) format, and then opens the `pprof` tool in interactive "web" mode.

To profile allocations instead of CPU time, simply use the equivalent functions from the `Allocs` submodule instead:
```julia
# Collect an allocation profile
Profile.Allocs.clear()
Profile.Allocs.@profile peakflops()

# Export pprof allocation profile and open interactive profiling web interface.
PProf.Allocs.pprof()
```

For more usage examples see the pprof docs: https://github.com/google/pprof/blob/master/doc/README.md

## Dependencies
Expand Down Expand Up @@ -64,3 +73,6 @@ Serving web UI on http://localhost:57599
<img width=500px src="docs/graph.png" alt="graph"/>

<img width=500px src="docs/flamegraph.png" alt="flamegraph"/>

[ci-img]: https://github.com/JuliaPerf/PProf.jl/actions/workflows/CI.yml/badge.svg?branch=master
[ci-url]: https://github.com/JuliaPerf/PProf.jl/actions/workflows/CI.yml