Gwinel / likwid

Automatically exported from code.google.com/p/likwid
GNU General Public License v3.0
0 stars 0 forks source link

C++ support #51

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

first of all thanks for this great tool! It's really nice to have a small, 
lightweight tool for performance measurements.
Right now I'm using likwid in a project implemented in C++. While integrating 
support for the marker API into my code, I ran into two small issues:
It would be great for C++ users if the likwid header file declared the API 
functions as extern "C" if a C++ compiler is used. Of course this can be also 
done in the code including likwid.h, but it probably would be neater to have it 
in the header file itself.
Secondly I got compiler warnings due to likwid_markerStartRegion() and 
likwid_markerStopRegion() having a char* as their argument. As far as I can 
tell this should be a const char*. This requires only changes in 4 lines of 
code in likwid.h and libperfctr.c.

It would be really great if these fixes could be integrated into likwid to make 
it even easier to use for C++ projects.

Original issue reported on code.google.com by severins...@gmail.com on 15 Jul 2011 at 3:13

GoogleCodeExporter commented 9 years ago
Hi,
I already have this on my TODO list.Be careful, because the string argument is 
used as a key to a hashmap there were problem with multiple region calls in 
C++. Also be aware that if using this for multithreaded code you should stick 
with the DIRECT access to the MSR device files not using the daemon. The daemon 
cannot handle multiple threads at the moment. This solution is also less 
overhead. I am working currently on a bunch of things, but hope to provide an 
update version in the next few weeks. I will ad a test case to check the use of 
the marker API in C++ programs.

Original comment by jan.trei...@gmail.com on 15 Jul 2011 at 3:19

GoogleCodeExporter commented 9 years ago
The header now can be directly included in C++.

Also the API was changed to const char*.

There was a severe bug in the hashing routine which also was fixed.

All these changes are included in the next minor release.

Original comment by jan.trei...@gmail.com on 29 Jul 2011 at 9:53