times.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /*++
  2. Copyright (c) 2013 Minoca Corp.
  3. This file is licensed under the terms of the GNU Lesser General Public
  4. License version 3. Alternative licensing terms are available. Contact
  5. info@minocacorp.com for details.
  6. Module Name:
  7. times.h
  8. Abstract:
  9. This header contains definitions for getting process execution times.
  10. Author:
  11. Evan Green 23-Jun-2013
  12. --*/
  13. #ifndef _SYS_TIMES_H
  14. #define _SYS_TIMES_H
  15. //
  16. // ------------------------------------------------------------------- Includes
  17. //
  18. #include <sys/types.h>
  19. //
  20. // ---------------------------------------------------------------- Definitions
  21. //
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. //
  26. // ------------------------------------------------------ Data Type Definitions
  27. //
  28. /*++
  29. Structure Description:
  30. This structure describes information about process running time.
  31. Members:
  32. tms_utime - Stores the number of clock ticks of user mode time this process
  33. has accumulated.
  34. tms_stime - Stores the number of clock ticks of kernel mode time this
  35. process has accumulated.
  36. tms_cutime - Stores the number of clock ticks of user mode time terminated
  37. child processes of this process have accumulated.
  38. tms_cstime - Stores the number of clock ticks of kernel mode time
  39. terminated child processes of this process have accumulated.
  40. --*/
  41. struct tms {
  42. clock_t tms_utime;
  43. clock_t tms_stime;
  44. clock_t tms_cutime;
  45. clock_t tms_cstime;
  46. };
  47. //
  48. // -------------------------------------------------------------------- Globals
  49. //
  50. //
  51. // -------------------------------------------------------- Function Prototypes
  52. //
  53. LIBC_API
  54. clock_t
  55. times (
  56. struct tms *Times
  57. );
  58. /*++
  59. Routine Description:
  60. This routine returns the running time for the current process and its
  61. children.
  62. Arguments:
  63. Times - Supplies a pointer where the running time information will be
  64. returned.
  65. Return Value:
  66. On success, returns the elapsed real time, in clock ticks, since an
  67. arbitrary time in the past (like boot time). This point does not change
  68. from one invocation of times within the process to another. On error, -1
  69. will be returned and errno will be set to indicate the error.
  70. --*/
  71. #ifdef __cplusplus
  72. }
  73. #endif
  74. #endif