summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@elastic.org>2009-12-10 17:01:10 -0500
committerFrank Ch. Eigler <fche@elastic.org>2009-12-10 17:01:10 -0500
commit7f707e2cb5d4e3a6a097ae9d5fdb9883ee7a81e0 (patch)
tree09654b74972f6938082d6810e257995277c930f5
parenta6b3c131a27bbf3533d7ce52bb320698edb60f9c (diff)
downloadsystemtap-steved-7f707e2cb5d4e3a6a097ae9d5fdb9883ee7a81e0.tar.gz
systemtap-steved-7f707e2cb5d4e3a6a097ae9d5fdb9883ee7a81e0.tar.xz
systemtap-steved-7f707e2cb5d4e3a6a097ae9d5fdb9883ee7a81e0.zip
runtime: print stp_alloc statistics in startup printk
* runtime/alloc.c: Define DEBUG_MEM. * runtime/print.c (_stp_print_kernel_info): Reformat/rescale mem values.
-rw-r--r--runtime/alloc.c2
-rw-r--r--runtime/print.c31
2 files changed, 13 insertions, 20 deletions
diff --git a/runtime/alloc.c b/runtime/alloc.c
index 403d20ee..6c2bd66d 100644
--- a/runtime/alloc.c
+++ b/runtime/alloc.c
@@ -16,7 +16,7 @@
static int _stp_allocated_net_memory = 0;
#define STP_ALLOC_FLAGS (GFP_KERNEL | __GFP_NORETRY | __GFP_NOWARN)
-//#define DEBUG_MEM
+#define DEBUG_MEM
/*
* If DEBUG_MEM is defined (stap -DDEBUG_MEM ...) then full memory
* tracking is used. Each allocation is recorded and matched with
diff --git a/runtime/print.c b/runtime/print.c
index 335403fb..09ebd05e 100644
--- a/runtime/print.c
+++ b/runtime/print.c
@@ -217,14 +217,8 @@ static void _stp_print_char (const char c)
static void _stp_print_kernel_info(char *vstr, int ctx, int num_probes)
{
printk(KERN_DEBUG
- "%s: systemtap: %s, base: %p, memory: %lu+%lu+%u+%u"
-#ifdef DEBUG_MEM
- "+%u"
-#endif
- " data+text+ctx+net"
-#ifdef DEBUG_MEM
- "+alloc"
-#endif
+ "%s: systemtap: %s, base: %p"
+ ", memory: %ludata/%lutext/%uctx/%unet/%ualloc kb"
", probes: %d"
#ifndef STP_PRIVILEGED
", unpriv-uid: %d"
@@ -234,19 +228,18 @@ static void _stp_print_kernel_info(char *vstr, int ctx, int num_probes)
vstr,
#ifndef STAPCONF_GRSECURITY
THIS_MODULE->module_core,
- (unsigned long) (THIS_MODULE->core_size - THIS_MODULE->core_text_size),
- (unsigned long) THIS_MODULE->core_text_size,
+ (unsigned long) (THIS_MODULE->core_size - THIS_MODULE->core_text_size)/1024,
+ (unsigned long) (THIS_MODULE->core_text_size)/1024,
#else
- THIS_MODULE->module_core_rx,
- (unsigned long) (THIS_MODULE->core_size_rw - THIS_MODULE->core_size_rx),
- (unsigned long) THIS_MODULE->core_size_rx,
-#endif
- ctx,
- _stp_allocated_net_memory,
-#ifdef DEBUG_MEM
- _stp_allocated_memory - _stp_allocated_net_memory,
+ THIS_MODULE->module_core_rx,
+ (unsigned long) (THIS_MODULE->core_size_rw - THIS_MODULE->core_size_rx)/1024,
+ (unsigned long) (THIS_MODULE->core_size_rx)/1024,
#endif
- num_probes
+ ctx/1024,
+ _stp_allocated_net_memory/1024,
+ (_stp_allocated_memory - _stp_allocated_net_memory - ctx)/1024,
+ /* (un-double-counting net/ctx because they're also stp_alloc'd) */
+ num_probes
#ifndef STP_PRIVILEGED
, _stp_uid
#endif