Skip to content

Commit 3c3e9c6

Browse files
committed
Remove type piracy
Moved methods in LinuxPerf, depends on JuliaPerf/LinuxPerf.jl#35
1 parent 511406a commit 3c3e9c6

File tree

2 files changed

+0
-34
lines changed

2 files changed

+0
-34
lines changed

src/serialization.jl

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -31,28 +31,6 @@ function JSON.lower(x::Union{values(SUPPORTED_TYPES)...})
3131
return [string(nameof(typeof(x))), d]
3232
end
3333

34-
# Should this be in LinuxPerf?
35-
JSON.lower(::typeof(LinuxPerf.parse_groups)) = "LinuxPerf.parse_groups"
36-
37-
# Should this be in LinuxPerf?
38-
# Need this to deserialize LinuxPerf.Stats
39-
Base.convert(::Type{LinuxPerf.Stats}, d::Dict{String}) = LinuxPerf.Stats(d["threads"])
40-
function Base.convert(::Type{LinuxPerf.ThreadStats}, d::Dict{String})
41-
return LinuxPerf.ThreadStats(d["pid"], d["groups"])
42-
end
43-
function JSON.lower(counter::LinuxPerf.Counter)
44-
return [
45-
counter.event.category,
46-
counter.event.event,
47-
counter.value,
48-
counter.enabled,
49-
counter.running,
50-
]
51-
end
52-
function Base.convert(::Type{LinuxPerf.Counter}, v::Vector)
53-
return LinuxPerf.Counter(LinuxPerf.EventType(v[1], v[2]), v[3], v[4], v[5])
54-
end
55-
5634
# a minimal 'eval' function, mirroring KeyTypes, but being slightly more lenient
5735
safeeval(@nospecialize x) = x
5836
safeeval(x::QuoteNode) = x.value

src/trials.jl

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,6 @@
22
# Trial #
33
#########
44

5-
# Move into LinuxPerf.jl
6-
Base.copy(stats::LinuxPerf.Stats) = LinuxPerf.Stats(copy(stats.threads))
7-
function Base.copy(thread_stats::LinuxPerf.ThreadStats)
8-
return LinuxPerf.ThreadStats(thread_stats.pid, copy(thread_stats.groups))
9-
end
10-
function Base.copy(counter::LinuxPerf.Counter)
11-
return LinuxPerf.Counter(
12-
copy(counter.event), counter.value, counter.enabled, counter.running
13-
)
14-
end
15-
Base.copy(event::LinuxPerf.EventType) = LinuxPerf.EventType(event.category, event.event)
16-
175
mutable struct Trial
186
params::Parameters
197
times::Vector{Float64}

0 commit comments

Comments
 (0)