- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi I am using Pin-3.7 tool and would like to instrument a specific part of my code (Loop structure). As I was not able to mark the region of code of interest, I placed the code to be instrumented in a function (say "myfunc") and called it from the main.
I am using icc-19.0 compiler to compile my test program and using insmix.so tool to get the instruction mix count, which lists these counts function wise.
Just using icc with -g flag lists the instruction mix count of main function and "myfunc". However, when I compile test program using icc with -g -O2/-O3 the instruction mix counts are listed only for main function not for "myfunc".
So is the symbol information about the function lost with -O2/-O3 flag? What am I missing?
Is there any other way to instrument only a part of the code? say by marking a region.
Thanks,
Shilpa
- Tags:
- Intel® Advanced Vector Extensions (Intel® AVX)
- Intel® Streaming SIMD Extensions
- Parallel Computing
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
So is the symbol information about the function lost with -O2/-O3 flag? What am I missing?
If you simply moved your code of interest into a static function in the same source file as main, it's entirely possible that the compiler inlined it when you compile with optimization enabled (which does rather destroy the point of what you were trying to do!).
There are a number of ways to prevent this
- Make your function extern, and put it into another file (so that the compiler cannot see it when it's compiling the caller).
- Give the function the __attribute__((noinline))
- Put #pragma noinline at the call site
https://godbolt.org/z/DpAkWM shows an example of using method 2.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for the reply. Yes indeed the compiler was inlining the function. Using __attribute__((noinline)) for the function solved the problem.
Thanks again,
Shilpa
![](/skins/images/45C6C2D737ED71F4C51F0145C8CB1E9C/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page