31#define FILE_LINE_SIZE 256
36#define IO_FILENAME "/proc/self/io"
41#define HANDLE_STRING_ERROR {fprintf(stderr,"%s:%i unexpected string function error.\n",__FILE__,__LINE__); exit(-1);}
44typedef struct IO_native_event_entry
55typedef struct _io_control_state
66typedef struct _io_context
86 if (myCtx->
pFile == NULL) {
99 if (res == NULL)
break;
111 long long tmplong = 0LL;
112 int nf = sscanf( myCtx->
line,
"%s %lld\n",
dummy, &tmplong);
145 long long tmplong = 0LL;
146 int nf = sscanf(ctx->
line,
"%s %lld\n",
dummy, &tmplong);
174 SUBDBG(
"_io_init_component..." );
179 "Failed counting events.");
213 for (fileIdx = 0; fileIdx <
gEventCount; fileIdx++) {
216 long long tmplong = 0LL;
218 (void) sscanf(myCtx.
line,
"%s %lld\n",
name, &tmplong);
223 if (strcmp(
"rchar",
name) == 0) {
226 if (strcmp(
"wchar",
name) == 0) {
229 if (strcmp(
"syscr",
name) == 0) {
230 strcpy(
io_native_table[fileIdx].desc,
"Characters read by system calls.");
232 if (strcmp(
"syscw",
name) == 0) {
233 strcpy(
io_native_table[fileIdx].desc,
"Characters written by system calls.");
235 if (strcmp(
"read_bytes",
name) == 0) {
238 if (strcmp(
"write_bytes",
name) == 0) {
241 if (strcmp(
"cancelled_write_bytes",
name) == 0) {
242 strcpy(
io_native_table[fileIdx].desc,
"Binary write bytes cancelled.");
276 if (ret !=
PAPI_OK)
return(ret);
336 SUBDBG(
"io_start %p %p...", ctx, ctl );
347 SUBDBG(
"io_stop %p %p...", ctx, ctl );
359 long long **
events,
int flags )
366 SUBDBG(
"io_read... %p %d", ctx, flags );
411 SUBDBG(
"io_shutdown_component..." );
420 SUBDBG(
"io_shutdown_thread... %p", ctx );
455 SUBDBG(
"io_set_domain..." );
458 SUBDBG(
" PAPI_DOM_USER " );
462 SUBDBG(
" PAPI_DOM_KERNEL " );
466 SUBDBG(
" PAPI_DOM_OTHER " );
470 SUBDBG(
" PAPI_DOM_ALL " );
496 switch ( modifier ) {
509 *EventCode = *EventCode + 1;
573 .description =
"A component to read /proc/self/io",
575 .support_version =
"n/a",
576 .kernel_version =
"n/a",
578 .num_mpx_cntrs = 512,
635 .ntv_name_to_code = NULL,
struct papi_vectors * _papi_hwd[]
char events[MAX_EVENTS][BUFSIZ]
static int io_hardware_read(_io_context_t *ctx, _io_control_state_t *ctl)
static int _io_read(hwd_context_t *ctx, hwd_control_state_t *ctl, long long **events, int flags)
static int _io_update_control_state(hwd_control_state_t *ctl, NativeInfo_t *native, int count, hwd_context_t *ctx)
static int _io_start(hwd_context_t *ctx, hwd_control_state_t *ctl)
static int _io_ctl(hwd_context_t *ctx, int code, _papi_int_option_t *option)
static int _io_set_domain(hwd_control_state_t *cntrl, int domain)
static int _io_shutdown_component(void)
static int _io_ntv_code_to_name(unsigned int EventCode, char *name, int len)
static int _io_stop(hwd_context_t *ctx, hwd_control_state_t *ctl)
static int _io_init_component(int cidx)
static int _io_shutdown_thread(hwd_context_t *ctx)
static int _io_ntv_code_to_descr(unsigned int EventCode, char *descr, int len)
static int _io_init_control_state(hwd_control_state_t *ctl)
static IO_native_event_entry_t * io_native_table
static int _io_ntv_enum_events(unsigned int *EventCode, int modifier)
static int io_count_events(_io_context_t *myCtx)
static int _io_reset(hwd_context_t *ctx, hwd_control_state_t *ctl)
static int _io_init_thread(hwd_context_t *ctx)
static int _io_write(hwd_context_t *ctx, hwd_control_state_t *ctl, long long *events)
#define HANDLE_STRING_ERROR
Return codes and api definitions.
#define SUBDBG(format, args...)
int fclose(FILE *__stream)
#define papi_calloc(a, b)
char desc[PAPI_MAX_STR_LEN]
char name[PAPI_MAX_STR_LEN]
char disabled_reason[PAPI_HUGE_STR_LEN]
char line[FILE_LINE_SIZE]
long long EventSetReport[IO_COUNTERS]
int EventSetIdx[IO_COUNTERS]
long long EventSetVal[IO_COUNTERS]
PAPI_component_info_t cmp_info