File tree Expand file tree Collapse file tree 3 files changed +37
-1
lines changed Expand file tree Collapse file tree 3 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -223,4 +223,23 @@ function pprof(alloc_profile::Profile.Allocs.AllocResults = Profile.Allocs.fetch
223
223
out
224
224
end
225
225
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
+
226
245
end # module Allocs
Original file line number Diff line number Diff line change 399
399
@pprof ex
400
400
401
401
Profiles the expression using `@profile` and starts or restarts the `pprof()` web UI with
402
- default arguments.
402
+ default arguments. See also [`PProf.Allocs.@pprof`](@ref).
403
403
"""
404
404
macro pprof (ex)
405
405
esc (quote
Original file line number Diff line number Diff line change @@ -9,6 +9,23 @@ using Test
9
9
10
10
const out = tempname ()
11
11
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
+
12
29
@testset " basic profiling" begin
13
30
Profile. Allocs. clear ()
14
31
Profile. Allocs. @profile sample_rate= 1.0 begin
You can’t perform that action at this time.
0 commit comments