Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report in size order as well as count order at the same time #9

Closed
Bojun-Seo opened this issue Jan 5, 2023 · 6 comments
Closed

Report in size order as well as count order at the same time #9

Bojun-Seo opened this issue Jan 5, 2023 · 6 comments

Comments

@Bojun-Seo
Copy link
Collaborator

Current heaptrace need to decide the report order. size or count.
I want to check the report order in size and count in some cases.
So it would be nice if it is possible to report in size order as well as count order at the same time.

honggyukim added a commit that referenced this issue Jan 14, 2023
Bojun requested to make heaptrace support multiple sort keys because
sometimes it's useful to show the memory allocation status based on both
size and count orders.

If someone wants to show allocation status based on count and size, then
it can be requested as follows.

  $ heaptrace -s size,count <target program>

The sort orders can be separated by commas(',').

Another small change is that it removes heap traced allocation size.

Closes: #9
Signed-off-by: Honggyu Kim <[email protected]>
@honggyukim
Copy link
Owner

@Bojun-Seo I have pushed the changes to multiple_sort_keys.

The change allows -s/--sort option have multiple sort keys. For example, -s count,size is a valid argument and it shows the stacktrace based on count and size together. The stacktrace shows following the given order.

Please have a look at the change and let me know if this is what you need.

@Bojun-Seo
Copy link
Collaborator Author

@honggyukim it looks great!
And you could add an issue to support flame graph for multiple sort keys

@honggyukim
Copy link
Owner

The usage of --flame-graph is that user redirects the output into a file so if the output prints multiple output then it can't be directly converted into .png by flamegraph.pl script so I don't want to do that. Do you really need it for --flame-graph as well?

@Bojun-Seo
Copy link
Collaborator Author

Bojun-Seo commented Jan 17, 2023

In fact, I don't use flame graph feature, so I don't need it.
But I guess it could be possible to make two pair of outputs and each of one could be converted into .png by flamegraph.pl.
It seems pretty hard to make pair of outputs, since --flame-graph option only print the output into outfp which could be stdout or user given output file.
So we need to decide some sort of policies how to make two pair of outputs.
And that's why I'd like to generate issue and discuss further(and later).

@honggyukim
Copy link
Owner

OK. I got it. We will need another interface to support multiple sort orders for flamegraph. But I’m okay to create an issue and think about it later. I will merge the current change only then.

@honggyukim
Copy link
Owner

And you could add an issue to support flame graph for multiple sort keys

@Bojun-Seo Please see #12.

Bojun-Seo added a commit to Bojun-Seo/heaptrace that referenced this issue Nov 6, 2023
If user want to ignore certain report, it could be filtered out.
The filtering list can be given with the file, each line is used
on filtering.

Usage with samples/factorial.c compiled samples/factorial.out:
$ ./heaptrace --ignore=ignore.txt samples/factorial.out
[heaptrace] initialized for /proc/227960/maps (factorial.out)
[heaptrace]   finalized for /proc/227960/maps (factorial.out)
=================================================================
[heaptrace] dump allocation sorted by 'size' for /proc/227960/maps (factorial.out)
[heaptrace] heap traced num of backtrace : 9
[heaptrace] heap traced allocation size  : 48 bytes
[heaptrace] allocator info (virtual)     : 135.168 KB
[heaptrace] allocator info (resident)    : 89.904 KB
[heaptrace] statm info (VSS/RSS/shared)  : 6.270 MB / 3.932 MB / 3.801 MB
=================================================================

$ cat ignore.txt
libfoo
bar
fac
baz

The original execution of samples/factorial.out is like followings
$ ./heaptrace samples/factorial.out
[heaptrace] initialized for /proc/227946/maps (factorial.out)
[heaptrace]   finalized for /proc/227946/maps (factorial.out)
=================================================================
[heaptrace] dump allocation sorted by 'size' for /proc/227946/maps (factorial.out)
=== backtrace honggyukim#1 === [count/peak: 1/1] [size/peak: 10 bytes/10 bytes] [age: 325.674 us]
0 [0x7f71089b8b6f] malloc +0x1f (./libheaptrace.so +0x4b6f)
1 [0x557ebd3191c4] fac +0xe (samples/factorial.out +0x11c4)
2 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
3 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
4 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
5 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
6 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
7 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)

--- snip ---

=== backtrace honggyukim#9 === [count/peak: 2/2] [size/peak: 1 bytes/1 bytes] [age: 330.780 us]
0 [0x7f71089b8b6f] malloc +0x1f (./libheaptrace.so +0x4b6f)
1 [0x557ebd3191a5] fac +0x7 (samples/factorial.out +0x11a5)
2 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
3 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
4 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
5 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
6 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
7 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)

[heaptrace] heap traced num of backtrace : 9
[heaptrace] heap traced allocation size  : 48 bytes
[heaptrace] allocator info (virtual)     : 135.168 KB
[heaptrace] allocator info (resident)    : 89.776 KB
[heaptrace] statm info (VSS/RSS/shared)  : 6.270 MB / 3.932 MB / 3.801 MB
=================================================================

Signed-off-by: Bojun Seo <[email protected]>
Bojun-Seo added a commit to Bojun-Seo/heaptrace that referenced this issue Nov 6, 2023
If user want to ignore certain report, it could be filtered out.
The filtering list can be given with the file, each line is used
on filtering.

Usage with samples/factorial.c compiled samples/factorial.out:
$ ./heaptrace --ignore=ignore.txt samples/factorial.out
[heaptrace] initialized for /proc/227960/maps (factorial.out)
[heaptrace]   finalized for /proc/227960/maps (factorial.out)
=================================================================
[heaptrace] dump allocation sorted by 'size' for /proc/227960/maps (factorial.out)
[heaptrace] heap traced num of backtrace : 9
[heaptrace] heap traced allocation size  : 48 bytes
[heaptrace] allocator info (virtual)     : 135.168 KB
[heaptrace] allocator info (resident)    : 89.904 KB
[heaptrace] statm info (VSS/RSS/shared)  : 6.270 MB / 3.932 MB / 3.801 MB
=================================================================

$ cat ignore.txt
libfoo
bar
fac
baz

The original execution of samples/factorial.out is like followings
$ ./heaptrace samples/factorial.out
[heaptrace] initialized for /proc/227946/maps (factorial.out)
[heaptrace]   finalized for /proc/227946/maps (factorial.out)
=================================================================
[heaptrace] dump allocation sorted by 'size' for /proc/227946/maps (factorial.out)
=== backtrace honggyukim#1 === [count/peak: 1/1] [size/peak: 10 bytes/10 bytes] [age: 325.674 us]
0 [0x7f71089b8b6f] malloc +0x1f (./libheaptrace.so +0x4b6f)
1 [0x557ebd3191c4] fac +0xe (samples/factorial.out +0x11c4)
2 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
3 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
4 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
5 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
6 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
7 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)

--- snip ---

=== backtrace honggyukim#9 === [count/peak: 2/2] [size/peak: 1 bytes/1 bytes] [age: 330.780 us]
0 [0x7f71089b8b6f] malloc +0x1f (./libheaptrace.so +0x4b6f)
1 [0x557ebd3191a5] fac +0x7 (samples/factorial.out +0x11a5)
2 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
3 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
4 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
5 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
6 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
7 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)

[heaptrace] heap traced num of backtrace : 9
[heaptrace] heap traced allocation size  : 48 bytes
[heaptrace] allocator info (virtual)     : 135.168 KB
[heaptrace] allocator info (resident)    : 89.776 KB
[heaptrace] statm info (VSS/RSS/shared)  : 6.270 MB / 3.932 MB / 3.801 MB
=================================================================

Signed-off-by: Bojun Seo <[email protected]>
Bojun-Seo added a commit to Bojun-Seo/heaptrace that referenced this issue Nov 13, 2023
If user want to ignore certain report, it could be filtered out.
The filtering list can be given with the file, each line is used
on filtering.

Usage with samples/factorial.c compiled samples/factorial.out:
  $ ./heaptrace --ignore=ignore.txt samples/factorial.out
  [heaptrace] initialized for /proc/227960/maps (factorial.out)
  [heaptrace]   finalized for /proc/227960/maps (factorial.out)
  =================================================================
  [heaptrace] dump allocation sorted by 'size' for /proc/227960/maps (factorial.out)
  [heaptrace] heap traced num of backtrace : 9
  [heaptrace] heap traced allocation size  : 48 bytes
  [heaptrace] allocator info (virtual)     : 135.168 KB
  [heaptrace] allocator info (resident)    : 89.904 KB
  [heaptrace] statm info (VSS/RSS/shared)  : 6.270 MB / 3.932 MB / 3.801 MB
  =================================================================

  $ cat ignore.txt
  libfoo
  bar
  fac
  baz

The original execution of samples/factorial.out is like followings.
  $ ./heaptrace samples/factorial.out
  [heaptrace] initialized for /proc/227946/maps (factorial.out)
  [heaptrace]   finalized for /proc/227946/maps (factorial.out)
  =================================================================
  [heaptrace] dump allocation sorted by 'size' for /proc/227946/maps (factorial.out)
  === backtrace honggyukim#1 === [count/peak: 1/1] [size/peak: 10 bytes/10 bytes] [age: 325.674 us]
  0 [0x7f71089b8b6f] malloc +0x1f (./libheaptrace.so +0x4b6f)
  1 [0x557ebd3191c4] fac +0xe (samples/factorial.out +0x11c4)
  2 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  3 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  4 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  5 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  6 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  7 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)

  --- snip ---

  === backtrace honggyukim#9 === [count/peak: 2/2] [size/peak: 1 bytes/1 bytes] [age: 330.780 us]
  0 [0x7f71089b8b6f] malloc +0x1f (./libheaptrace.so +0x4b6f)
  1 [0x557ebd3191a5] fac +0x7 (samples/factorial.out +0x11a5)
  2 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  3 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  4 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  5 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  6 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  7 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)

  [heaptrace] heap traced num of backtrace : 9
  [heaptrace] heap traced allocation size  : 48 bytes
  [heaptrace] allocator info (virtual)     : 135.168 KB
  [heaptrace] allocator info (resident)    : 89.776 KB
  [heaptrace] statm info (VSS/RSS/shared)  : 6.270 MB / 3.932 MB / 3.801 MB
  =================================================================

Signed-off-by: Bojun Seo <[email protected]>
Bojun-Seo added a commit to Bojun-Seo/heaptrace that referenced this issue Nov 15, 2023
If user want to ignore certain report, it could be filtered out.
The filtering list can be given with the file, each line is used
on filtering.

Usage with samples/factorial.c compiled samples/factorial.out:
  $ ./heaptrace --ignore=ignore.txt samples/factorial.out
  [heaptrace] initialized for /proc/227960/maps (factorial.out)
  [heaptrace]   finalized for /proc/227960/maps (factorial.out)
  =================================================================
  [heaptrace] dump allocation sorted by 'size' for /proc/227960/maps (factorial.out)
  [heaptrace] heap traced num of backtrace : 9
  [heaptrace] heap traced allocation size  : 48 bytes
  [heaptrace] allocator info (virtual)     : 135.168 KB
  [heaptrace] allocator info (resident)    : 89.904 KB
  [heaptrace] statm info (VSS/RSS/shared)  : 6.270 MB / 3.932 MB / 3.801 MB
  =================================================================

  $ cat ignore.txt
  libfoo
  bar
  fac
  baz

The original execution of samples/factorial.out is like followings.
  $ ./heaptrace samples/factorial.out
  [heaptrace] initialized for /proc/227946/maps (factorial.out)
  [heaptrace]   finalized for /proc/227946/maps (factorial.out)
  =================================================================
  [heaptrace] dump allocation sorted by 'size' for /proc/227946/maps (factorial.out)
  === backtrace honggyukim#1 === [count/peak: 1/1] [size/peak: 10 bytes/10 bytes] [age: 325.674 us]
  0 [0x7f71089b8b6f] malloc +0x1f (./libheaptrace.so +0x4b6f)
  1 [0x557ebd3191c4] fac +0xe (samples/factorial.out +0x11c4)
  2 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  3 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  4 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  5 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  6 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  7 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)

  --- snip ---

  === backtrace honggyukim#9 === [count/peak: 2/2] [size/peak: 1 bytes/1 bytes] [age: 330.780 us]
  0 [0x7f71089b8b6f] malloc +0x1f (./libheaptrace.so +0x4b6f)
  1 [0x557ebd3191a5] fac +0x7 (samples/factorial.out +0x11a5)
  2 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  3 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  4 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  5 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  6 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  7 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)

  [heaptrace] heap traced num of backtrace : 9
  [heaptrace] heap traced allocation size  : 48 bytes
  [heaptrace] allocator info (virtual)     : 135.168 KB
  [heaptrace] allocator info (resident)    : 89.776 KB
  [heaptrace] statm info (VSS/RSS/shared)  : 6.270 MB / 3.932 MB / 3.801 MB
  =================================================================

Signed-off-by: Bojun Seo <[email protected]>
Bojun-Seo added a commit to Bojun-Seo/heaptrace that referenced this issue Nov 15, 2023
If user want to ignore certain report, it could be filtered out.
The filtering list can be given with the file, each line is used
on filtering.

Usage with samples/factorial.c compiled samples/factorial.out:

  $ ./heaptrace --ignore=ignore.txt samples/factorial.out
  [heaptrace] initialized for /proc/227960/maps (factorial.out)
  [heaptrace]   finalized for /proc/227960/maps (factorial.out)
  =================================================================
  [heaptrace] dump allocation sorted by 'size' for /proc/227960/maps (factorial.out)
  [heaptrace] heap traced num of backtrace : 9
  [heaptrace] heap traced allocation size  : 48 bytes
  [heaptrace] allocator info (virtual)     : 135.168 KB
  [heaptrace] allocator info (resident)    : 89.904 KB
  [heaptrace] statm info (VSS/RSS/shared)  : 6.270 MB / 3.932 MB / 3.801 MB
  =================================================================

  $ cat ignore.txt
  libfoo
  bar
  fac
  baz

The original execution of samples/factorial.out is like followings.

  $ ./heaptrace samples/factorial.out
  [heaptrace] initialized for /proc/227946/maps (factorial.out)
  [heaptrace]   finalized for /proc/227946/maps (factorial.out)
  =================================================================
  [heaptrace] dump allocation sorted by 'size' for /proc/227946/maps (factorial.out)
  === backtrace honggyukim#1 === [count/peak: 1/1] [size/peak: 10 bytes/10 bytes] [age: 325.674 us]
  0 [0x7f71089b8b6f] malloc +0x1f (./libheaptrace.so +0x4b6f)
  1 [0x557ebd3191c4] fac +0xe (samples/factorial.out +0x11c4)
  2 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  3 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  4 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  5 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  6 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  7 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)

  --- snip ---

  === backtrace honggyukim#9 === [count/peak: 2/2] [size/peak: 1 bytes/1 bytes] [age: 330.780 us]
  0 [0x7f71089b8b6f] malloc +0x1f (./libheaptrace.so +0x4b6f)
  1 [0x557ebd3191a5] fac +0x7 (samples/factorial.out +0x11a5)
  2 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  3 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  4 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  5 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  6 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  7 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)

  [heaptrace] heap traced num of backtrace : 9
  [heaptrace] heap traced allocation size  : 48 bytes
  [heaptrace] allocator info (virtual)     : 135.168 KB
  [heaptrace] allocator info (resident)    : 89.776 KB
  [heaptrace] statm info (VSS/RSS/shared)  : 6.270 MB / 3.932 MB / 3.801 MB
  =================================================================

Signed-off-by: Bojun Seo <[email protected]>
Bojun-Seo added a commit to Bojun-Seo/heaptrace that referenced this issue Nov 17, 2023
If user want to ignore certain report, it could be filtered out.
The filtering list can be given with the file, each line is used
on filtering. The usage is as follows:

  $ ./heaptrace --ignore=ignore.txt samples/factorial.out
  [heaptrace] initialized for /proc/227960/maps (factorial.out)
  [heaptrace]   finalized for /proc/227960/maps (factorial.out)
  =================================================================
  [heaptrace] dump allocation sorted by 'size' for /proc/227960/maps (factorial.out)
  [heaptrace] heap traced num of backtrace : 9
  [heaptrace] heap traced allocation size  : 48 bytes
  [heaptrace] allocator info (virtual)     : 135.168 KB
  [heaptrace] allocator info (resident)    : 89.904 KB
  [heaptrace] statm info (VSS/RSS/shared)  : 6.270 MB / 3.932 MB / 3.801 MB
  =================================================================

  $ cat ignore.txt
  libfoo
  bar
  fac
  baz

The original execution of samples/factorial.out is like followings:

  $ ./heaptrace samples/factorial.out
  [heaptrace] initialized for /proc/227946/maps (factorial.out)
  [heaptrace]   finalized for /proc/227946/maps (factorial.out)
  =================================================================
  [heaptrace] dump allocation sorted by 'size' for /proc/227946/maps (factorial.out)
  === backtrace honggyukim#1 === [count/peak: 1/1] [size/peak: 10 bytes/10 bytes] [age: 325.674 us]
  0 [0x7f71089b8b6f] malloc +0x1f (./libheaptrace.so +0x4b6f)
  1 [0x557ebd3191c4] fac +0xe (samples/factorial.out +0x11c4)
  2 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  3 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  4 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  5 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  6 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  7 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)

  --- snip ---

  === backtrace honggyukim#9 === [count/peak: 2/2] [size/peak: 1 bytes/1 bytes] [age: 330.780 us]
  0 [0x7f71089b8b6f] malloc +0x1f (./libheaptrace.so +0x4b6f)
  1 [0x557ebd3191a5] fac +0x7 (samples/factorial.out +0x11a5)
  2 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  3 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  4 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  5 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  6 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  7 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)

  [heaptrace] heap traced num of backtrace : 9
  [heaptrace] heap traced allocation size  : 48 bytes
  [heaptrace] allocator info (virtual)     : 135.168 KB
  [heaptrace] allocator info (resident)    : 89.776 KB
  [heaptrace] statm info (VSS/RSS/shared)  : 6.270 MB / 3.932 MB / 3.801 MB
  =================================================================

Signed-off-by: Bojun Seo <[email protected]>
Bojun-Seo added a commit to Bojun-Seo/heaptrace that referenced this issue Nov 21, 2024
If user want to ignore certain report, it could be filtered out.
The filtering list can be given with the file, each line is used
on filtering. The usage is as follows:

  $ ./heaptrace --ignore=ignore.txt samples/factorial.out
  [heaptrace] initialized for /proc/227960/maps (factorial.out)
  [heaptrace]   finalized for /proc/227960/maps (factorial.out)
  =================================================================
  [heaptrace] dump allocation sorted by 'size' for /proc/227960/maps (factorial.out)
  [heaptrace] heap traced num of backtrace : 9
  [heaptrace] heap traced allocation size  : 48 bytes
  [heaptrace] allocator info (virtual)     : 135.168 KB
  [heaptrace] allocator info (resident)    : 89.904 KB
  [heaptrace] statm info (VSS/RSS/shared)  : 6.270 MB / 3.932 MB / 3.801 MB
  =================================================================

  $ cat ignore.txt
  libfoo
  bar
  fac
  baz

The original execution of samples/factorial.out is like followings:

  $ ./heaptrace samples/factorial.out
  [heaptrace] initialized for /proc/227946/maps (factorial.out)
  [heaptrace]   finalized for /proc/227946/maps (factorial.out)
  =================================================================
  [heaptrace] dump allocation sorted by 'size' for /proc/227946/maps (factorial.out)
  === backtrace honggyukim#1 === [count/peak: 1/1] [size/peak: 10 bytes/10 bytes] [age: 325.674 us]
  0 [0x7f71089b8b6f] malloc +0x1f (./libheaptrace.so +0x4b6f)
  1 [0x557ebd3191c4] fac +0xe (samples/factorial.out +0x11c4)
  2 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  3 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  4 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  5 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  6 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  7 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)

  --- snip ---

  === backtrace honggyukim#9 === [count/peak: 2/2] [size/peak: 1 bytes/1 bytes] [age: 330.780 us]
  0 [0x7f71089b8b6f] malloc +0x1f (./libheaptrace.so +0x4b6f)
  1 [0x557ebd3191a5] fac +0x7 (samples/factorial.out +0x11a5)
  2 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  3 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  4 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  5 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  6 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  7 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)

  [heaptrace] heap traced num of backtrace : 9
  [heaptrace] heap traced allocation size  : 48 bytes
  [heaptrace] allocator info (virtual)     : 135.168 KB
  [heaptrace] allocator info (resident)    : 89.776 KB
  [heaptrace] statm info (VSS/RSS/shared)  : 6.270 MB / 3.932 MB / 3.801 MB
  =================================================================

Signed-off-by: Bojun Seo <[email protected]>
Bojun-Seo added a commit that referenced this issue Nov 24, 2024
If user want to ignore certain report, it could be filtered out.
The filtering list can be given with the file, each line is used
on filtering. The usage is as follows:

  $ ./heaptrace --ignore=ignore.txt samples/factorial.out
  [heaptrace] initialized for /proc/227960/maps (factorial.out)
  [heaptrace]   finalized for /proc/227960/maps (factorial.out)
  =================================================================
  [heaptrace] dump allocation sorted by 'size' for /proc/227960/maps (factorial.out)
  [heaptrace] heap traced num of backtrace : 9
  [heaptrace] heap traced allocation size  : 48 bytes
  [heaptrace] allocator info (virtual)     : 135.168 KB
  [heaptrace] allocator info (resident)    : 89.904 KB
  [heaptrace] statm info (VSS/RSS/shared)  : 6.270 MB / 3.932 MB / 3.801 MB
  =================================================================

  $ cat ignore.txt
  libfoo
  bar
  fac
  baz

The original execution of samples/factorial.out is like followings:

  $ ./heaptrace samples/factorial.out
  [heaptrace] initialized for /proc/227946/maps (factorial.out)
  [heaptrace]   finalized for /proc/227946/maps (factorial.out)
  =================================================================
  [heaptrace] dump allocation sorted by 'size' for /proc/227946/maps (factorial.out)
  === backtrace #1 === [count/peak: 1/1] [size/peak: 10 bytes/10 bytes] [age: 325.674 us]
  0 [0x7f71089b8b6f] malloc +0x1f (./libheaptrace.so +0x4b6f)
  1 [0x557ebd3191c4] fac +0xe (samples/factorial.out +0x11c4)
  2 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  3 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  4 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  5 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  6 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  7 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)

  --- snip ---

  === backtrace #9 === [count/peak: 2/2] [size/peak: 1 bytes/1 bytes] [age: 330.780 us]
  0 [0x7f71089b8b6f] malloc +0x1f (./libheaptrace.so +0x4b6f)
  1 [0x557ebd3191a5] fac +0x7 (samples/factorial.out +0x11a5)
  2 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  3 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  4 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  5 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  6 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)
  7 [0x557ebd3191d8] fac +0x13 (samples/factorial.out +0x11d8)

  [heaptrace] heap traced num of backtrace : 9
  [heaptrace] heap traced allocation size  : 48 bytes
  [heaptrace] allocator info (virtual)     : 135.168 KB
  [heaptrace] allocator info (resident)    : 89.776 KB
  [heaptrace] statm info (VSS/RSS/shared)  : 6.270 MB / 3.932 MB / 3.801 MB
  =================================================================

Signed-off-by: Bojun Seo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants