| View previous topic :: View next topic |
| Author |
Message |
rjaekel
Joined: 09 Dec 2009 Posts: 3
|
Posted: Fri Dec 11, 2009 8:26 am Post subject: 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! |
|
| Back to top |
|
 |
mkcolg
Joined: 30 Jun 2004 Posts: 5001 Location: The Portland Group Inc.
|
Posted: Fri Dec 11, 2009 10:43 am Post subject: |
|
|
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".
| Code: | 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,
Mat |
|
| Back to top |
|
 |
rjaekel
Joined: 09 Dec 2009 Posts: 3
|
Posted: Mon Dec 14, 2009 1:55 am Post subject: |
|
|
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.
Thanks
Rene |
|
| Back to top |
|
 |
mkcolg
Joined: 30 Jun 2004 Posts: 5001 Location: The Portland Group Inc.
|
Posted: Mon Dec 14, 2009 10:39 am Post subject: |
|
|
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 |
|
| Back to top |
|
 |
rjaekel
Joined: 09 Dec 2009 Posts: 3
|
Posted: Tue Dec 15, 2009 7:28 am Post subject: |
|
|
Hi Mat
| Quote: |
If it helps, "-Minstrument" was added as of 8.0-2.
|
thanks for the info, thats sufficient for my purpose.
Thanks again
Rene |
|
| Back to top |
|
 |
|