PAPI 7.1.0.0
Loading...
Searching...
No Matches
linux-sensors-ppc.h
Go to the documentation of this file.
1/****************************/
2/* THIS IS OPEN SOURCE CODE */
3/****************************/
19#ifndef _sensors_ppc_H
20#define _sensors_ppc_H
21
22/* Headers required by PAPI */
23#include "papi.h"
24#include "papi_internal.h"
25#include "papi_vector.h"
26#include "papi_memory.h"
27
28#define papi_sensors_ppc_lock() _papi_hwi_lock(COMPONENT_LOCK);
29#define papi_sensors_ppc_unlock() _papi_hwi_unlock(COMPONENT_LOCK);
30
31typedef struct _sensors_ppc_register {
32 unsigned int selector;
34
35typedef struct _sensors_ppc_native_event_entry {
38 char description[PAPI_MAX_STR_LEN];
42 int type;
46
47typedef struct _sensors_ppc_reg_alloc {
50
51static int num_events=0;
52
53typedef enum occ_sensor_type_e {
64
65typedef enum occ_sensor_loc_e {
76
77#define OCC_SENSOR_READING_FULL 0x01
78#define OCC_SENSOR_READING_COUNTER 0x02
79
80static char *pkg_sys_name = "occ_inband_sensors";
81static mode_t pkg_sys_flag = O_RDONLY;
82
83/* 8 OCCs, starting at OCC_SENSOR_DATA_BLOCK_OFFSET
84 * OCC0: 0x00580000 -> 0x005A57FF
85 * OCC1: 0x005A5800 -> 0x005CAFFF
86 * Each zone is 150kB (OCC_SENSOR_DATA_BLOCK_SIZE)
87 * OCC7: 0x00686800 -> 0x006ABFFF*/
88
89#define MAX_OCCS 8
90#define OCC_SENSOR_DATA_BLOCK_OFFSET 0x00580000
91#define OCC_SENSOR_DATA_BLOCK_SIZE 0x00025800
92#define OCC_PING_DATA_BLOCK_SIZE 0xA000
93#define OCC_REFRESH_TIME 100000
94
95/* In the 150kB, map the beginning to */
97 uint8_t valid; /* 0x01 means the block can be read */
98 uint8_t version;
99 uint16_t nr_sensors; /* number of sensors! */
100 uint8_t reading_version; /* ping pong version */
101 uint8_t pad[3];
102 uint32_t names_offset;
104 uint8_t name_length;
105 uint16_t reserved;
108} __attribute__((__packed__)) occ_sensor_data_header_t;
109/* That header is reset after each reboot */
110
112static int event_fd;
113static long long last_refresh[MAX_OCCS];
114static int num_occs;
116static uint32_t *ping[MAX_OCCS], *pong[MAX_OCCS];
118
119#define MAX_CHARS_SENSOR_NAME 16
120#define MAX_CHARS_SENSOR_UNIT 4
121
122/* After 1kB, the list of sensor names, units */
123/* map an array of size header->nr_sensors */
124/* the following struct, */
125typedef struct occ_sensor_name_s {
128 uint16_t gsid;
129 uint32_t freq;
130 uint32_t scale_factor;
131 uint16_t type;
132 uint16_t location;
133 uint8_t structure_type; /* determine size+format of sensor */
135 uint8_t sensor_data;
136 uint8_t pad[8];
137} __attribute__((__packed__)) occ_sensor_name_t;
138
140
141/* The following 4kB, size of a page, has to be skipped */
142
143/* Following 40kB is the ping buffer */
144/* Followed by another 4kB of skippable memory */
145/* Finally, 40kB for the pong buffer */
146
147typedef struct occ_sensor_record_s {
148 uint16_t gsid;
149 uint64_t timestamp;
150 uint16_t sample; /* latest value */
151 uint16_t sample_min; /*min max since reboot */
152 uint16_t sample_max;
153 uint16_t csm_min;/* since CSM reset */
154 uint16_t csm_max;
155 uint16_t profiler_min; /* since prof reset */
156 uint16_t profiler_max;
157 uint16_t job_scheduler_min; /* since job sched reset */
159 uint64_t accumulator; /* accu if it makes sense */
160 uint32_t update_tag; /* tics since between that value and previous one */
161 uint8_t pad[8];
162} __attribute__((__packed__)) occ_sensor_record_t;
163
164typedef struct occ_sensor_counter_s {
165 uint16_t gsid;
166 uint64_t timestamp;
167 uint64_t accumulator;
168 uint8_t sample;
169 uint8_t pad[5];
170} __attribute__((__packed__)) occ_sensor_counter_t;
171
172typedef enum occ_sensors_mask_e {
185
186static const char* sensors_ppc_fake_qualifiers[] = {"", ":min", ":max", ":csm_min",
187 ":csm_max", ":profiler_min", ":profiler_max", ":job_scheduler_min", ":job_scheduler_max", ":accumulator", NULL};
188static const char *sensors_ppc_fake_qualif_desc[] = {
189 "Last sample of this sensor",
190 "Minimum value since last OCC reset (node reboot)",
191 "Maximum value since last OCC reset (node reboot)",
192 "Minimum value since last reset request by CSM",
193 "Maximum value since last reset request by CSM",
194 "Minimum value since last reset request by profiler",
195 "Maximum value since last reset request by profiler",
196 "Minimum value since last reset by job scheduler",
197 "Maximum value since last reset by job scheduler",
198 "Accumulator register for this sensor", NULL};
199
200#define SENSORS_PPC_MAX_COUNTERS MAX_OCCS * 512 * OCC_SENSORS_MASKS
201
202typedef struct _sensors_ppc_control_state {
204 long long which_counter[SENSORS_PPC_MAX_COUNTERS];
205 long long need_difference[SENSORS_PPC_MAX_COUNTERS];
206 uint32_t occ, scale;
208
209typedef struct _sensors_ppc_context {
210 long long start_value[SENSORS_PPC_MAX_COUNTERS];
213
214#endif /* _sensors_ppc_H */
static long count
#define PAPI_MIN_STR_LEN
Definition: f90papi.h:208
#define PAPI_MAX_STR_LEN
Definition: f90papi.h:77
static char * pkg_sys_name
#define MAX_OCCS
static const char * sensors_ppc_fake_qualifiers[]
static int num_events
static mode_t pkg_sys_flag
static long long last_refresh[MAX_OCCS]
struct occ_sensor_data_header_s * occ_hdr[MAX_OCCS]
static int num_occs
#define MAX_CHARS_SENSOR_UNIT
occ_sensor_type_t
@ OCC_SENSOR_TYPE_GENERIC
@ OCC_SENSOR_TYPE_TIME
@ OCC_SENSOR_TYPE_VOLTAGE
@ OCC_SENSOR_TYPE_FREQUENCY
@ OCC_SENSOR_TYPE_UTILIZATION
@ OCC_SENSOR_TYPE_TEMPERATURE
@ OCC_SENSOR_TYPE_CURRENT
@ OCC_SENSOR_TYPE_POWER
@ OCC_SENSOR_TYPE_PERFORMANCE
occ_sensor_loc_t
@ OCC_SENSOR_LOC_OCC
@ OCC_SENSOR_LOC_PARTITION
@ OCC_SENSOR_LOC_SYSTEM
@ OCC_SENSOR_LOC_GPU
@ OCC_SENSOR_LOC_CORE
@ OCC_SENSOR_LOC_QUAD
@ OCC_SENSOR_LOC_PROCESSOR
@ OCC_SENSOR_LOC_VRM
@ OCC_SENSOR_LOC_MEMORY
#define MAX_CHARS_SENSOR_NAME
static uint32_t * double_pong[MAX_OCCS]
#define SENSORS_PPC_MAX_COUNTERS
occ_sensors_mask_t
@ OCC_SENSORS_PROFILER_MAX
@ OCC_SENSORS_JOB_SCHED_MIN
@ OCC_SENSORS_SAMPLE
@ OCC_SENSORS_MASKS
@ OCC_SENSORS_PROFILER_MIN
@ OCC_SENSORS_CSM_MAX
@ OCC_SENSORS_JOB_SCHED_MAX
@ OCC_SENSORS_SAMPLE_MIN
@ OCC_SENSORS_SAMPLE_MAX
@ OCC_SENSORS_ACCUMULATOR_TAG
@ OCC_SENSORS_CSM_MIN
static const char * sensors_ppc_fake_qualif_desc[]
static int occ_num_events[MAX_OCCS+1]
static int event_fd
struct occ_sensor_name_s * occ_names[MAX_OCCS]
static uint32_t * pong[MAX_OCCS]
static uint32_t * ping[MAX_OCCS]
static uint32_t * double_ping[MAX_OCCS]
unsigned long AO_t __attribute__((__aligned__(4)))
Definition: m68k.h:21
Return codes and api definitions.
char units[MAX_EVENTS][BUFSIZ]
Definition: powercap_plot.c:15
const char * name
Definition: rocs.c:225
_sensors_ppc_control_state_t state
int type
int return_type
_sensors_ppc_register_t resources
int component_id
int event_id
int socket_id
_sensors_ppc_register_t ra_bits
char name[MAX_CHARS_SENSOR_NAME]
char units[MAX_CHARS_SENSOR_UNIT]