aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/tools/flame-graph/dev/gatherhc-kern.d
blob: 1188205ee13927a81df14393b8164d00988773de (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/sbin/dtrace -s

#pragma D option stackframes=100
#pragma D option defaultargs

profile:::profile-999
/arg0/
{
	@[stack(), 1] = sum(1000);
}

sched:::off-cpu
{
	self->start = timestamp;
}

sched:::on-cpu
/(this->start = self->start)/
{
	this->delta = (timestamp - this->start) / 1000;
	@[stack(), 0] = sum(this->delta);
	self->start = 0;
}

profile:::tick-60s,
dtrace:::END
{
	normalize(@, 1000);
	printa("%koncpu:%d ms:%@d\n", @);
	trunc(@);
	exit(0);
}