Skip to content

Commit 42b7582

Browse files
authored
Merge pull request #48 from fingolfin/mh/sanity
2 parents d2c8578 + 5c0d0dd commit 42b7582

File tree

2 files changed

+20
-19
lines changed

2 files changed

+20
-19
lines changed

src/snoop_bench.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ function _snoopi_bench_cmd(snoop_script)
55
global SnoopCompile_ENV = true
66
using SnoopCompileCore
77

8-
data = @snoopi tmin=$tmin begin
8+
__the_data__ = @snoopi tmin=$tmin begin
99
$snoop_script
1010
end
1111

1212
global SnoopCompile_ENV = false
1313

1414
using CompileBot: timesum
15-
@info( "\nTotal inference time (ms): \t" * string(timesum(data, :ms)))
15+
@info( "\nTotal inference time (ms): \t" * string(timesum(__the_data__, :ms)))
1616
end
1717
end
1818

src/snoop_bot.jl

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ function _snoopi_bot(snoop_script, tmin)
33
return quote
44
using SnoopCompileCore
55

6-
data = @snoopi tmin=$tmin begin
6+
__the_data__ = @snoopi tmin=$tmin begin
77
$snoop_script
88
end
99
end
@@ -19,36 +19,37 @@ function _snoopc_bot(snoop_script)
1919

2020
using SnoopCompile
2121

22-
data = SnoopCompile.read("compiles.log")[2]
22+
__the_data__ = SnoopCompile.read("compiles.log")[2]
2323
Base.rm("compiles.log", force = true)
2424
end
2525
end
2626

2727
function _snoop_analysis_bot(snooping_code, package_name, precompile_folder, subst, exclusions, check_eval)
2828
return quote
29-
packageSym = Symbol($package_name)
3029

3130
################################################################
3231
@info "Processsing the generated precompile signatures"
3332

3433
using SnoopCompile
3534

3635
### Parse the compiles and generate precompilation scripts
37-
pc = SnoopCompile.parcel(data; subst = $subst, exclusions = $exclusions, check_eval = $check_eval)
38-
if !haskey(pc, packageSym)
39-
@warn "no precompile signature is found for $($package_name). Don't load the package before snooping. Restart your Julia session."
40-
if !isdir($precompile_folder)
41-
mkpath($precompile_folder)
36+
let packageSym = Symbol($package_name),
37+
pc = SnoopCompile.parcel(__the_data__; subst = $subst, exclusions = $exclusions, check_eval = $check_eval)
38+
if !haskey(pc, packageSym)
39+
@warn "no precompile signature is found for $($package_name). Don't load the package before snooping. Restart your Julia session."
40+
if !isdir($precompile_folder)
41+
mkpath($precompile_folder)
42+
end
43+
Base.write("$($precompile_folder)/precompile_$($package_name).jl", """
44+
function _precompile_()
45+
# nothing
46+
end
47+
""")
48+
else # if any precompilation script is generated
49+
onlypackage = Dict( packageSym => Base.sort(pc[packageSym]) )
50+
SnoopCompile.write($precompile_folder, onlypackage)
51+
@info "precompile signatures were written to $($precompile_folder)"
4252
end
43-
Base.write("$($precompile_folder)/precompile_$($package_name).jl", """
44-
function _precompile_()
45-
# nothing
46-
end
47-
""")
48-
else # if any precompilation script is generated
49-
onlypackage = Dict( packageSym => Base.sort(pc[packageSym]) )
50-
SnoopCompile.write($precompile_folder, onlypackage)
51-
@info "precompile signatures were written to $($precompile_folder)"
5253
end
5354
end
5455
end

0 commit comments

Comments
 (0)