added function get_memory_usage(). available only when PHP is compiled

with --enable-memory-limit
This commit is contained in:
Andrey Hristov 2003-01-14 18:26:47 +00:00
parent 62f7e27141
commit 7866f02260
3 changed files with 15 additions and 0 deletions

View File

@ -544,6 +544,9 @@ function_entry basic_functions[] = {
PHP_FE(var_export, NULL)
PHP_FE(debug_zval_dump, NULL)
PHP_FE(print_r, NULL)
#if MEMORY_LIMIT
PHP_FE(get_memory_usage, NULL)
#endif
PHP_FE(register_shutdown_function, NULL)
PHP_FE(register_tick_function, NULL)

View File

@ -28,6 +28,9 @@ PHP_FUNCTION(var_export);
PHP_FUNCTION(debug_zval_dump);
PHP_FUNCTION(serialize);
PHP_FUNCTION(unserialize);
#if MEMORY_LIMIT
PHP_FUNCTION(get_memory_usage);
#endif
void php_var_dump(zval **struc, int level TSRMLS_DC);
void php_var_export(zval **struc, int level TSRMLS_DC);

View File

@ -677,6 +677,15 @@ PHP_FUNCTION(unserialize)
/* }}} */
#if MEMORY_LIMIT
/* {{{ proto int get_memory_usage()
Returns the allocated by PHP memory */
PHP_FUNCTION(get_memory_usage) {
RETURN_LONG(AG(allocated_memory));
}
/* }}} */
#endif
/*
* Local variables:
* tab-width: 4