Analyzers
Support for Analyzers (Intel VTune™ Profiler, Intel Advisor, Intel Inspector)
4729 Discussions

How to point to the beginning of interested code during memory growth analysis?

Mikhail_L
Employee
670 Views

I'd like to locate source code that leads to memory growth during processing a set of files in a loop.

I'd like to set memory growth start/end points at the beginning/end of that loop iteration.

May I somehow use debugger to set breakpoint at the beginning of a loop and start analysis only when this breakpoint is reached?

Labels (1)
0 Kudos
1 Solution
Michael_T
Employee
651 Views

Hi Mikhail,

You may use either of these approaches, but first one looks more reliable to me:

1) Add source code annotations to generate memory growth snapshots at interesting locations.

__itt_heap_record_memory_growth_begin();

__itt_heap_record_memory_growth_end();

See documentation here: https://www.intel.com/content/www/us/en/develop/documentation/inspector-user-guide-windows/top/api-s...

 

2) You may also configure analysis to run with Debugger using "Select analysis start with debugger" option when you configure analysis. In this case process will start with debugger attached, but analysis will be turned off. When you reach interesting location of the application (e.g. a breakpoint), re-enable analysis and continue application execution in the debugger. Here is help page: https://www.intel.com/content/www/us/en/develop/documentation/inspector-user-guide-windows/top/inves...

 

View solution in original post

4 Replies
Michael_T
Employee
652 Views

Hi Mikhail,

You may use either of these approaches, but first one looks more reliable to me:

1) Add source code annotations to generate memory growth snapshots at interesting locations.

__itt_heap_record_memory_growth_begin();

__itt_heap_record_memory_growth_end();

See documentation here: https://www.intel.com/content/www/us/en/develop/documentation/inspector-user-guide-windows/top/api-s...

 

2) You may also configure analysis to run with Debugger using "Select analysis start with debugger" option when you configure analysis. In this case process will start with debugger attached, but analysis will be turned off. When you reach interesting location of the application (e.g. a breakpoint), re-enable analysis and continue application execution in the debugger. Here is help page: https://www.intel.com/content/www/us/en/develop/documentation/inspector-user-guide-windows/top/inves...

 

Mikhail_L
Employee
632 Views

Thank you for provided approaches. I'll try first one.

I tried second approach, but faced the following problem:

1. I execute analysis with "Select analysis start with debugger". It starts with the message

Stopped at target entry
 - waiting for debugger to connect...

If you chose to start the debugger manually or the debugger does not appear due to an error, start a supported debugger now and enter the following command at the debugger prompt:  target remote :44749

# Option â-xâ-- â

2. I start gdb in a new terminal window, connect to the target, set breakpoint and run program execution. But unfortunately, a warning message is printed and debugger doesn't stop on specified breakpoint :

sh-4.4# gdb /localdisk2/github/build/debug/bin/sycl-post-link
GNU gdb (Ubuntu 8.1-0ubuntu3) 8.1.0.20180409-git
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /localdisk2/github/build/debug/bin/sycl-post-link...done.
(gdb) target remote :45317
Remote debugging using :45317
warning: remote target does not support file transfer, attempting to access files from local filesystem.
Reading symbols from /lib64/ld-linux-x86-64.so.2...Reading symbols from /usr/lib/debug//lib/x86_64-linux-gnu/ld-2.27.so...done.
done.
0x00007fc547617090 in _start () from /lib64/ld-linux-x86-64.so.2
(gdb) b sycl-post-link.cpp:824
Breakpoint 1 at 0xb7bf8: file /localdisk2/github/llvm/llvm/tools/sycl-post-link/sycl-post-link.cpp, line 824.
(gdb) c
Continuing.
warning: Probes-based dynamic linker interface failed.
Reverting to original interface.

[Inferior 1 (Remote target) exited normally]

 

What should I do to fix this problem?

Mikhail_L
Employee
619 Views

1st approach has helped me, thank you very much.

This tool saved us a lot of time speeding up investigation of memory growth issue in our application.

AlekhyaV_Intel
Moderator
616 Views

Hi,


Thank you for accepting our solution. If you need any further assistance, please post a new question as this thread is no longer monitored by Intel.


Regards,

Alekhya


Reply