peu_libpfm4_events.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int _peu_libpfm4_setup_presets (char *name, int type, int cidx)
int _peu_libpfm4_ntv_enum_events (unsigned int *EventCode, int modifier, struct native_event_table_t *event_table)
int _peu_libpfm4_ntv_name_to_code (char *ntv_name, unsigned int *EventCode, struct native_event_table_t *event_table)
int _peu_libpfm4_ntv_code_to_name (unsigned int EventCode, char *name, int len, struct native_event_table_t *event_table)
int _peu_libpfm4_ntv_code_to_descr (unsigned int EventCode, char *name, int len, struct native_event_table_t *event_table)
int _peu_libpfm4_shutdown (papi_vector_t *my_vector, struct native_event_table_t *event_table)
int _peu_libpfm4_init (papi_vector_t *my_vector, struct native_event_table_t *event_table, int pmu_type)
int _peu_libpfm4_ntv_code_to_info (unsigned int EventCode, PAPI_event_info_t *info, struct native_event_table_t *event_table)
int _peu_libpfm4_get_cidx (void)

Function Documentation

int _peu_libpfm4_get_cidx ( void   ) 

Definition at line 54 of file perf_event_uncore.c.

00054                         {
00055     return our_cidx;
00056 }

Here is the caller graph for this function:

int _peu_libpfm4_init ( papi_vector_t my_vector,
struct native_event_table_t event_table,
int  pmu_type 
)

Definition at line 1039 of file peu_libpfm4_events.c.

01041                          {
01042 
01043    int detected_pmus=0;
01044    int i;
01045    int j=0;
01046    pfm_err_t retval = PFM_SUCCESS;
01047    unsigned int ncnt;
01048    pfm_pmu_info_t pinfo;
01049 
01050    /* allocate the native event structure */
01051 
01052    event_table->num_native_events=0;
01053    event_table->pmu_type=pmu_type;
01054 
01055    event_table->native_events=calloc(NATIVE_EVENT_CHUNK,
01056                        sizeof(struct native_event_t));
01057    if (event_table->native_events==NULL) {
01058       return PAPI_ENOMEM;
01059    }
01060    event_table->allocated_native_events=NATIVE_EVENT_CHUNK;
01061 
01062    /* Count number of present PMUs */
01063    detected_pmus=0;
01064    ncnt=0;
01065 
01066    my_vector->cmp_info.num_cntrs=0;
01067 
01068    SUBDBG("Detected pmus:\n");
01069    for(i=0;i<PFM_PMU_MAX;i++) {
01070       memset(&pinfo,0,sizeof(pfm_pmu_info_t));
01071       pinfo.size = sizeof(pfm_pmu_info_t);
01072       retval=pfm_get_pmu_info(i, &pinfo);
01073       if (retval!=PFM_SUCCESS) {
01074      continue;
01075       }
01076 
01077       if (pmu_is_present_and_right_type(&pinfo,pmu_type)) {
01078      SUBDBG("\t%d %s %s %d\n",i,pinfo.name,pinfo.desc,pinfo.type);
01079 
01080          detected_pmus++;
01081      ncnt+=pinfo.nevents;
01082 
01083      if ((j < PAPI_PMU_MAX) && (pinfo.name != NULL)) {
01084          my_vector->cmp_info.pmu_names[j++] = strdup(pinfo.name);
01085      }
01086          my_vector->cmp_info.num_cntrs += pinfo.num_cntrs+
01087                                    pinfo.num_fixed_cntrs;
01088       }
01089    }
01090    SUBDBG("%d native events detected on %d pmus\n",ncnt,detected_pmus);
01091 
01092    my_vector->cmp_info.num_native_events = ncnt;
01093 
01094    SUBDBG( "num_counters: %d\n", my_vector->cmp_info.num_cntrs );
01095 
01096    return PAPI_OK;
01097 }

Here is the call graph for this function:

Here is the caller graph for this function:

int _peu_libpfm4_ntv_code_to_descr ( unsigned int  EventCode,
char *  name,
int  len,
struct native_event_table_t event_table 
)

Definition at line 619 of file peu_libpfm4_events.c.

00622 {
00623     SUBDBG("ENTER: EventCode: %#x, ntv_descr: %p, len: %d: event_table: %p\n", EventCode, ntv_descr, len, event_table);
00624 
00625     int eidx;
00626     int papi_event_code;
00627 
00628     // get the attribute index for this papi event
00629     papi_event_code = _papi_hwi_get_papi_event_code();
00630 
00631     // a papi event code less than 0 is invalid, return error
00632     if (papi_event_code <= 0) {
00633         SUBDBG("EXIT: PAPI_ENOEVNT\n");
00634         return PAPI_ENOEVNT;
00635     }
00636 
00637     // find our native event table for this papi event code (search list backwards because it improves chances of finding it quickly)
00638     for (eidx=event_table->num_native_events-1 ; eidx>=0 ; eidx--) {
00639         SUBDBG("native_event[%d]: papi_event_code: %#x, libpfm4_idx: %#x\n", eidx, event_table->native_events[eidx].papi_event_code, event_table->native_events[eidx].libpfm4_idx);
00640         if ((papi_event_code == event_table->native_events[eidx].papi_event_code) && (EventCode == ((unsigned)event_table->native_events[eidx].libpfm4_idx))) {
00641             break;
00642         }
00643     }
00644 
00645     // if we did not find a match, return an error
00646     if (eidx < 0) {
00647         // If we did not find a match in our native event table, then the code passed in has not been
00648         // allocated yet  It should not be possible to get to this code.  The user has to call the papi
00649         // code_to_name api with a papi event code for a native event.  But the only way to get one of
00650         // those is to call either name_to_code or enum_cmp_events first.  When one of these calls is
00651         // done we allocate the event so it should always be there.
00652 
00653         SUBDBG("EXIT: PAPI_ENOEVNT\n");
00654         return PAPI_ENOEVNT;
00655     }
00656 
00657     char *edesc = event_table->native_events[eidx].event_description;
00658 
00659     // if it will not fit, return error
00660     if (strlen (edesc) >= (unsigned)len) {
00661         SUBDBG("EXIT: event name %s will not fit in buffer provided\n", edesc);
00662         return PAPI_EBUF;
00663     }
00664     strcpy (ntv_descr, edesc);
00665 
00666     // if this event had masks, also add their descriptions
00667     char *mdesc = event_table->native_events[eidx].mask_description;
00668     if ((mdesc != NULL)  &&  (strlen(mdesc) > 0)) {
00669         if ((strlen(edesc) + 8 + strlen(mdesc)) >= (unsigned)len) {
00670             SUBDBG("EXIT: Not enough room for event and mask descriptions: need: %u, have: %u", (unsigned)(strlen(edesc) + 8 + strlen(mdesc)), (unsigned)len);
00671             return PAPI_EBUF;
00672         }
00673         strcat (ntv_descr, ", masks:");
00674         strcat (ntv_descr, mdesc);
00675     }
00676 
00677     SUBDBG("EXIT: event description: %s\n", ntv_descr);
00678     return PAPI_OK;
00679 }

Here is the call graph for this function:

Here is the caller graph for this function:

int _peu_libpfm4_ntv_code_to_info ( unsigned int  EventCode,
PAPI_event_info_t info,
struct native_event_table_t event_table 
)

Definition at line 683 of file peu_libpfm4_events.c.

00686 {
00687     SUBDBG("ENTER: EventCode: %#x, info: %p, event_table: %p\n", EventCode, info, event_table);
00688 
00689     int ret;
00690 
00691     // get the event name first
00692     if ((ret = _peu_libpfm4_ntv_code_to_name(EventCode, info->symbol, sizeof(info->symbol), event_table)) != PAPI_OK) {
00693         SUBDBG("EXIT: _peu_libpfm4_ntv_code_to_name returned: %d\n", ret);
00694         return PAPI_ENOEVNT;
00695     }
00696 
00697     if ((ret = _peu_libpfm4_ntv_code_to_descr(EventCode, info->long_descr, sizeof(info->long_descr), event_table)) != PAPI_OK) {
00698         SUBDBG("EXIT: _peu_libpfm4_ntv_code_to_descr returned: %d\n", ret);
00699         return PAPI_ENOEVNT;
00700     }
00701 
00702     SUBDBG("EXIT: EventCode: %#x, name: %s, desc: %s\n", EventCode, info->symbol, info->long_descr);
00703     return PAPI_OK;
00704 }

Here is the call graph for this function:

Here is the caller graph for this function:

int _peu_libpfm4_ntv_code_to_name ( unsigned int  EventCode,
char *  name,
int  len,
struct native_event_table_t event_table 
)

Definition at line 532 of file peu_libpfm4_events.c.

00535 {
00536     SUBDBG("ENTER: EventCode: %#x, ntv_name: %p, len: %d, event_table: %p\n", EventCode, ntv_name, len, event_table);
00537 
00538     int eidx;
00539     int papi_event_code;
00540 
00541     // get the attribute index for this papi event
00542     papi_event_code = _papi_hwi_get_papi_event_code();
00543 
00544     // a papi event code less than 0 is invalid, return error
00545     if (papi_event_code <= 0) {
00546         SUBDBG("EXIT: PAPI_ENOEVNT\n");
00547         return PAPI_ENOEVNT;
00548     }
00549 
00550     // find our native event table for this papi event code (search list backwards because it improves chances of finding it quickly)
00551     for (eidx=event_table->num_native_events-1 ; eidx>=0 ; eidx--) {
00552         if ((papi_event_code == event_table->native_events[eidx].papi_event_code) && (EventCode == ((unsigned)event_table->native_events[eidx].libpfm4_idx))) {
00553             SUBDBG("Found native_event[%d]: papi_event_code: %#x, libpfm4_idx: %#x\n", eidx, event_table->native_events[eidx].papi_event_code, event_table->native_events[eidx].libpfm4_idx);
00554             break;
00555         }
00556     }
00557 
00558     // if we did not find a match, return an error
00559     if (eidx < 0) {
00560         // If we did not find a match in our native event table, then the code passed in has not been
00561         // allocated yet  It should not be possible to get to this code.  The user has to call the papi
00562         // code_to_name api with a papi event code for a native event.  But the only way to get one of
00563         // those is to call either name_to_code or enum_cmp_events first.  When one of these calls is
00564         // done we allocate the event so it should always be there.
00565 
00566         SUBDBG("EXIT: PAPI_ENOEVNT\n");
00567         return PAPI_ENOEVNT;
00568     }
00569 
00570     // always use pmu name and event name for uncore events
00571     char *ename = event_table->native_events[eidx].pmu_plus_name;
00572 
00573     // if it will not fit, return error
00574     if (strlen (ename) >= (unsigned)len) {
00575         SUBDBG("EXIT: event name %s will not fit in buffer provided\n", ename);
00576         return PAPI_EBUF;
00577     }
00578     strcpy (ntv_name, ename);
00579 
00580     // if this event had masks, also add their names
00581     char *mname = event_table->native_events[eidx].mask_string;
00582     if ((mname != NULL)  &&  (strlen(mname) > 0)) {
00583         if ((strlen(ename) + 8 + strlen(mname)) >= (unsigned)len) {
00584             SUBDBG("EXIT: Not enough room for event and mask descriptions: need: %u, have: %u", (unsigned)(strlen(ename) + 8 + strlen(mname)), (unsigned)len);
00585             return PAPI_EBUF;
00586         }
00587         strcat (ntv_name, ":");
00588         strcat (ntv_name, mname);
00589     }
00590 
00591     SUBDBG("EXIT: event name: %s\n", ntv_name);
00592     return PAPI_OK;
00593 }

Here is the call graph for this function:

Here is the caller graph for this function:

int _peu_libpfm4_ntv_enum_events ( unsigned int *  EventCode,
int  modifier,
struct native_event_table_t event_table 
)

Definition at line 724 of file peu_libpfm4_events.c.

00726                                                              {
00727 
00728     SUBDBG("ENTER: PapiEventCode: %p, *PapiEventCode: %#x, modifier: %d, event_table: %p\n", PapiEventCode, *PapiEventCode, modifier, event_table);
00729 
00730     int code,ret, pnum;
00731     int max_umasks;
00732     char event_string[BUFSIZ];
00733     pfm_pmu_info_t pinfo;
00734     pfm_event_info_t einfo;
00735     struct native_event_t *our_event;
00736 
00737     /* return first event if so specified */
00738     if ( modifier == PAPI_ENUM_FIRST ) {
00739         attr_idx = 0;   // set so if they want attribute information, it will start with the first attribute
00740         code=get_first_event_next_pmu(-1, event_table->pmu_type);
00741        if (code < 0 ) {
00742            SUBDBG("EXIT: Invalid component first event code: %d\n", code);
00743           return code;
00744        }
00745 
00746         // get the event information from libpfm4 (must zero structure)
00747         memset( &einfo, 0, sizeof( pfm_event_info_t ));
00748         einfo.size = sizeof(pfm_event_info_t);
00749         if ((ret = pfm_get_event_info(code, PFM_OS_PERF_EVENT_EXT, &einfo)) != PFM_SUCCESS) {
00750             SUBDBG("EXIT: pfm_get_event_info returned: %d\n", ret);
00751             return PAPI_ENOIMPL;
00752         }
00753 
00754         // get the pmu information from libpfm4 (must zero structure)
00755         memset( &pinfo, 0, sizeof(pfm_pmu_info_t) );
00756         pinfo.size = sizeof(pfm_pmu_info_t);
00757         ret=pfm_get_pmu_info(einfo.pmu, &pinfo);
00758         if (ret!=PFM_SUCCESS) {
00759             SUBDBG("EXIT: pfm_get_pmu_info returned: %d\n", ret);
00760             return ret;
00761         }
00762 
00763         // build full event name
00764         sprintf (event_string, "%s::%s", pinfo.name, einfo.name);
00765         SUBDBG("code: %#x, pmu: %s, event: %s, event_string: %s\n", code, pinfo.name, einfo.name, event_string);
00766 
00767         // go allocate this event, need to create tables used by the get event info call that will probably follow
00768         if ((our_event = allocate_native_event(event_string, code, event_table)) == NULL) {
00769             // allocate may have created the event table but returned NULL to tell the caller the event string was invalid (attempt to encode it failed).
00770             // if the caller wants to use this event to count something, it will report an error
00771             // but if the caller is just interested in listing the event, then we need an event table with an event name and libpfm4 index
00772             int evt_idx;
00773             if ((evt_idx = find_existing_event(event_string, event_table)) < 0) {
00774                 SUBDBG("EXIT: Allocating event: '%s' failed\n", event_string);
00775                 return PAPI_ENOEVNT;
00776             }
00777 
00778             // give back the new event code
00779             *PapiEventCode = event_table->native_events[evt_idx].libpfm4_idx;
00780             SUBDBG("EXIT: event code: %#x\n", *PapiEventCode);
00781             return PAPI_OK;
00782         }
00783 
00784         *PapiEventCode = our_event->libpfm4_idx;
00785 
00786         SUBDBG("EXIT: *PapiEventCode: %#x\n", *PapiEventCode);
00787         return PAPI_OK;
00788     }
00789 
00790     /* Handle looking for the next event */
00791     if ( modifier == PAPI_ENUM_EVENTS ) {
00792         attr_idx = 0;   // set so if they want attribute information, it will start with the first attribute
00793 
00794         // get the next event code from libpfm4, if there are no more in this pmu find first event in next pmu
00795         if ((code = pfm_get_event_next(*PapiEventCode)) < 0) {
00796 
00797             // get this events information from libpfm4, we need the pmu number of the last event we processed (table must be cleared)
00798             memset( &einfo, 0, sizeof( pfm_event_info_t ));
00799             einfo.size = sizeof(pfm_event_info_t);
00800             if ((ret = pfm_get_event_info(*PapiEventCode, PFM_OS_PERF_EVENT_EXT, &einfo)) != PFM_SUCCESS) {
00801                 SUBDBG("EXIT: pfm_get_event_info returned: %d\n", ret);
00802                 return PAPI_ENOIMPL;
00803             }
00804             SUBDBG("*PapiEventCode: %#x, event: %s\n", *PapiEventCode, einfo.name);
00805 
00806             // get the pmu number of the last event
00807             pnum = einfo.pmu;
00808 
00809             while ( pnum<PFM_PMU_MAX) {
00810                 SUBDBG("pnum: %d\n", pnum);
00811                 code=get_first_event_next_pmu(pnum, event_table->pmu_type);
00812                 if (code < 0) {
00813                     SUBDBG("EXIT: No more pmu's to list, returning: %d\n", code);
00814                     return code;
00815                 }
00816                 break;
00817             }
00818         }
00819 
00820 
00821         // get the event information from libpfm4 (must zero structure)
00822         memset( &einfo, 0, sizeof( pfm_event_info_t ));
00823         einfo.size = sizeof(pfm_event_info_t);
00824         if ((ret = pfm_get_event_info(code, PFM_OS_PERF_EVENT_EXT, &einfo)) != PFM_SUCCESS) {
00825             SUBDBG("EXIT: pfm_get_event_info returned: %d\n", ret);
00826             return PAPI_ENOIMPL;
00827         }
00828 
00829         // get the pmu information from libpfm4 (must zero structure)
00830         memset( &pinfo, 0, sizeof(pfm_pmu_info_t) );
00831         pinfo.size = sizeof(pfm_pmu_info_t);
00832         ret=pfm_get_pmu_info(einfo.pmu, &pinfo);
00833         if (ret!=PFM_SUCCESS) {
00834             SUBDBG("EXIT: pfm_get_pmu_info returned: %d\n", ret);
00835             return ret;
00836         }
00837 
00838         // build full event name
00839         sprintf (event_string, "%s::%s", pinfo.name, einfo.name);
00840         SUBDBG("code: %#x, pmu: %s, event: %s, event_string: %s\n", code, pinfo.name, einfo.name, event_string);
00841 
00842         // go allocate this event, need to create tables used by the get event info call that will follow
00843         if ((our_event = allocate_native_event(event_string, code, event_table)) == NULL) {
00844             // allocate may have created the event table but returned NULL to tell the caller the event string was invalid (attempt to encode it failed).
00845             // if the caller wants to use this event to count something, it will report an error
00846             // but if the caller is just interested in listing the event, then we need an event table with an event name and libpfm4 index
00847             int evt_idx;
00848             if ((evt_idx = find_existing_event(event_string, event_table)) < 0) {
00849                 SUBDBG("EXIT: Allocating event: '%s' failed\n", event_string);
00850                 return PAPI_ENOEVNT;
00851             }
00852 
00853             // give back the new event code
00854             *PapiEventCode = event_table->native_events[evt_idx].libpfm4_idx;
00855             SUBDBG("EXIT: event code: %#x\n", *PapiEventCode);
00856             return PAPI_OK;
00857         }
00858 
00859         // give back the new event code
00860         *PapiEventCode = our_event->libpfm4_idx;
00861 
00862         SUBDBG("EXIT: *PapiEventCode: %#x\n", *PapiEventCode);
00863         return PAPI_OK;
00864     }
00865 
00866     /* We don't handle PAPI_NTV_ENUM_UMASK_COMBOS */
00867     if ( modifier == PAPI_NTV_ENUM_UMASK_COMBOS ) {
00868         SUBDBG("EXIT: do not support umask combos yet\n");
00869         return PAPI_ENOIMPL;
00870     } 
00871 
00872     /* Enumerate PAPI_NTV_ENUM_UMASKS (umasks on an event) */
00873     if ( modifier == PAPI_NTV_ENUM_UMASKS ) {
00874         // get this events information from libpfm4, we need the number of masks this event knows about (table must be cleared)
00875         memset( &einfo, 0, sizeof( pfm_event_info_t ));
00876         einfo.size = sizeof(pfm_event_info_t);
00877         if ((ret = pfm_get_event_info(*PapiEventCode, PFM_OS_PERF_EVENT_EXT, &einfo)) != PFM_SUCCESS) {
00878             SUBDBG("EXIT: pfm_get_event_info returned: %d\n", ret);
00879             return PAPI_ENOIMPL;
00880         }
00881 //      SUBDBG("*PapiEventCode: %#x, einfo.name: %s, einfo.code: %#x, einfo.nattrs: %d\n", *PapiEventCode, einfo.name, einfo.code, einfo.nattrs);
00882 
00883         // set max number of masks
00884         max_umasks = einfo.nattrs;
00885 
00886         // if we reached last attribute, return error to show we are done with this events masks
00887         if (attr_idx == max_umasks) {
00888             SUBDBG("EXIT: already processed all umasks: attr_idx: %d\n", attr_idx);
00889             return PAPI_ENOEVNT;
00890         }
00891 
00892         // find the event table for this event, we need the pmu name and event name without any masks
00893         int ntv_idx = _papi_hwi_get_ntv_idx(_papi_hwi_get_papi_event_code());
00894         if (ntv_idx < 0) {
00895             SUBDBG("EXIT: _papi_hwi_get_ntv_idx returned: %d\n", ntv_idx);
00896             return ntv_idx;
00897         }
00898         char *ename = event_table->native_events[ntv_idx].pmu_plus_name;
00899         if ((ename == NULL)  ||  (strlen(ename) >= sizeof(event_string))) {
00900             SUBDBG("EXIT: Event name will not fit into buffer\n");
00901             return PAPI_EBUF;
00902         }
00903         strcpy (event_string, ename);
00904         SUBDBG("event_string: %s\n", event_string);
00905 
00906         // go get the attribute information for this event
00907         // libpfm4 likes the table cleared
00908         pfm_event_attr_info_t ainfo;
00909         memset (&ainfo, 0, sizeof(pfm_event_attr_info_t));
00910         ainfo.size = sizeof(pfm_event_attr_info_t);
00911         ret = pfm_get_event_attr_info(*PapiEventCode, attr_idx, PFM_OS_PERF_EVENT_EXT, &ainfo);
00912         if (ret != PFM_SUCCESS) {
00913             SUBDBG("EXIT: Attribute info not found, EventCode: %#x, attr_idx: %d, ret: %d\n", *PapiEventCode, attr_idx, _papi_libpfm4_error(ret));
00914             return _papi_libpfm4_error(ret);
00915         }
00916         SUBDBG("*PapiEventCode: %#x, attr_idx: %d, type: %d, name: %s, description: %s\n", *PapiEventCode, attr_idx, ainfo.type, ainfo.name, ainfo.desc);
00917 
00918         if (strlen(event_string) + strlen(ainfo.name) + 35 > sizeof(event_string)) {
00919             SUBDBG("EXIT: Event name and mask will not fit into buffer\n");
00920             return PAPI_EBUF;
00921         }
00922 
00923         strcat (event_string, ":");
00924         strcat (event_string, ainfo.name);
00925         switch (ainfo.type) {
00926             case PFM_ATTR_UMASK:
00927                 break;
00928             case PFM_ATTR_MOD_BOOL:
00929             case PFM_ATTR_MOD_INTEGER:
00930                 // a few attributes require a non-zero value to encode correctly (most would accept zero here)
00931                 strcat(event_string,"=0");
00932                 break;
00933             default:
00934                 SUBDBG("EXIT: Unsupported attribute type: %d", ainfo.type);
00935                 return PAPI_EATTR;
00936         }
00937 
00938         // go allocate this event, need to create tables used by the get event info call that will follow
00939         if ((our_event = allocate_native_event(event_string, *PapiEventCode, event_table)) == NULL) {
00940             // allocate may have created the event table but returned NULL to tell the caller the event string was invalid.
00941             // if the caller wants to use this event to count something, it must report the error
00942             // but if the caller is just interested in listing the event (like this code), then find the table that was created and return its libpfm4 index
00943             int evt_idx;
00944             if ((evt_idx = find_existing_event(event_string, event_table)) < 0) {
00945                 SUBDBG("EXIT: Allocating event: '%s' failed\n", event_string);
00946                 return PAPI_ENOEVNT;
00947             }
00948             // bump so next time we will use next attribute
00949             attr_idx++;
00950             // give back the new event code
00951             *PapiEventCode = event_table->native_events[evt_idx].libpfm4_idx;
00952             SUBDBG("EXIT: event code: %#x\n", *PapiEventCode);
00953             return PAPI_OK;
00954         }
00955 
00956         // bump so next time we will use next attribute
00957         attr_idx++;
00958 
00959         // give back the new event code
00960         *PapiEventCode = our_event->libpfm4_idx;
00961 
00962         SUBDBG("EXIT: event code: %#x\n", *PapiEventCode);
00963         return PAPI_OK;
00964     }
00965 
00966     /* Enumerate PAPI_NTV_ENUM_GROUPS (groups on an event) */
00967     if ( modifier == PAPI_NTV_ENUM_GROUPS ) {
00968         SUBDBG("EXIT: do not support enumerating groups in this component\n");
00969         return PAPI_ENOIMPL;
00970     }
00971 
00972     /* An unknown enumeration method was indicated */
00973 
00974     SUBDBG("EXIT: Invalid modifier argument provided\n");
00975     return PAPI_ENOIMPL;
00976 }

Here is the call graph for this function:

Here is the caller graph for this function:

int _peu_libpfm4_ntv_name_to_code ( char *  ntv_name,
unsigned int *  EventCode,
struct native_event_table_t event_table 
)

Definition at line 483 of file peu_libpfm4_events.c.

00485 {
00486   SUBDBG( "ENTER: name: %s, event_code: %p, *event_code: %#x, event_table: %p\n", name, event_code, *event_code, event_table);
00487 
00488   struct native_event_t *our_event;
00489   int event_num;
00490 
00491   // if we already know this event name, just return its native code
00492   event_num=find_existing_event(name, event_table);
00493   if (event_num >= 0) {
00494          *event_code=event_table->native_events[event_num].libpfm4_idx;
00495          // the following call needs to happen to prevent the internal layer from creating a new papi native event table
00496          _papi_hwi_set_papi_event_code(event_table->native_events[event_num].papi_event_code, 1);
00497          SUBDBG("EXIT: Found papi_event_code: %#x, libpfm4_idx: %#x\n", event_table->native_events[event_num].papi_event_code, event_table->native_events[event_num].libpfm4_idx);
00498          return PAPI_OK;
00499   }
00500 
00501      // Try to allocate this event to see if it is known by libpfm4, if allocate fails tell the caller it is not valid
00502      our_event=allocate_native_event(name, -1, event_table);
00503      if (our_event==NULL) {
00504          SUBDBG("EXIT: Allocating event: '%s' failed\n", name);
00505          return PAPI_ENOEVNT;
00506      }
00507 
00508      *event_code = our_event->libpfm4_idx;
00509      SUBDBG("EXIT: Found code: %#x\n",*event_code);
00510      return PAPI_OK;
00511 }

Here is the call graph for this function:

Here is the caller graph for this function:

int _peu_libpfm4_setup_presets ( char *  name,
int  type,
int  cidx 
)
int _peu_libpfm4_shutdown ( papi_vector_t my_vector,
struct native_event_table_t event_table 
)

Definition at line 990 of file peu_libpfm4_events.c.

00991                                                   {
00992   SUBDBG("ENTER: event_table: %p\n", event_table);
00993 
00994   int i;
00995 
00996   for (i=0 ; i<PAPI_PMU_MAX ; i++) {
00997       if (my_vector->cmp_info.pmu_names[i] != NULL) {
00998           free (my_vector->cmp_info.pmu_names[i]);
00999       }
01000   }
01001 
01002   /* clean out and free the native events structure */
01003   _papi_hwi_lock( NAMELIB_LOCK );
01004 
01005   /* free memory allocated with strdup or malloc */
01006   for( i=0; i<event_table->num_native_events; i++) {
01007      free(event_table->native_events[i].base_name);
01008      free(event_table->native_events[i].pmu_plus_name);
01009      free(event_table->native_events[i].pmu);
01010      free(event_table->native_events[i].allocated_name);
01011      free(event_table->native_events[i].mask_string);
01012      free(event_table->native_events[i].event_description);
01013      if (event_table->native_events[i].mask_description != NULL) {
01014           free(event_table->native_events[i].mask_description);
01015      }
01016   }
01017 
01018   free(event_table->native_events);
01019 
01020   _papi_hwi_unlock( NAMELIB_LOCK );
01021 
01022   SUBDBG("EXIT: PAPI_OK\n");
01023   return PAPI_OK;
01024 }

Here is the call graph for this function:

Here is the caller graph for this function:


Generated on 8 Sep 2016 for PAPI by  doxygen 1.6.1