More than one EventSet

More than one EventSet

Postby Carmen » Thu Sep 06, 2012 7:26 am

Hi all,
Is it possible to have/use more than one EventSet? In my case, I have to monitor different events but I need to start and stop them at different times (start and stop events independently from the start and stop of other events). The idea I was thinking about is to have more than one EventSet, but it doesn't seem to work properly. Even when I have declared and initialized 2 EventSets (iEventSet1, iEventSet2), at the start(iEventSet1) point, also the events of iEventSet2 are started..., receiving in that case an error, when starting the counters of iEventSet2.

Code: Select all
   long long value1, value2;
   int iEventSet1=PAPI_NULL, iEventSet2=PAPI_NULL;
   int retval;

    retval = PAPI_library_init(PAPI_VER_CURRENT);
        if  (retval != PAPI_VER_CURRENT)
   {
      PAPI_perror (retval, NULL, 0);
      return -1;
   }

   retval = PAPI_create_eventset(&iEventSet1);
   if (retval != PAPI_OK)
   {
      printf ("Error creating EventSet1\n");
      return -1;
   }

   retval = PAPI_create_eventset(&iEventSet2);
   if (retval != PAPI_OK)
   {
      printf ("Error creating EventSet2\n");
      return -1;
   }

   retval = PAPI_add_named_event(iEventSet1, "PAPI_TOT_INS");
   if (retval != PAPI_OK)
   {
      printf ("Error adding PAPI_TOT_INS\n");
      return -1;
   }

   printf ("Eventsets: %d %d\n", iEventSet1, iEventSet2);

   retval = PAPI_add_named_event(iEventSet2, "PAPI_FP_INS");
   if (retval != PAPI_OK)
   {
      printf ("Error adding PAPI_FP_INS\n");
      return -1;
   }

   retval = PAPI_start(iEventSet1);
   if (retval != PAPI_OK)
   {
      printf ("Error starting iEventSet1\n");
      return -1;
   }

   retval = PAPI_start(iEventSet2);
   if (retval != PAPI_OK)
   {
      printf ("Error starting  iEventSet2 %d\n", retval);
      return -1;
   }

   retval = PAPI_stop(iEventSet1, &value1);
   if (retval != PAPI_OK)
   {
      printf ("Error stopping iEventSet1\n");
      return -1;
   }

   retval = PAPI_stop(iEventSet2, &value2);
   if (retval != PAPI_OK)
   {
      printf ("Error stopping iEventSet2\n");
      return -1;
   }

   printf ("Value1: %ld Value2: %ld\n", value1, value2);

   PAPI_shutdown();
}


The resulting output is:
Code: Select all
EventSets: 0 1
Error starting iEventSet2 -10


Thanks in advance.
Best regards,
Carmen
 
Posts: 1
Joined: Thu Sep 06, 2012 3:11 am

Re: More than one EventSet

Postby danterpstra » Thu Sep 06, 2012 8:16 am

Yes, you can create and use multiple event sets. But you can't nest them. Only one event set can be active at a time. In your example below, you {start eventset1, start eventset2, stop eventset1, stop eventset2}. If, on the other hand, you had done: {start eventset1, stop eventset1, start eventset2, stop eventset2}, this should have worked.
danterpstra
 
Posts: 63
Joined: Wed Jun 23, 2010 2:21 pm


Return to Classic PAPI

Who is online

Users browsing this forum: No registered users and 2 guests

cron