summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkrakjoe <joe.watkins@live.co.uk>2013-12-01 08:34:17 +0000
committerkrakjoe <joe.watkins@live.co.uk>2013-12-01 08:34:17 +0000
commitcbc774723a14b523e54552860e9cf93a85eb7869 (patch)
treeca6c942263fa9417b1de6867819777585fdda0d7
parent8a826dc07b0f6e4eb1e8402e24705517c0ac5788 (diff)
downloadphp-git-cbc774723a14b523e54552860e9cf93a85eb7869.tar.gz
add info memory
-rw-r--r--Changelog.md1
-rw-r--r--phpdbg_info.c20
-rw-r--r--phpdbg_info.h12
-rw-r--r--phpdbg_prompt.c6
4 files changed, 29 insertions, 10 deletions
diff --git a/Changelog.md b/Changelog.md
index 97aa1e9586..adb4759ab0 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -11,6 +11,7 @@ Version 0.2.0 2013-00-00
4. .phpdbginit now searched in (additional) ini dirs
5. Added source command - load additional .phpdbginit script during session
6. Added remote console mode
+7. Added info memory command
Version 0.1.0 2013-11-23
------------------------
diff --git a/phpdbg_info.c b/phpdbg_info.c
index f44d19211a..12852fc38d 100644
--- a/phpdbg_info.c
+++ b/phpdbg_info.c
@@ -225,6 +225,26 @@ PHPDBG_INFO(literal) /* {{{ */
return SUCCESS;
} /* }}} */
+PHPDBG_INFO(memory) /* {{{ */
+{
+ if (is_zend_mm(TSRMLS_C)) {
+ phpdbg_notice("Memory Manager Information");
+ phpdbg_notice("Current");
+ phpdbg_writeln("|-------> Used:\t%.3f kB",
+ (float) (zend_memory_usage(0 TSRMLS_CC)/1024));
+ phpdbg_writeln("|-------> Real:\t%.3f kB",
+ (float) (zend_memory_usage(1 TSRMLS_CC)/1024));
+ phpdbg_notice("Peak");
+ phpdbg_writeln("|-------> Used:\t%.3f kB",
+ (float) (zend_memory_peak_usage(0 TSRMLS_CC)/1024));
+ phpdbg_writeln("|-------> Real:\t%.3f kB",
+ (float) (zend_memory_peak_usage(1 TSRMLS_CC)/1024));
+ } else {
+ phpdbg_error("Memory Manager Disabled !");
+ }
+ return SUCCESS;
+} /* }}} */
+
static inline void phpdbg_print_class_name(zend_class_entry **ce TSRMLS_DC) /* {{{ */
{
phpdbg_write(
diff --git a/phpdbg_info.h b/phpdbg_info.h
index 8b0f117818..49ad73ee68 100644
--- a/phpdbg_info.h
+++ b/phpdbg_info.h
@@ -31,15 +31,17 @@ PHPDBG_INFO(funcs);
PHPDBG_INFO(error);
PHPDBG_INFO(vars);
PHPDBG_INFO(literal);
+PHPDBG_INFO(memory);
static const phpdbg_command_t phpdbg_info_commands[] = {
- PHPDBG_COMMAND_D_EX(break, "show breakpoints", 'b', info_break, NULL, 0),
- PHPDBG_COMMAND_D_EX(files, "lists included files", 'F', info_files, NULL, 0),
- PHPDBG_COMMAND_D_EX(classes, "lists loaded classes", 'c', info_classes, NULL, 0),
- PHPDBG_COMMAND_D_EX(funcs, "lists loaded classes", 'f', info_funcs, NULL, 0),
- PHPDBG_COMMAND_D_EX(error, "show the last error", 'e', info_error, NULL, 0),
+ PHPDBG_COMMAND_D_EX(break, "show breakpoints", 'b', info_break, NULL, 0),
+ PHPDBG_COMMAND_D_EX(files, "show included files", 'F', info_files, NULL, 0),
+ PHPDBG_COMMAND_D_EX(classes, "show loaded classes", 'c', info_classes, NULL, 0),
+ PHPDBG_COMMAND_D_EX(funcs, "show loaded classes", 'f', info_funcs, NULL, 0),
+ PHPDBG_COMMAND_D_EX(error, "show last error", 'e', info_error, NULL, 0),
PHPDBG_COMMAND_D_EX(vars, "show active variables", 'v', info_vars, NULL, 0),
PHPDBG_COMMAND_D_EX(literal, "show active literal constants", 'l', info_literal, NULL, 0),
+ PHPDBG_COMMAND_D_EX(memory, "show memory manager stats", 'm', info_memory, NULL, 0),
PHPDBG_END_COMMAND
};
diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c
index b5a93a650a..2589a24732 100644
--- a/phpdbg_prompt.c
+++ b/phpdbg_prompt.c
@@ -769,11 +769,7 @@ PHPDBG_COMMAND(print) /* {{{ */
phpdbg_writeln("Functions\t%d", zend_hash_num_elements(EG(function_table)));
phpdbg_writeln("Constants\t%d", zend_hash_num_elements(EG(zend_constants)));
phpdbg_writeln("Included\t%d", zend_hash_num_elements(&EG(included_files)));
- phpdbg_writeln(
- "Memory\t\t%.3f/%.3f (kB)",
- (float) (zend_memory_usage(1 TSRMLS_CC)/1024),
- (float) (zend_memory_usage(0 TSRMLS_CC)/1024));
-
+
phpdbg_writeln(SEPARATE);
} break;