First page
Back
Continue
Last page
Overview
Graphics
Dynamic tracing of the X server
Get average CPU time per request:
- #!/usr/sbin/dtrace -s
- Xserver*:::request-start
- {
- reqstart = vtimestamp;
- }
- Xserver*:::request-done
- {
- @times[copyinstr(arg0)]
- = avg(vtimestamp - reqstart);
}
Notes:
This can be rewrittenslightly to cache the string containing the name of the request since it will be reused many times, and copying it over and over from the kernel:
#!/usr/sbin/dtrace -s
string Xrequest[uintptr_t];
Xserver*:::request-start
/Xrequest[arg0] == ""/
{
Xrequest[arg0] = copyinstr(arg0);
}
Xserver*:::request-start
{
@counts[Xrequest[arg0]] = count();
}