DragonFly On-Line Manual Pages
LMDBG-STAT(1) LMDBG-STAT(1)
NAME
lmdbg-stat - outputs statistical information based on lmdbg-run output
SYNOPSIS
lmdbg-stat [OPTIONS] [files...]
DESCRIPTION
lmdbg-stat takes output of lmdbg-run or other lmdbg-* utilities on
input and outputs total and per-stacktrace statistical information
about memory allocations. The following statistics is output:
allocs or total_allocs
Per-stacktrace or total number of memory allocations
max or total_max
Per-stacktrace or total maximum of requested bytes
peak or total_peak
Per-stacktrace or total peak of allocated memory
leaks or total_leaks
Per-stacktrace or total amount of bytes that were
allocated but not freed
OPTIONS
-h Display the help message.
-V Display the lmdbg version.
EXAMPLE
$ cat -n testme.c
1 #include <stdlib.h>
2
3 int main ()
4 {
5 int i;
6 void *p1, *p2;
7 p1 = malloc (100);
8 for (i=0; i < 3; ++i){
9 p2 = realloc (NULL, 10+30*i);
10 }
11 free (p1);
12 free (p2);
13
14 return 0;
15 }
$ cc -O0 -g -o testme testme.c
$ lmdbg-run -o log -f 'lmdbg-stat | lmdbg-sym' ./testme
$ cat log
info stat total_leaks: 50
info stat total_allocs: 4
info stat total_free_cnt: 2
stacktrace peak: 120 max: 70 allocs: 3 leaks: 50
0xbbbe2bc3 lmdbg.c:101 log_stacktrace
0xbbbe3498 lmdbg.c:456 realloc
0x8048788 testme.c:9 main
0x80485b4
0x8048517
stacktrace peak: 100 max: 100 allocs: 1
0xbbbe2bc3 lmdbg.c:101 log_stacktrace
0xbbbe33bd lmdbg.c:431 malloc
0x8048757 testme.c:7 main
0x80485b4
0x8048517
$
SEE ALSO
lmdbg(1), lmdbg-run(1), lmdbg-sym(1), lmdbg-sort(1), lmdbg-grep(1),
lmdbg-leaks(1), lmdbg-sysleaks(1), lmdbg-strip(1), lmdbg-modules(1)
AUTHOR
Aleksey Cheusov <vle@gmx.net>
November 26, 2011 LMDBG-STAT(1)