Skip to content

Commit ca1caa6

Browse files
NHDalyvchuravy
andcommitted
Merge branch 'windows-build'
Co-authored-by: Valentin Churavy <v.churavy@gmail.com>
2 parents 10c38fb + 00ba82b commit ca1caa6

File tree

4 files changed

+19
-15
lines changed

4 files changed

+19
-15
lines changed

.appveyor.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,3 @@ test_script:
4242
# on_success:
4343
# - echo "%JL_CODECOV_SCRIPT%"
4444
# - C:\julia\bin\julia -e "%JL_CODECOV_SCRIPT%"
45-

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "PProf"
22
uuid = "e4faabce-9ead-11e9-39d9-4379958e3056"
33
authors = ["Valentin Churavy <v.churavy@gmail.com>", "Nathan Daly <nhdaly@gmail.com>"]
4-
version = "0.2.0"
4+
version = "0.2.1"
55

66
[deps]
77
BinaryProvider = "b99e7846-7c00-51b0-8f62-c81ae34c0232"

deps/build.jl

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const verbose = "--verbose" in ARGS
77
const prefix = Prefix(get([a for a in ARGS if a != "--verbose"], 1, joinpath(@__DIR__, "usr")))
88

99
# Instantiate products:
10-
go_pprof = ExecutableProduct(prefix, "pprof", :go_pprof)
10+
go_pprof = ExecutableProduct(prefix, Sys.iswindows() ? "pprof.exe" : "pprof", :go_pprof)
1111
products = [go_pprof]
1212

1313
# Download binaries from hosted location
@@ -27,8 +27,8 @@ download_info = Dict(
2727

2828
BinaryProvider.MacOS(:x86_64) => ("$bin_prefix/pprof_darwin_amd64.tar.gz", "93f5c227af23ade110fedbd07eff0bd57644fec0cde77ad359515bb254c43802"),
2929

30-
BinaryProvider.Windows(:i686) => ("$bin_prefix/pprof_windows_386.exe.tar.gz", "90a343e9ae8888c0f52322761dc028d9c7edf4a202e81aea2989ac182e77010c"),
31-
BinaryProvider.Windows(:x86_64) => ("$bin_prefix/pprof_windows_amd64.exe.tar.gz", "21702d1f7317d969a283d094898e92ba3da4961c419c5351d359f3abf0894d43"),
30+
BinaryProvider.Windows(:i686) => ("$bin_prefix/pprof_windows_386.tar.gz", "90a343e9ae8888c0f52322761dc028d9c7edf4a202e81aea2989ac182e77010c"),
31+
BinaryProvider.Windows(:x86_64) => ("$bin_prefix/pprof_windows_amd64.tar.gz", "21702d1f7317d969a283d094898e92ba3da4961c419c5351d359f3abf0894d43"),
3232
)
3333

3434
# First, check to see if we're all satisfied
@@ -37,11 +37,13 @@ if any(!satisfied(p; verbose=verbose) for p in products)
3737
# Download and install binaries
3838
url, tarball_hash = choose_download(download_info)
3939
install(url, tarball_hash; prefix=prefix, force=true, verbose=true)
40-
# NHDALY MANUALLY ADDED THESE LINES TO HOOK UP THE BINARY
41-
bin = mkpath(joinpath(prefix, "bin"))
42-
dir = splitext(splitext(basename(url))[1])[1]
43-
@show dir
44-
cp(joinpath(prefix, dir, "pprof"), joinpath(bin, "pprof"))
40+
# we need to move the unpacked binary from `prefix` to `prefix/bin`
41+
dir = splitext(splitext(basename(url))[1])[1]
42+
destpath = dirname(go_pprof.path)
43+
binaryname = basename(go_pprof.path)
44+
45+
mkpath(destpath)
46+
cp(joinpath(prefix, dir, binaryname), go_pprof.path)
4547
catch e
4648
if typeof(e) <: ArgumentError
4749
error("Your platform $(Sys.MACHINE) is not supported by this package!")

src/PProf.jl

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ using OrderedCollections
99
# Load in `deps.jl`, complaining if it does not exist
1010
const depsjl_path = joinpath(@__DIR__, "..", "deps", "deps.jl")
1111
if !isfile(depsjl_path)
12-
error("LibFoo not installed properly, run Pkg.build(\"LibFoo\"), restart Julia and try again")
12+
error("PProf not installed properly, run Pkg.build(\"PProf\"), restart Julia and try again")
1313
end
1414
include(depsjl_path)
1515

@@ -27,16 +27,19 @@ import .perftools.profiles: ValueType, Sample, Function,
2727
const PProfile = perftools.profiles.Profile
2828

2929
"""
30-
_enter!(dict::OrderedDict{T, Int}, key::T) where T
30+
_enter!(dict::OrderedDict{T, Int64}, key::T) where T
3131
3232
Resolves from `key` to the index (zero-based) in the dict.
3333
Useful for the Strings table
34+
35+
NOTE: We must use Int64 throughout this package (regardless of system word-size) b/c the
36+
proto file specifies 64-bit integers.
3437
"""
35-
function _enter!(dict::OrderedDict{T, Int}, key::T) where T
38+
function _enter!(dict::OrderedDict{T, Int64}, key::T) where T
3639
if haskey(dict, key)
3740
return dict[key]
3841
else
39-
l = length(dict)
42+
l = Int64(length(dict))
4043
dict[key] = l
4144
return l
4245
end
@@ -84,7 +87,7 @@ function pprof(data::Union{Nothing, Vector{UInt}} = nothing,
8487
period = ccall(:jl_profile_delay_nsec, UInt64, ())
8588
end
8689

87-
string_table = OrderedDict{AbstractString, Int}()
90+
string_table = OrderedDict{AbstractString, Int64}()
8891
enter!(string) = _enter!(string_table, string)
8992
enter!(::Nothing) = _enter!(string_table, "nothing")
9093
ValueType!(_type, unit) = ValueType(_type = enter!(_type), unit = enter!(unit))

0 commit comments

Comments
 (0)