From 41372cf8f6e41cfccb2bb406245bfb7f9be18df2 Mon Sep 17 00:00:00 2001 From: Gerhard Jungwirth Date: Thu, 12 Oct 2017 10:10:01 +0200 Subject: [PATCH] TT#22005 add tracemem script for memory profiling Change-Id: I50d4f1abe1d1c5f3471c81a928944625a3bedaa3 --- sandbox/tracemem.pm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 sandbox/tracemem.pm diff --git a/sandbox/tracemem.pm b/sandbox/tracemem.pm new file mode 100644 index 0000000000..828622fff3 --- /dev/null +++ b/sandbox/tracemem.pm @@ -0,0 +1,14 @@ +our $old = 0; +BEGIN { + unshift @INC, sub { + my ($self, $file) = @_; + use GTop qw(); + my $current=GTop->new->proc_mem($$)->size; + my $delta=$current-$old; + printf "pid %d proc_mem %d delta %-10d file %s\n", $$, $current, $delta, $file; + $old=$current; + } +} +1; + +# run with: perl -Isandbox -mtracemem ...