diff --git a/lib/modules/Debug.pmod/module.pmod b/lib/modules/Debug.pmod/module.pmod index dd8634a96daec1330461c2682f7a17e80f345fd7..42c42b40d07f80817a19ff846396fbd5a984882b 100644 --- a/lib/modules/Debug.pmod/module.pmod +++ b/lib/modules/Debug.pmod/module.pmod @@ -1,4 +1,4 @@ -// $Id: module.pmod,v 1.2 2002/11/25 01:26:08 nilsson Exp $ +// $Id: module.pmod,v 1.3 2002/11/27 21:14:05 nilsson Exp $ #pike __REAL_VERSION__ @@ -48,6 +48,20 @@ constant locate_references = _locate_references; #if constant(_memory_usage) constant memory_usage = _memory_usage; + +//! Returns a pretty printed version of the +//! output from @[memory_usage]. +string pp_memory_usage() { + string ret=" Num Bytes\n"; + mapping mu = memory_usage(); + foreach( ({ "array", "callable", "callback", "frame", "mapping", + "multiset", "object", "program", "string" }), + string what) { + ret += sprintf("%-8s %6d %6d (%s)\n", what, mu["num_"+what+"s"], + mu[what+"_bytes"], String.int2size(mu[what+"_bytes"])); + } + return ret; +} #endif #if constant(_optimizer_debug)