function profiling on 64bit machine

Hi all,

I’m trying to implement my own version of the function instrumenter on a 64bit Linux machine to insert calls of the ___rouent function to the user code, which is provided by the -Mprof=func compiler option.
On my particular machine a function call of

void ___rouent64( struct s1* p )

gets inserted, but the delivered structure by the compiler is not generated as usual and causes a segmentation fault. I do not observe this behaviour at a
32bit machine via a ___rouent(…) call. I’ve tested versions PGI 8.0.1 and 7.1.3.

Could it be that the structur is somehow different (not an empty pointer)?

Any ideas how to track this down?

Thanks in advance!

Hi rjaekel,

To have the compiler call your own profiling routines, you’ll want to compile with the “-Minstrument” flag. It’s the same as -Mprof=func, except instead of calling rouent, it calls the user defined functions “__cyg_profile_func_enter” and “__cyg_profile_func_exit”.

void __cyg_profile_func_enter (void *this_fn, void *call_site);
void __cyg_profile_func_exit (void *this_fn, void *call_site);

“this_fn” is a pointer to the start of the current function and “call_site” is the address from which it was called.

Hope this helps,

Hi Mat,

your completely right for, the version 9 of the PGI compiler uses the underlaying GNU way of function instrumentation, but not previous versions.
I’ve already implemented a version for the new compiler version, but I need an implementation for the older versions as well, which include different function calls. As I said earlier, the 32bit version is doing exactly what it sould, but not the 64bit version.



Hi Rene,

If it helps, “-Minstrument” was added as of 8.0-2.

For “___rouent64”, we actually using a non-standard ABI which makes it difficult for users to overload this function. It is possible, but requires you to write a wrapper in assembly. I’ll see if can find my code from a few years ago. Of course, this would not be recommended nor supported.

  • Mat

Hi Mat

If it helps, “-Minstrument” was added as of 8.0-2.

thanks for the info, thats sufficient for my purpose.

Thanks again