LIBPFM - Online Linux Manual PageSection : 3
Updated : August, 2006
Source :
Note : Linux Programmer's Manual
NAMEpfm_get_event_name, pfm_get_full_event_name, pfm_get_event_mask_name, pfm_get_event_code, pfm_get_event_mask_code, pfm_get_event_counters, pfm_get_num_events, pfm_get_max_event_name_len, pfm_get_event_description, pfm_get_event_mask_description − get event information
SYNOPSIS#include <perfmon/pfmlib.h>
int pfm_get_event_name(unsigned int e, char *name, size_t maxlen);
int pfm_get_full_event_name(pfmlib_event_t *ev, char *name, size_t maxlen);
int pfm_get_event_mask_name(unsigned int e, unsigned int mask, char *name, size_t maxlen);
int pfm_get_event_code(unsigned int e, int *code);
int pfm_get_event_mask_code(unsigned int e, unsigned int mask, int *code);
int pfm_get_event_code_counter(unsigned int e, unsigned int cnt, int *code);
int pfm_get_event_counters(int e, pfmlib_regmask_t counters);
int pfm_get_num_events(unsigned int *count);
int pfm_get_max_event_name_len(size_t *len);
int pfm_get_event_description(unsigned int ev, char **str);
int pfm_get_event_mask_description(unsigned int ev, unsigned int mask, char **str);
DESCRIPTION
The pfm_get_event_name() function returns in name the event name given its opaque descriptor in e. The maxlen argument indicates the maximum length of the buffer provided for name. Up to maxlen-1 characters are stored in the buffer. The buffer size must be large enough to store the event name, otherwise an error is returned. This behavior is required to avoid returning partial names with no way for the caller to verify this is not the full name, except by failing other calls. The buffer can be appropriately sized using the pfm_get_max_event_name_len() function. The returned name is a null terminated string with all upper-case characters and no spaces. The pfm_get_full_event_name() function returns in name the event name given the full event description in ev. The description contains the event code in ev->event and optional unit masks descriptors in ev->unit_masks. The maxlen argument indicates the maximum length of the buffer provided for name. If more than maxlen-1 characters are needed to represent the event, an error is returned. Applications may use the pfm_get_max_event_name_len() function to size the buffer correctly. In case unit masks are provided, the final event name string is structured as: event_name:unit_masks1[:unit_masks2]. Event names and unit masks names are returned in all upper case. The pfm_get_event_code() function returns the event code in code given its opaque descriptor e. On some PMU models, the code associated with an event is different based on the counter it is programmed into. The pfm_get_event_code_counter() function is used to retrieve the event code in code when the event e is programmed into counter cnt. The counter index cnt must correspond to of a counting PMD register. Given an opaque event descriptor e, the pfm_get_event_counters() function returns in counters a bitmask of type pfmlib_regmask_t where each bit set represents a PMU config register which can be used to program this event. The bitmask must be accessed using accessor macros defined by the library. .so The pfm_get_num_events() function returns in count the total number of events available for the PMU model. On some PMU models, however, not all events in the table may be useable due to processor stepping changes. However, The library guarantees that no more that count events are available. It is possible to list all existing events for the detected host PMU using accessor functions as the full table of events is not accessible to the applications. The index of the first event is always zero, then using the pfm_get_num_events() function you get the total number of events. On some PMU models, e.g., AMD64, not all events are necessarily supported by the host PMU, therefore the count returned by this calls may not be the actual number of available events. Event descriptors are contiguous therefore a simple loop will allow complete scanning. The typical scan loop is constructed as follows: unsigned int i, count;
char name[256];
int ret;
pfm_get_num_events(&count);
for(i=0;i < count; i++)
{
ret = pfm_get_event_name(i, name, 256);
if (ret != PFMLIB_SUCCESS)
continue;
printf("%s\n", name);
}The pfm_get_max_event_name_len() function returns in len the maximum length in bytes for the name of the events or its unit masks, if any, available on one PMU implementation. The value excludes the string termination character (' '). The pfm_get_event_description() function returns in str the description string associated with the event specified in ev. The description is returned into a buffer that is allocated to hold the entire description text. It is the responsibility of the caller to free the buffer when it becomes useless by calling the free(3) function. The pfm_get_event_mask_code() function must be used to retrieve the actual unit mask value given a event descriptor in e and a unit mask descriptor in mask. The value is returned in code. The pfm_get_event_mask_name() function must be used to retrieve the name associated with a unit mask specified in mask for event e. The name is returned in the buffer specified in name. The maximum size of the buffer must be specified in maxlen. The pfm_get_event_mask_description() function returns in str the description string associated with the unit mask specified in mask for the event specified in ev. The description is returned into a buffer that is allocated to hold the entire description text. It is the responsibility of the caller to free the buffer when it becomes useless by calling the free(3) function.
RETURNAll functions return whether or not the call was successful. A return value of PFMLIB_SUCCESS indicates success, otherwise the value is the error code.
ERRORSPFMLIB_ERR_NOINIT the library has not been initialized properly. PFMLIB_ERR_FULL the string buffer provided is too small PFMLIB_ERR_INVAL the event or unit mask descriptor, or the cnt argument is invalid, or a pointer argument is NULL.
SEE ALSOpfm_get_impl_counters(3), pfm_get_max_event_name_len(3), free(3)
AUTHORStephane Eranian <eranian@gmail.com> 0
Johanes Gumabo
Data Size : 17,393 byte
man-pfm_get_max_event_name_len.3Build : 2024-12-05, 20:55 :
Visitor Screen : x
Visitor Counter ( page / site ) : 2 / 202,627
Visitor ID : :
Visitor IP : 18.189.192.214 :
Visitor Provider : AMAZON-02 :
Provider Position ( lat x lon ) : 39.962500 x -83.006100 : x
Provider Accuracy Radius ( km ) : 1000 :
Provider City : Columbus :
Provider Province : Ohio , : ,
Provider Country : United States :
Provider Continent : North America :
Visitor Recorder : Version :
Visitor Recorder : Library :
Online Linux Manual Page : Version : Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page : Library : lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page : Library : lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base : Version : Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base : Library : lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36
Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.
ERROR : Need New Coding : (rof_so|3|pfm_get_event_name.3|58|1|.so
) (rof_nr_x|149|pfm_get_event_name.3|85|\n", name);| printf("%s\\n", name);
)