Whospaging.d

Page last edited hace 2208 días 9 horas
De Solaris-ES
Saltar a: navegación, buscar
#!/usr/sbin/dtrace -s

#pragma D option quiet

sched:::on-cpu
{
        self->on = vtimestamp;
}
sched:::off-cpu
/self->on/
{
        @oncpu[execname] = sum(vtimestamp - self->on);
        self->on = 0;
}
vminfo:::anonpgin
{
        self->anonpgin = 1;
}
:::pageio_setup:return
{
        self->wait = timestamp;
}
:::pageio_done:entry
/self->anonpgin == 1/
{
        self->anonpgin = 0;
        @pageintime[execname] = sum(timestamp - self->wait);
        self->wait = 0;
}

tick-5s
{
	trunc(@oncpu, 10);
	trunc(@pageintime, 10);
	printf("\033[H\033[2J");
        normalize(@pageintime, 1000000);
        printf("Who's waiting for pagein (milliseconds):\n");
        printa("  %-50s %15@d\n", @pageintime);
        normalize(@oncpu, 1000000);
        printf("Who's on cpu (milliseconds):\n");
        printa("  %-50s %15@d\n", @oncpu);
	trunc(@oncpu);
	trunc(@pageintime);
}