getrusage.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /*
  2. +----------------------------------------------------------------------+
  3. | Copyright (c) The PHP Group |
  4. +----------------------------------------------------------------------+
  5. | This source file is subject to version 3.01 of the PHP license, |
  6. | that is bundled with this package in the file LICENSE, and is |
  7. | available through the world-wide-web at the following url: |
  8. | https://www.php.net/license/3_01.txt |
  9. | If you did not receive a copy of the PHP license and are unable to |
  10. | obtain it through the world-wide-web, please send a note to |
  11. | license@php.net so we can mail you a copy immediately. |
  12. +----------------------------------------------------------------------+
  13. | Authors: Kalle Sommer Nielsen <kalle@php.net> |
  14. +----------------------------------------------------------------------+
  15. */
  16. #ifndef HAVE_GETRUSAGE_H
  17. # define HAVE_GETRUSAGE_H
  18. /*
  19. * Note
  20. *
  21. * RUSAGE_CHILDREN is not implemented, and the RUSAGE_THREAD will
  22. * therefore instead be used instead to emulate the behavior.
  23. */
  24. # define RUSAGE_SELF 0
  25. # define RUSAGE_CHILDREN 1
  26. # define RUSAGE_THREAD RUSAGE_CHILDREN
  27. /*
  28. * Implementation support
  29. *
  30. * RUSAGE_SELF
  31. * ru_utime
  32. * ru_stime
  33. * ru_majflt
  34. * ru_maxrss
  35. *
  36. * RUSAGE_THREAD
  37. * ru_utime
  38. * ru_stime
  39. *
  40. * Not implemented:
  41. * ru_ixrss (unused)
  42. * ru_idrss (unused)
  43. * ru_isrss (unused)
  44. * ru_minflt
  45. * ru_nswap (unused)
  46. * ru_inblock
  47. * ru_oublock
  48. * ru_msgsnd (unused)
  49. * ru_msgrcv (unused)
  50. * ru_nsignals (unused)
  51. * ru_nvcsw
  52. * ru_nivcsw
  53. */
  54. struct rusage
  55. {
  56. /* User time used */
  57. struct timeval ru_utime;
  58. /* System time used */
  59. struct timeval ru_stime;
  60. /* Integral max resident set size */
  61. zend_long ru_maxrss;
  62. /* Page faults */
  63. zend_long ru_majflt;
  64. #if 0
  65. /* Integral shared text memory size */
  66. zend_long ru_ixrss;
  67. /* Integral unshared data size */
  68. zend_long ru_idrss;
  69. /* Integral unshared stack size */
  70. zend_long ru_isrss;
  71. /* Page reclaims */
  72. zend_long ru_minflt;
  73. /* Swaps */
  74. zend_long ru_nswap;
  75. /* Block input operations */
  76. zend_long ru_inblock;
  77. /* Block output operations */
  78. zend_long ru_oublock;
  79. /* Messages sent */
  80. zend_long ru_msgsnd;
  81. /* Messages received */
  82. zend_long ru_msgrcv;
  83. /* Signals received */
  84. zend_long ru_nsignals;
  85. /* Voluntary context switches */
  86. zend_long ru_nvcsw;
  87. /* Involuntary context switches */
  88. zend_long ru_nivcsw;
  89. #endif
  90. };
  91. PHPAPI int getrusage(int who, struct rusage *usage);
  92. #endif