Skip to content

Commit

Permalink
Remove type piracy
Browse files Browse the repository at this point in the history
Moved methods in LinuxPerf, depends on JuliaPerf/LinuxPerf.jl#35
  • Loading branch information
Zentrik committed May 2, 2024
1 parent 511406a commit 3c3e9c6
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 34 deletions.
22 changes: 0 additions & 22 deletions src/serialization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,28 +31,6 @@ function JSON.lower(x::Union{values(SUPPORTED_TYPES)...})
return [string(nameof(typeof(x))), d]
end

# Should this be in LinuxPerf?
JSON.lower(::typeof(LinuxPerf.parse_groups)) = "LinuxPerf.parse_groups"

# Should this be in LinuxPerf?
# Need this to deserialize LinuxPerf.Stats
Base.convert(::Type{LinuxPerf.Stats}, d::Dict{String}) = LinuxPerf.Stats(d["threads"])
function Base.convert(::Type{LinuxPerf.ThreadStats}, d::Dict{String})
return LinuxPerf.ThreadStats(d["pid"], d["groups"])
end
function JSON.lower(counter::LinuxPerf.Counter)
return [
counter.event.category,
counter.event.event,
counter.value,
counter.enabled,
counter.running,
]
end
function Base.convert(::Type{LinuxPerf.Counter}, v::Vector)
return LinuxPerf.Counter(LinuxPerf.EventType(v[1], v[2]), v[3], v[4], v[5])
end

# a minimal 'eval' function, mirroring KeyTypes, but being slightly more lenient
safeeval(@nospecialize x) = x
safeeval(x::QuoteNode) = x.value
Expand Down
12 changes: 0 additions & 12 deletions src/trials.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,6 @@
# Trial #
#########

# Move into LinuxPerf.jl
Base.copy(stats::LinuxPerf.Stats) = LinuxPerf.Stats(copy(stats.threads))
function Base.copy(thread_stats::LinuxPerf.ThreadStats)
return LinuxPerf.ThreadStats(thread_stats.pid, copy(thread_stats.groups))
end
function Base.copy(counter::LinuxPerf.Counter)
return LinuxPerf.Counter(
copy(counter.event), counter.value, counter.enabled, counter.running
)
end
Base.copy(event::LinuxPerf.EventType) = LinuxPerf.EventType(event.category, event.event)

mutable struct Trial
params::Parameters
times::Vector{Float64}
Expand Down

0 comments on commit 3c3e9c6

Please sign in to comment.