gatherhc-kern.d 461 B

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