|
Packit |
577717 |
/****************************/
|
|
Packit |
577717 |
/* THIS IS OPEN SOURCE CODE */
|
|
Packit |
577717 |
/****************************/
|
|
Packit |
577717 |
|
|
Packit |
577717 |
/**
|
|
Packit |
577717 |
* @file linux-micpower.h
|
|
Packit |
577717 |
* @author James Ralph
|
|
Packit |
577717 |
* ralph@eecs.utk.edu
|
|
Packit |
577717 |
*
|
|
Packit |
577717 |
* @ingroup papi_components
|
|
Packit |
577717 |
*
|
|
Packit |
577717 |
* @brief Mic power component
|
|
Packit |
577717 |
* This file has the source code for a component that enables PAPI-C to access
|
|
Packit |
577717 |
* hardware monitoring sensors through a sysfs interface. This code
|
|
Packit |
577717 |
* will dynamically create a native events table for all the sensors that can
|
|
Packit |
577717 |
* be found under /sys/class/hwmon/hwmon[0-9]+.
|
|
Packit |
577717 |
*
|
|
Packit |
577717 |
* Notes:
|
|
Packit |
577717 |
* - Based heavily upon the lm-sensors component by Heike Jagode.
|
|
Packit |
577717 |
*/
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#ifndef _PAPI_MICPOWER_H_
|
|
Packit |
577717 |
#define _PAPI_MICPOWER_H_
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#include <unistd.h>
|
|
Packit |
577717 |
#include <dirent.h>
|
|
Packit |
577717 |
|
|
Packit |
577717 |
|
|
Packit |
577717 |
|
|
Packit |
577717 |
/************************* DEFINES SECTION ***********************************
|
|
Packit |
577717 |
*******************************************************************************/
|
|
Packit |
577717 |
/* this number assumes that there will never be more events than indicated */
|
|
Packit |
577717 |
#define MICPOWER_MAX_COUNTERS 16
|
|
Packit |
577717 |
|
|
Packit |
577717 |
/** Structure that stores private information of each event */
|
|
Packit |
577717 |
typedef struct {
|
|
Packit |
577717 |
unsigned int selector;
|
|
Packit |
577717 |
} MICPOWER_register_t;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
/*
|
|
Packit |
577717 |
* The following structures mimic the ones used by other components. It is more
|
|
Packit |
577717 |
* convenient to use them like that as programming with PAPI makes specific
|
|
Packit |
577717 |
* assumptions for them.
|
|
Packit |
577717 |
*/
|
|
Packit |
577717 |
|
|
Packit |
577717 |
|
|
Packit |
577717 |
|
|
Packit |
577717 |
/** This structure is used to build the table of events */
|
|
Packit |
577717 |
typedef struct MICPOWER_native_event_entry
|
|
Packit |
577717 |
{
|
|
Packit |
577717 |
char name[PAPI_MAX_STR_LEN];
|
|
Packit |
577717 |
char units[PAPI_MIN_STR_LEN];
|
|
Packit |
577717 |
char description[PAPI_MAX_STR_LEN];
|
|
Packit |
577717 |
MICPOWER_register_t resources;
|
|
Packit |
577717 |
} MICPOWER_native_event_entry_t;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
typedef struct MICPOWER_reg_alloc
|
|
Packit |
577717 |
{
|
|
Packit |
577717 |
MICPOWER_register_t ra_bits;
|
|
Packit |
577717 |
} MICPOWER_reg_alloc_t;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
|
|
Packit |
577717 |
typedef struct MICPOWER_control_state
|
|
Packit |
577717 |
{
|
|
Packit |
577717 |
long long counts[MICPOWER_MAX_COUNTERS]; // used for caching
|
|
Packit |
577717 |
long long lastupdate;
|
|
Packit |
577717 |
} MICPOWER_control_state_t;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
|
|
Packit |
577717 |
typedef struct MICPOWER_context
|
|
Packit |
577717 |
{
|
|
Packit |
577717 |
MICPOWER_control_state_t state;
|
|
Packit |
577717 |
} MICPOWER_context_t;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
|
|
Packit |
577717 |
|
|
Packit |
577717 |
/************************* GLOBALS SECTION ***********************************
|
|
Packit |
577717 |
*******************************************************************************/
|
|
Packit |
577717 |
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#endif /* _PAPI_MICPOWER_H_ */
|