+/* Extract the value corresponding to an event */
+long_long
+papi_counter(long_long values[],int event)
+{
+ int i;
+ for(i=0;i<N_PAPI_EVENTS;i++) {
+ if(papi_events[i].event_code==event) {
+ return values[i];
+ }
+ }
+ /* Passed a wrong event? */
+ debugBelch("Event %d is not part of event set\n",event);
+ return 0;
+}
+
+/* Add the events of papi_events into an event set */
+void
+papi_add_events(int EventSet)
+{
+ int i;
+ for(i=0;i<N_PAPI_EVENTS;i++) {
+ if((papi_error=PAPI_add_event(EventSet,
+ papi_events[i].event_code))
+ != PAPI_OK)
+ debugBelch("Failed adding %s to event set with error code %d\n",
+ papi_events[i].event_name,papi_error);
+ }
+}
+