flamegraph

Fork of flamegraph without j***s*****
git clone git://git.laack.co/flamegraph.git
Log | Files | Refs | README

gatherhc-kern.d (461B)


      1 #!/usr/sbin/dtrace -s
      2 
      3 #pragma D option stackframes=100
      4 #pragma D option defaultargs
      5 
      6 profile:::profile-999
      7 /arg0/
      8 {
      9 	@[stack(), 1] = sum(1000);
     10 }
     11 
     12 sched:::off-cpu
     13 {
     14 	self->start = timestamp;
     15 }
     16 
     17 sched:::on-cpu
     18 /(this->start = self->start)/
     19 {
     20 	this->delta = (timestamp - this->start) / 1000;
     21 	@[stack(), 0] = sum(this->delta);
     22 	self->start = 0;
     23 }
     24 
     25 profile:::tick-60s,
     26 dtrace:::END
     27 {
     28 	normalize(@, 1000);
     29 	printa("%koncpu:%d ms:%@d\n", @);
     30 	trunc(@);
     31 	exit(0);
     32 }