Problems with PAPI_event_name_to_code function

Open discussion of PAPI.

Problems with PAPI_event_name_to_code function

Postby adiazpon » Thu Mar 03, 2011 12:17 pm

Hi all,

Im trying to use PAPI_event_name_to_code function and I am having some problems.

This is the code I am using

Code: Select all
int*  counter_translated;
PAPI_event_name_to_code("PAPI_L2_TCM",counter_translated);
printf("code=%x\n", counter_translated);
PAPI_add_event(EventSet, *counter_translated);


The result is
Code: Select all
code=0
Segmentation fault (core dumped)


I have been trying with other counters and I have the same problem. The pointer is pointing to null (=0) afther the execution.

Does anyone see anything wrong?

Thanks.
adiazpon
 
Posts: 11
Joined: Wed Mar 03, 2010 1:41 pm

Re: Problems with PAPI_event_name_to_code function

Postby vweaver1 » Tue Mar 08, 2011 12:34 pm

adiazpon wrote:
Code: Select all
int*  counter_translated;
PAPI_event_name_to_code("PAPI_L2_TCM",counter_translated);
printf("code=%x\n", counter_translated);
PAPI_add_event(EventSet, *counter_translated);




Your code should be:

Code: Select all
int  counter_translated;
PAPI_event_name_to_code("PAPI_L2_TCM",&counter_translated);
printf("code=%x\n", counter_translated);
PAPI_add_event(EventSet, *counter_translated);
vweaver1
 
Posts: 50
Joined: Wed Feb 17, 2010 4:02 pm

Re: Problems with PAPI_event_name_to_code function

Postby adiazpon » Mon Apr 11, 2011 11:19 am

Thanks you solved my problem.
adiazpon
 
Posts: 11
Joined: Wed Mar 03, 2010 1:41 pm


Return to General discussion

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest

cron