@@ -118,6 +118,12 @@ struct EventType
118
118
event:: UInt64
119
119
end
120
120
121
+ Base. copy (event:: EventType ) = EventType (event. category, event. event)
122
+
123
+ function Base. convert (:: Type{EventType} , d:: Dict{String} )
124
+ return EventType (d[" category" ], d[" event" ])
125
+ end
126
+
121
127
function all_events ()
122
128
evts = EventType[]
123
129
for (cat_name, cat_id, events) in EVENT_TYPES
@@ -356,6 +362,18 @@ struct Counter
356
362
running:: UInt64
357
363
end
358
364
365
+ function Base. copy (counter:: Counter )
366
+ return Counter (
367
+ copy (counter. event), counter. value, counter. enabled, counter. running
368
+ )
369
+ end
370
+
371
+ function Base. convert (:: Type{Counter} , d:: Dict{String} )
372
+ return Counter (
373
+ convert (EventType, d[" event" ]), d[" value" ], d[" enabled" ], d[" running" ]
374
+ )
375
+ end
376
+
359
377
struct Counters
360
378
counters:: Vector{Counter}
361
379
end
@@ -734,6 +752,14 @@ struct ThreadStats
734
752
groups:: Vector{Vector{Counter}}
735
753
end
736
754
755
+ function Base. copy (thread_stats:: ThreadStats )
756
+ return ThreadStats (thread_stats. pid, copy (thread_stats. groups))
757
+ end
758
+
759
+ function Base. convert (:: Type{ThreadStats} , d:: Dict{String} )
760
+ return ThreadStats (d[" pid" ], d[" groups" ])
761
+ end
762
+
737
763
function ThreadStats (b:: PerfBench )
738
764
groups = Vector{Counter}[]
739
765
for g in b. groups
@@ -775,6 +801,10 @@ struct Stats
775
801
threads:: Vector{ThreadStats}
776
802
end
777
803
804
+ Base. copy (stats:: Stats ) = Stats (copy (stats. threads))
805
+
806
+ Base. convert (:: Type{Stats} , d:: Dict{String} ) = Stats (d[" threads" ])
807
+
778
808
Stats (b:: PerfBenchThreaded ) = Stats (map (ThreadStats, b. data))
779
809
780
810
Base. show (io:: IO , stats:: Stats ) = printsummary (io, stats)
0 commit comments