File tree Expand file tree Collapse file tree 4 files changed +38
-2
lines changed
Expand file tree Collapse file tree 4 files changed +38
-2
lines changed Original file line number Diff line number Diff line change 11name = " PProf"
22uuid = " e4faabce-9ead-11e9-39d9-4379958e3056"
33authors = [
" Valentin Churavy <[email protected] >" ,
" Nathan Daly <[email protected] >" ]
4- version = " 3.0 .0"
4+ version = " 3.1 .0"
55
66[deps ]
77AbstractTrees = " 1520ce14-60c1-5f80-bbc7-55ef81b5835c"
Original file line number Diff line number Diff line change @@ -223,4 +223,23 @@ function pprof(alloc_profile::Profile.Allocs.AllocResults = Profile.Allocs.fetch
223223 out
224224end
225225
226+ """
227+ Allocs.@pprof args...
228+
229+ Profiles the expression using `Allocs.@profile` and starts or restarts the `Allocs.pprof()` web UI with
230+ default arguments. See also [`PProf.@pprof`](@ref).
231+
232+ # Examples
233+ ```julia
234+ PProf.Allocs.@pprof [randn(3) for _ in 1:100000]
235+ PProf.Allocs.@pprof sample_rate=1 randn(100)
236+ ```
237+ """
238+ macro pprof(args... )
239+ esc(quote
240+ $ Profile. Allocs. @profile $ (args... )
241+ $ (@__MODULE__). pprof()
242+ end )
243+ end
244+
226245end # module Allocs
Original file line number Diff line number Diff line change 345345 @pprof ex
346346
347347Profiles the expression using `@profile` and starts or restarts the `pprof()` web UI with
348- default arguments.
348+ default arguments. See also [`PProf.Allocs.@pprof`](@ref).
349349"""
350350macro pprof(ex)
351351 esc(quote
Original file line number Diff line number Diff line change @@ -9,6 +9,23 @@ using Test
99
1010const out = tempname()
1111
12+ @testset " PProf.Allocs.@pprof" begin
13+ Profile. Allocs. clear()
14+ rm(" alloc-profile.pb.gz" , force= true )
15+ @assert ! isfile(" alloc-profile.pb.gz" )
16+ PProf. Allocs. @pprof sample_rate= 1.0 randn(100 )
17+ @test isfile(" alloc-profile.pb.gz" )
18+
19+ Profile. Allocs. clear()
20+ rm(" alloc-profile.pb.gz" , force= true )
21+ @assert ! isfile(" alloc-profile.pb.gz" )
22+ PProf. Allocs. @pprof randn(100 )
23+ @test isfile(" alloc-profile.pb.gz" )
24+
25+ rm(" alloc-profile.pb.gz" , force= true )
26+ end
27+
28+
1229@testset " basic profiling" begin
1330 Profile. Allocs. clear()
1431 Profile. Allocs. @profile sample_rate= 1.0 begin
You can’t perform that action at this time.
0 commit comments