cputime 713 B

12345678910111213141516171819202122232425262728293031323334
  1. .TH CPUTIME 2
  2. .SH NAME
  3. cputime, times \- cpu time in this process and children
  4. .SH SYNOPSIS
  5. .B #include <u.h>
  6. .br
  7. .B #include <libc.h>
  8. .PP
  9. .ta \w'\fLdouble 'u
  10. .B
  11. int times(long t[4])
  12. .PP
  13. .B
  14. double cputime(void)
  15. .SH DESCRIPTION
  16. If
  17. .I t
  18. is non-null,
  19. .I times
  20. fills it in
  21. with the number of milliseconds spent in user code, system calls,
  22. child processes in user code, and child processes in system calls.
  23. .I Cputime
  24. returns the sum of those same times, converted to seconds.
  25. .I Times
  26. returns the elapsed real time, in milliseconds, that the process has been running.
  27. .PP
  28. These functions read
  29. .BR /dev/cputime ,
  30. opening that file when they are first called.
  31. .SH SOURCE
  32. .B /sys/src/libc/9sys
  33. .SH SEE ALSO
  34. .IR cons (3)