perf kmem stat: Track memory freed

Track freed memory as well as allocations and show the net in the
summary.

Committer notes:

Testing it:

  # perf kmem record usleep 1
  [ perf record: Woken up 0 times to write data ]
  [ perf record: Captured and wrote 1.626 MB perf.data (4208 samples) ]
  [root@jouet ~]# perf kmem stat --slab

  SUMMARY (SLAB allocator)
  ========================
  Total bytes requested: 234,011
  Total bytes allocated: 234,504
  Total bytes freed:     213,328                                 <------
  Net total bytes allocated: 21,176
  Total bytes wasted on internal fragmentation: 493
  Internal fragmentation: 0.210231%
  Cross CPU allocations: 4/1,963
  #

Signed-off-by: David Ahern <dsahern@gmail.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1480110133-37039-1-git-send-email-dsahern@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 file changed