Created
September 12, 2019 16:01
-
-
Save timo/c729d8899b482b2fd35cd07fc5229a21 to your computer and use it in GitHub Desktop.
how to subscribe to speshevent and gcevent
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use nqp; | |
my $eventqueue; | |
class QueueType is repr<ConcBlockingQueue> {} | |
constant $evq = QueueType.new; | |
class GCEvent is array[int64] is repr<VMArray> is array_type(int64) { | |
method gist { | |
"GCEvent:\n " ~ (<seqnum starttime vmtime duration is_major promoted promoted_ttl thread gen2roots> Z=> self.list).join("\n "); | |
} | |
} | |
class SpeshOverviewEvent is array[int64] is repr<VMArray> is array_type(int64) { | |
method gist { | |
"SpeshEvent:\n " ~ (<seqnum starttime vmtime wait_before thread_id statstime new_frames updated_frames plantime certain_spesh observed_spesh osr_spesh speshtime frames_with_stats totaltime> Z=> self.list).join("\n "); | |
} | |
} | |
nqp::vmeventsubscribe($evq<>, | |
nqp::hash( | |
'gcevent', GCEvent, | |
#'speshoverviewevent', SpeshOverviewEvent) | |
) | |
); | |
$eventqueue = $evq; | |
start { | |
loop { | |
my $thing = nqp::shift($eventqueue<>); | |
if $thing.list[4] { | |
say "---- ---- ---- ---- ----"; | |
say "GC EVENT"; | |
$thing.say; | |
say "---- ---- ---- ---- ----"; | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment