]> granicus.if.org Git - php/commitdiff
MFB: Added memory_get_peak_usage() function for retrieving peak memory
authorIlia Alshanetsky <iliaa@php.net>
Tue, 30 May 2006 14:51:54 +0000 (14:51 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Tue, 30 May 2006 14:51:54 +0000 (14:51 +0000)
usage of a PHP script.

ext/standard/basic_functions.c
ext/standard/php_var.h
ext/standard/var.c

index 7f9fa01d41f28d0eebc08d23cc999fe53d1bc474..ace8ebd32a383eee34eeff382e65f6f40c1c01f0 100644 (file)
@@ -464,6 +464,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)
index 7e8ca280cd277676fb9b2d9a44d71d3701868b8c..6aea4b06785db6a14b213d5a3021769501201320 100644 (file)
@@ -31,6 +31,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, int verbose TSRMLS_DC);
index dff8b472f4ec43763f497b31111a05e3e43a6dd9..01a9e0daf15d8a6b1516f5c2feab529176037f80 100644 (file)
@@ -1154,6 +1154,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
 
 /*