PAPI3:PAPI set event info.3
From PAPIDocs
Jump to: navigation, search


  • PAPI_set_event_info - set an event's name, description and definition info


C Interface

#include <papi.h>
int PAPI_set_event_info(PAPI_event_info_t *info, int *EventCode, int replace);


NOTE: This API has been deprecated in PAPI 3.5 pending a data structure redesign. This function modifies or adds an event to the PAPI preset event table based on the contents of an even info structure. This function presently works only to define or modify PAPI preset events.


The following arguments are explicitly passed, or are implicit in the info structure.

EventCode -- event code returned by the function on success

replace -- 1 to replace an existing event, or 0 to prevent accidental replacement

info -- structure containing the event information. Relevant fields in this structure are discussed below.

event_code -- although the value of this event code is not used, the PAPI_PRESET_MASK bit must be set to indicate that the following event description is for a preset event.

symbol -- name of the preset event. If the event name is found in the table and replace is non-zero, the event definition will be replaced. If the names do not match a new entry will be created.

derived -- a string value indicating whether and how native event terms are combined to form a preset event. Possible values include: NOT_DERIVED: Do nothing; only one native event, DERIVED_ADD: Add all native events, DERIVED_CMPD: Event lives in first counter but takes 2 or more native codes, DERIVED_SUB: Subtract all events from the first event specified, DERIVED_POSTFIX: Process events based on specified postfix string,

postfix -- a string value containing postfix operations used only for DERIVED_POSTFIX events.

short_descr -- short description of the event

long_descr -- detailed description of the event

event_note -- special information or notes about the event

name -- an array of up to 8 names of native events that make up this preset event.


PAPI_EPERM You are trying to modify an existing event without specifying replace.

PAPI_EISRUN You are trying to modify an event that has been added to an EventSet.

PAPI_EINVAL One or more of the arguments or fields of the info structure is invalid.

PAPI_ENOTPRESET The PAPI preset table is full and there is no room for a new event.

PAPI_ENOEVNT The event specified is not a PAPI preset. Usually because the PAPI_PRESET_MASK bit is not set.


This function has no known bugs.


 /*Add a note to a custom definition of PAPI_TOT_INS */
if (PAPI_get_event_info(EventCode, &info) != PAPI_OK)
strcpy(info.symbol, "MY_TOT_INS");
strcpy(info.note, "This note describes my version of total instructions.");
if (PAPI_set_event_info(&info, EventCode, 0) != PAPI_OK)

See Also

PAPI_event_name_to_code(3), PAPI_get_event_info(3), PAPIF(3), PAPI(3)