Add: julia-0.6.2
Former-commit-id: ccc667cf67d569f3fb3df39aa57c2134755a7551
This commit is contained in:
45
julia-0.6.2/share/julia/test/profile.jl
Normal file
45
julia-0.6.2/share/julia/test/profile.jl
Normal file
@@ -0,0 +1,45 @@
|
||||
# This file is a part of Julia. License is MIT: https://julialang.org/license
|
||||
|
||||
function busywait(t, n_tries)
|
||||
iter = 0
|
||||
while iter < n_tries && Profile.len_data() == 0
|
||||
iter += 1
|
||||
tend = time() + t
|
||||
while time() < tend end
|
||||
end
|
||||
end
|
||||
|
||||
Profile.clear()
|
||||
@profile busywait(1, 20)
|
||||
|
||||
let r = Profile.retrieve()
|
||||
mktemp() do path, io
|
||||
serialize(io, r)
|
||||
close(io)
|
||||
open(path) do io
|
||||
@test isa(deserialize(io), Tuple{Vector{UInt},Dict{UInt64,Vector{StackFrame}}})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
let iobuf = IOBuffer()
|
||||
Profile.print(iobuf, format=:tree, C=true)
|
||||
str = String(take!(iobuf))
|
||||
@test !isempty(str)
|
||||
truncate(iobuf, 0)
|
||||
Profile.print(iobuf, format=:tree, maxdepth=2)
|
||||
str = String(take!(iobuf))
|
||||
@test !isempty(str)
|
||||
truncate(iobuf, 0)
|
||||
Profile.print(iobuf, format=:flat, C=true)
|
||||
str = String(take!(iobuf))
|
||||
@test !isempty(str)
|
||||
truncate(iobuf, 0)
|
||||
Profile.print(iobuf)
|
||||
@test !isempty(String(take!(iobuf)))
|
||||
truncate(iobuf, 0)
|
||||
Profile.print(iobuf, format=:flat, sortedby=:count)
|
||||
@test !isempty(String(take!(iobuf)))
|
||||
Profile.clear()
|
||||
@test isempty(Profile.fetch())
|
||||
end
|
||||
Reference in New Issue
Block a user