Blame src/components/coretemp/linux-coretemp.h

Packit 577717
/****************************/
Packit 577717
/* THIS IS OPEN SOURCE CODE */
Packit 577717
/****************************/
Packit 577717
Packit 577717
/** 
Packit 577717
 * @file    linux-coretemp.h
Packit 577717
 * CVS:     $Id$
Packit 577717
 * @author  James Ralph
Packit 577717
 *			ralph@eecs.utk.edu
Packit 577717
 *
Packit 577717
 * @ingroup papi_components
Packit 577717
 *
Packit 577717
 * @brief coretemp component
Packit 577717
 *  This file has the source code for a component that enables PAPI-C to access
Packit 577717
 *  hardware monitoring sensors through the coretemp 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_CORETEMP_H
Packit 577717
#define _PAPI_CORETEMP_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 CORETEMP_MAX_COUNTERS 512
Packit 577717
Packit 577717
/** Structure that stores private information of each event */
Packit 577717
typedef struct CORETEMP_register
Packit 577717
{
Packit 577717
	/* This is used by the framework.It likes it to be !=0 to do somehting */
Packit 577717
	unsigned int selector;
Packit 577717
	/* These are the only information needed to locate a libsensors event */
Packit 577717
	int subfeat_nr;
Packit 577717
} CORETEMP_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 CORETEMP_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
  char path[PATH_MAX];
Packit 577717
  int stone; /* some counters are set in stone, a max temperature is just that... */
Packit 577717
  long value;
Packit 577717
  CORETEMP_register_t resources;
Packit 577717
} CORETEMP_native_event_entry_t;
Packit 577717
Packit 577717
typedef struct CORETEMP_reg_alloc
Packit 577717
{
Packit 577717
	CORETEMP_register_t ra_bits;
Packit 577717
} CORETEMP_reg_alloc_t;
Packit 577717
Packit 577717
Packit 577717
typedef struct CORETEMP_control_state
Packit 577717
{
Packit 577717
	long long counts[CORETEMP_MAX_COUNTERS];	// used for caching
Packit 577717
	long long lastupdate;
Packit 577717
} CORETEMP_control_state_t;
Packit 577717
Packit 577717
Packit 577717
typedef struct CORETEMP_context
Packit 577717
{
Packit 577717
	CORETEMP_control_state_t state;
Packit 577717
} CORETEMP_context_t;
Packit 577717
Packit 577717
Packit 577717
Packit 577717
/*************************  GLOBALS SECTION  ***********************************
Packit 577717
 *******************************************************************************/
Packit 577717
Packit 577717
Packit 577717
#endif /* _PAPI_CORETEMP_H */