summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2006-05-30 14:51:20 +0000
committerIlia Alshanetsky <iliaa@php.net>2006-05-30 14:51:20 +0000
commit5186ee9c5987425a99ae7f79ee13a3a9c6af87b1 (patch)
tree23cfb2693a9d91c130f588d109dedaac7f0fe463 /ext
parent61fc4243212d9471eb5f3456ffacfb0f5ff58e7b (diff)
downloadphp-git-5186ee9c5987425a99ae7f79ee13a3a9c6af87b1.tar.gz
Added memory_get_peak_usage() function for retrieving peak memory usage of
a PHP script.
Diffstat (limited to 'ext')
-rw-r--r--ext/standard/basic_functions.c1
-rw-r--r--ext/standard/php_var.h1
-rw-r--r--ext/standard/var.c6
3 files changed, 8 insertions, 0 deletions
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 134b34c926..c0a0efcf09 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -466,6 +466,7 @@ zend_function_entry basic_functions[] = {
PHP_FE(print_r, NULL)
#if MEMORY_LIMIT
PHP_FE(memory_get_usage, NULL)
+ PHP_FE(memory_get_peak_usage, NULL)
#endif
PHP_FE(register_shutdown_function, NULL)
diff --git a/ext/standard/php_var.h b/ext/standard/php_var.h
index 74f9bcb3d8..42f1be5c21 100644
--- a/ext/standard/php_var.h
+++ b/ext/standard/php_var.h
@@ -30,6 +30,7 @@ PHP_FUNCTION(serialize);
PHP_FUNCTION(unserialize);
#if MEMORY_LIMIT
PHP_FUNCTION(memory_get_usage);
+PHP_FUNCTION(memory_get_peak_usage);
#endif
PHPAPI void php_var_dump(zval **struc, int level TSRMLS_DC);
diff --git a/ext/standard/var.c b/ext/standard/var.c
index 5a8bb152fd..db9fd60473 100644
--- a/ext/standard/var.c
+++ b/ext/standard/var.c
@@ -918,6 +918,12 @@ PHP_FUNCTION(memory_get_usage) {
RETURN_LONG(AG(allocated_memory));
}
/* }}} */
+/* {{{ proto int memory_get_peak_usage()
+ Returns the peak allocated by PHP memory */
+PHP_FUNCTION(memory_get_peak_usage) {
+ RETURN_LONG(AG(allocated_memory_peak));
+}
+/* }}} */
#endif
/*