Page 1 of 1

Problems with PAPI_event_name_to_code function

PostPosted: Thu Mar 03, 2011 12:17 pm
by adiazpon
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.

Re: Problems with PAPI_event_name_to_code function

PostPosted: Tue Mar 08, 2011 12:34 pm
by vweaver1
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);

Re: Problems with PAPI_event_name_to_code function

PostPosted: Mon Apr 11, 2011 11:19 am
by adiazpon
Thanks you solved my problem.