summaryrefslogtreecommitdiff
path: root/ext/standard/microtime.c
diff options
context:
space:
mode:
authorKalle Sommer Nielsen <kalle@php.net>2015-05-20 15:45:37 +0200
committerKalle Sommer Nielsen <kalle@php.net>2015-05-20 15:45:37 +0200
commit22fc3baa7a63c19e44d99deb7dc7a044f6646f98 (patch)
treed430ea47ed0bbed463707c007c6769a85a8f17b5 /ext/standard/microtime.c
parentf7bfeac419607c3a715d8663128094d110bdafea (diff)
downloadphp-git-22fc3baa7a63c19e44d99deb7dc7a044f6646f98.tar.gz
Windows support for getrusage()
* See getrusage.c/h for implementation details and limitations * Tests passes and have had their SKIPIF updated * psapi.lib is now linked to by default
Diffstat (limited to 'ext/standard/microtime.c')
-rw-r--r--ext/standard/microtime.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/ext/standard/microtime.c b/ext/standard/microtime.c
index 6d5b8cc695..4b391bbb7d 100644
--- a/ext/standard/microtime.c
+++ b/ext/standard/microtime.c
@@ -25,6 +25,7 @@
#endif
#ifdef PHP_WIN32
#include "win32/time.h"
+#include "win32/getrusage.h"
#elif defined(NETWARE)
#include <sys/timeval.h>
#include <sys/time.h>
@@ -129,9 +130,14 @@ PHP_FUNCTION(getrusage)
}
array_init(return_value);
+
#define PHP_RUSAGE_PARA(a) \
add_assoc_long(return_value, #a, usg.a)
-#if !defined( _OSD_POSIX) && !defined(__BEOS__) /* BS2000 has only a few fields in the rusage struct */
+
+#ifdef PHP_WIN32 /* Windows only implements a limited amount of fields from the rusage struct */
+ PHP_RUSAGE_PARA(ru_majflt);
+ PHP_RUSAGE_PARA(ru_maxrss);
+#elif !defined( _OSD_POSIX) && !defined(__BEOS__) /* BS2000 has only a few fields in the rusage struct*/
PHP_RUSAGE_PARA(ru_oublock);
PHP_RUSAGE_PARA(ru_inblock);
PHP_RUSAGE_PARA(ru_msgsnd);
@@ -150,6 +156,7 @@ PHP_FUNCTION(getrusage)
PHP_RUSAGE_PARA(ru_utime.tv_sec);
PHP_RUSAGE_PARA(ru_stime.tv_usec);
PHP_RUSAGE_PARA(ru_stime.tv_sec);
+
#undef PHP_RUSAGE_PARA
}
#endif /* HAVE_GETRUSAGE */