Skip to content

Commit

Permalink
Merge pull request #76 from brenhinkeller/master
Browse files Browse the repository at this point in the history
Add Allocs example to README
  • Loading branch information
vilterp authored Nov 16, 2022
2 parents 82bebb5 + cab09e8 commit b2b0a25
Showing 1 changed file with 16 additions and 4 deletions.
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

0 comments on commit b2b0a25

Please sign in to comment.