PAPI  5.4.0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
linux-lustre.c File Reference

A component for the luster filesystem. More...

Include dependency graph for linux-lustre.c:

Go to the source code of this file.

Data Structures

struct  STEALTIME_reg_alloc_t
 
struct  string_list
 
struct  lustre_fs
 
struct  LUSTRE_control_state_t
 
struct  LUSTRE_context_t
 

Macros

#define LUSTRE_MAX_COUNTERS   100
 
#define LUSTRE_MAX_COUNTER_TERMS   LUSTRE_MAX_COUNTERS
 

Typedefs

typedef counter_info LUSTRE_register_t
 
typedef counter_info LUSTRE_native_event_entry_t
 
typedef counter_info LUSTRE_reg_alloc_t
 

Functions

static int resize_native_table ()
 
static counter_infoaddCounter (const char *name, const char *desc, const char *unit)
 
static int addLustreFS (const char *name, const char *procpath_general, const char *procpath_readahead)
 
static int init_lustre_counters (void)
 
static void read_lustre_counter ()
 
static void host_finalize (void)
 
static int detect_lustre ()
 
int _lustre_init_component (int cidx)
 
int _lustre_init_thread (hwd_context_t *ctx)
 
int _lustre_shutdown_component (void)
 
int _lustre_shutdown_thread (hwd_context_t *ctx)
 
int _lustre_init_control_state (hwd_control_state_t *ctl)
 
int _lustre_update_control_state (hwd_control_state_t *ctl, NativeInfo_t *native, int count, hwd_context_t *ctx)
 
int _lustre_start (hwd_context_t *ctx, hwd_control_state_t *ctl)
 
int _lustre_stop (hwd_context_t *ctx, hwd_control_state_t *ctl)
 
int _lustre_read (hwd_context_t *ctx, hwd_control_state_t *ctl, long long **events, int flags)
 
int _lustre_reset (hwd_context_t *ctx, hwd_control_state_t *ctrl)
 
int _lustre_write (hwd_context_t *ctx, hwd_control_state_t *ctrl, long long *from)
 
int _lustre_ctl (hwd_context_t *ctx, int code, _papi_int_option_t *option)
 
int _lustre_set_domain (hwd_control_state_t *cntrl, int domain)
 
int _lustre_ntv_code_to_name (unsigned int EventCode, char *name, int len)
 
int _lustre_ntv_code_to_descr (unsigned int EventCode, char *name, int len)
 
int _lustre_ntv_enum_events (unsigned int *EventCode, int modifier)
 

Variables

const char proc_base_path [] = "/proc/fs/lustre/"
 
static counter_info ** lustre_native_table = NULL
 
static int num_events = 0
 
static int table_size = 32
 
static lustre_fsroot_lustre_fs = NULL
 
papi_vector_t _lustre_vector
 

Detailed Description

Author
Haihang You (in collaboration with Michael Kluge, TU Dresden) you@e.nosp@m.ecs..nosp@m.utk.e.nosp@m.du
Heike Jagode jagod.nosp@m.e@ee.nosp@m.cs.ut.nosp@m.k.ed.nosp@m.u
Vince Weaver vweav.nosp@m.er1@.nosp@m.eecs..nosp@m.utk..nosp@m.edu

Definition in file linux-lustre.c.

Macro Definition Documentation

#define LUSTRE_MAX_COUNTER_TERMS   LUSTRE_MAX_COUNTERS

Definition at line 58 of file linux-lustre.c.

#define LUSTRE_MAX_COUNTERS   100

Definition at line 57 of file linux-lustre.c.

Typedef Documentation

Definition at line 61 of file linux-lustre.c.

Definition at line 62 of file linux-lustre.c.

Definition at line 60 of file linux-lustre.c.

Function Documentation

int _lustre_ctl ( hwd_context_t ctx,
int  code,
_papi_int_option_t option 
)

Definition at line 662 of file linux-lustre.c.

663 {
664  ( void ) ctx;
665  ( void ) code;
666  ( void ) option;
667 
668  return PAPI_OK;
669 }
return PAPI_OK
Definition: linux-nvml.c:458
void
Definition: iozone.c:18627
int _lustre_init_component ( int  cidx)

Definition at line 438 of file linux-lustre.c.

439 {
440 
441  int ret = PAPI_OK;
442 
443  /* See if lustre filesystem exists */
444  ret=detect_lustre();
445  if (ret!=PAPI_OK) {
447  "No lustre filesystems found",PAPI_MAX_STR_LEN);
448  return ret;
449  }
450 
452  ret=init_lustre_counters();
453 
456 
457  return ret;
458 }
papi_vector_t _lustre_vector
Definition: linux-lustre.c:94
static int num_events
return PAPI_OK
Definition: linux-nvml.c:458
static int detect_lustre()
Definition: linux-lustre.c:410
PAPI_component_info_t cmp_info
Definition: papi_vector.h:20
long long ret
Definition: iozone.c:1346
char disabled_reason[PAPI_MAX_STR_LEN]
Definition: papi.h:633
static int cidx
Definition: event_info.c:40
static int init_lustre_counters(void)
Definition: linux-lustre.c:244
#define PAPI_MAX_STR_LEN
Definition: papi.h:463
static int resize_native_table()
Definition: linux-lustre.c:99

Here is the call graph for this function:

int _lustre_init_control_state ( hwd_control_state_t ctl)

Definition at line 506 of file linux-lustre.c.

507 {
508  LUSTRE_control_state_t *lustre_ctl = (LUSTRE_control_state_t *)ctl;
509 
510  memset(lustre_ctl->start_count,0,sizeof(long long)*LUSTRE_MAX_COUNTERS);
511  memset(lustre_ctl->current_count,0,sizeof(long long)*LUSTRE_MAX_COUNTERS);
512 
513  return PAPI_OK;
514 }
memset(eventId, 0, size)
return PAPI_OK
Definition: linux-nvml.c:458
#define LUSTRE_MAX_COUNTERS
Definition: linux-lustre.c:57
long long current_count[LUSTRE_MAX_COUNTERS]
Definition: linux-lustre.c:68
long long start_count[LUSTRE_MAX_COUNTERS]
Definition: linux-lustre.c:67

Here is the call graph for this function:

int _lustre_init_thread ( hwd_context_t ctx)

Definition at line 468 of file linux-lustre.c.

469 {
470  (void) ctx;
471 
472  return PAPI_OK;
473 }
return PAPI_OK
Definition: linux-nvml.c:458
void
Definition: iozone.c:18627
int _lustre_ntv_code_to_descr ( unsigned int  EventCode,
char *  name,
int  len 
)

Definition at line 719 of file linux-lustre.c.

720 {
721  SUBDBG("ENTER: EventCode: %#x, name: %p, len: %d\n", EventCode, name, len);
722  int event=EventCode;
723 
724  if (event >=0 && event < num_events) {
725  strncpy( name, lustre_native_table[event]->description, len-1 );
726  name[len-1] = '\0';
727  SUBDBG("EXIT: description: %s\n", name);
728  return PAPI_OK;
729  }
730  SUBDBG("EXIT: PAPI_ENOEVNT\n");
731  return PAPI_ENOEVNT;
732 }
#define PAPI_ENOEVNT
Definition: papi.h:258
static int num_events
device[deviceId] domain[domainId] event
Definition: linux-cuda.c:306
return PAPI_OK
Definition: linux-nvml.c:458
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
char * name
Definition: iozone.c:23648
static counter_info ** lustre_native_table
Definition: linux-lustre.c:87
int _lustre_ntv_code_to_name ( unsigned int  EventCode,
char *  name,
int  len 
)

Definition at line 699 of file linux-lustre.c.

700 {
701  SUBDBG("ENTER: EventCode: %#x, name: %p, len: %d\n", EventCode, name, len);
702  int event=EventCode;
703 
704  if (event >=0 && event < num_events) {
705  strncpy( name, lustre_native_table[event]->name, len-1 );
706  name[len-1] = '\0';
707  SUBDBG("EXIT: event name: %s\n", name);
708  return PAPI_OK;
709  }
710  SUBDBG("EXIT: PAPI_ENOEVNT\n");
711  return PAPI_ENOEVNT;
712 }
#define PAPI_ENOEVNT
Definition: papi.h:258
static int num_events
device[deviceId] domain[domainId] event
Definition: linux-cuda.c:306
return PAPI_OK
Definition: linux-nvml.c:458
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
char * name
Definition: iozone.c:23648
static counter_info ** lustre_native_table
Definition: linux-lustre.c:87
int _lustre_ntv_enum_events ( unsigned int EventCode,
int  modifier 
)

Definition at line 739 of file linux-lustre.c.

740 {
741  SUBDBG("ENTER: EventCode: %p, modifier: %d\n", EventCode, modifier);
742 
743  if ( modifier == PAPI_ENUM_FIRST ) {
744  if (num_events==0) return PAPI_ENOEVNT;
745  *EventCode = 0;
746  SUBDBG("EXIT: *EventCode: %#x\n", *EventCode);
747  return PAPI_OK;
748  }
749 
750  if ( modifier == PAPI_ENUM_EVENTS ) {
751  int index = *EventCode;
752 
753  if ( lustre_native_table[index + 1] ) {
754  *EventCode = *EventCode + 1;
755  SUBDBG("EXIT: *EventCode: %#x\n", *EventCode);
756  return PAPI_OK;
757  } else {
758  SUBDBG("EXIT: PAPI_ENOEVNT\n");
759  return PAPI_ENOEVNT;
760  }
761  }
762 
763 
764  SUBDBG("EXIT: PAPI_EINVAL\n");
765  return PAPI_EINVAL;
766 }
#define PAPI_ENOEVNT
Definition: papi.h:258
static int num_events
return PAPI_OK
Definition: linux-nvml.c:458
return PAPI_EINVAL
Definition: linux-nvml.c:408
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
static counter_info ** lustre_native_table
Definition: linux-lustre.c:87
int _lustre_read ( hwd_context_t ctx,
hwd_control_state_t ctl,
long long **  events,
int  flags 
)

Definition at line 597 of file linux-lustre.c.

599 {
600  (void) ctx;
601  ( void ) flags;
602 
603  LUSTRE_control_state_t *lustre_ctl = (LUSTRE_control_state_t *)ctl;
604  int i;
605 
607 
608  for(i=0;i<lustre_ctl->num_events;i++) {
609  lustre_ctl->current_count[i]=
610  lustre_native_table[lustre_ctl->which_counter[i]]->value;
611  lustre_ctl->difference[i]=lustre_ctl->current_count[i]-
612  lustre_ctl->start_count[i];
613  }
614 
615  *events = lustre_ctl->difference;
616 
617  return PAPI_OK;
618 
619 }
long long flags
Definition: iozone.c:12330
long long difference[LUSTRE_MAX_COUNTERS]
Definition: linux-lustre.c:69
return PAPI_OK
Definition: linux-nvml.c:458
void
Definition: iozone.c:18627
char events[MAX_EVENTS][BUFSIZ]
int i
Definition: fileop.c:140
int which_counter[LUSTRE_MAX_COUNTERS]
Definition: linux-lustre.c:70
long long current_count[LUSTRE_MAX_COUNTERS]
Definition: linux-lustre.c:68
long long start_count[LUSTRE_MAX_COUNTERS]
Definition: linux-lustre.c:67
static counter_info ** lustre_native_table
Definition: linux-lustre.c:87
static void read_lustre_counter()
Definition: linux-lustre.c:326

Here is the call graph for this function:

int _lustre_reset ( hwd_context_t ctx,
hwd_control_state_t ctrl 
)

Definition at line 628 of file linux-lustre.c.

629 {
630 
631  /* re-initializes counter_start values to current */
632 
633  _lustre_start(ctx,ctrl);
634 
635  return PAPI_OK;
636 }
return PAPI_OK
Definition: linux-nvml.c:458
int _lustre_start(hwd_context_t *ctx, hwd_control_state_t *ctl)
Definition: linux-lustre.c:547

Here is the call graph for this function:

int _lustre_set_domain ( hwd_control_state_t cntrl,
int  domain 
)

Definition at line 684 of file linux-lustre.c.

685 {
686  SUBDBG("ENTER: cntrl: %p, domain: %#x\n", cntrl, domain);
687 
688  // this component does not allow limiting which domains will increment event counts
689 
690  SUBDBG("EXIT: PAPI_OK\n");
691  return PAPI_OK;
692 }
return PAPI_OK
Definition: linux-nvml.c:458
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
int _lustre_shutdown_component ( void  )

Definition at line 480 of file linux-lustre.c.

481 {
482 
483  host_finalize( );
485 
486  return PAPI_OK;
487 }
#define papi_free(a)
Definition: papi_memory.h:35
return PAPI_OK
Definition: linux-nvml.c:458
static void host_finalize(void)
Definition: linux-lustre.c:375
static counter_info ** lustre_native_table
Definition: linux-lustre.c:87

Here is the call graph for this function:

int _lustre_shutdown_thread ( hwd_context_t ctx)

Definition at line 493 of file linux-lustre.c.

494 {
495  ( void ) ctx;
496 
497  return PAPI_OK;
498 }
return PAPI_OK
Definition: linux-nvml.c:458
void
Definition: iozone.c:18627
int _lustre_start ( hwd_context_t ctx,
hwd_control_state_t ctl 
)

Definition at line 547 of file linux-lustre.c.

548 {
549  ( void ) ctx;
550 
551  LUSTRE_control_state_t *lustre_ctl = (LUSTRE_control_state_t *)ctl;
552  int i;
553 
555 
556  for(i=0;i<lustre_ctl->num_events;i++) {
557  lustre_ctl->current_count[i]=
558  lustre_native_table[lustre_ctl->which_counter[i]]->value;
559  }
560 
561  memcpy( lustre_ctl->start_count,
562  lustre_ctl->current_count,
563  LUSTRE_MAX_COUNTERS * sizeof ( long long ) );
564 
565  return PAPI_OK;
566 }
return PAPI_OK
Definition: linux-nvml.c:458
void
Definition: iozone.c:18627
int i
Definition: fileop.c:140
int which_counter[LUSTRE_MAX_COUNTERS]
Definition: linux-lustre.c:70
#define LUSTRE_MAX_COUNTERS
Definition: linux-lustre.c:57
long long current_count[LUSTRE_MAX_COUNTERS]
Definition: linux-lustre.c:68
long long start_count[LUSTRE_MAX_COUNTERS]
Definition: linux-lustre.c:67
again struct sockaddr sizeof(struct sockaddr_in))
static counter_info ** lustre_native_table
Definition: linux-lustre.c:87
static void read_lustre_counter()
Definition: linux-lustre.c:326

Here is the call graph for this function:

Here is the caller graph for this function:

int _lustre_stop ( hwd_context_t ctx,
hwd_control_state_t ctl 
)

Definition at line 573 of file linux-lustre.c.

574 {
575 
576  (void) ctx;
577  LUSTRE_control_state_t *lustre_ctl = (LUSTRE_control_state_t *)ctl;
578  int i;
579 
581 
582  for(i=0;i<lustre_ctl->num_events;i++) {
583  lustre_ctl->current_count[i]=
584  lustre_native_table[lustre_ctl->which_counter[i]]->value;
585  }
586 
587  return PAPI_OK;
588 
589 }
return PAPI_OK
Definition: linux-nvml.c:458
void
Definition: iozone.c:18627
int i
Definition: fileop.c:140
int which_counter[LUSTRE_MAX_COUNTERS]
Definition: linux-lustre.c:70
long long current_count[LUSTRE_MAX_COUNTERS]
Definition: linux-lustre.c:68
static counter_info ** lustre_native_table
Definition: linux-lustre.c:87
static void read_lustre_counter()
Definition: linux-lustre.c:326

Here is the call graph for this function:

int _lustre_update_control_state ( hwd_control_state_t ctl,
NativeInfo_t native,
int  count,
hwd_context_t ctx 
)

Definition at line 521 of file linux-lustre.c.

525 {
526  SUBDBG("ENTER: ctl: %p, native: %p, count: %d, ctx: %p\n", ctl, native, count, ctx);
527  LUSTRE_control_state_t *lustre_ctl = (LUSTRE_control_state_t *)ctl;
528  ( void ) ctx;
529  int i, index;
530 
531  for ( i = 0; i < count; i++ ) {
532  index = native[i].ni_event;
533  lustre_ctl->which_counter[i]=index;
534  native[i].ni_position = i;
535  }
536 
537  lustre_ctl->num_events=count;
538  SUBDBG("EXIT: PAPI_OK\n");
539  return PAPI_OK;
540 }
return PAPI_OK
Definition: linux-nvml.c:458
int count
Definition: iozone.c:22422
void
Definition: iozone.c:18627
int i
Definition: fileop.c:140
int which_counter[LUSTRE_MAX_COUNTERS]
Definition: linux-lustre.c:70
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
int _lustre_write ( hwd_context_t ctx,
hwd_control_state_t ctrl,
long long from 
)

Definition at line 643 of file linux-lustre.c.

644 {
645  ( void ) ctx;
646  ( void ) ctrl;
647  ( void ) from;
648 
649  return PAPI_OK;
650 }
return PAPI_OK
Definition: linux-nvml.c:458
void
Definition: iozone.c:18627
static counter_info* addCounter ( const char *  name,
const char *  desc,
const char *  unit 
)
static

add a counter to the list of available counters

Parameters
namethe short name of the counter
desca longer description
unitthe unit for this counter

Definition at line 121 of file linux-lustre.c.

122 {
123  SUBDBG("ENTER: name: %s, desc: %s, unit: %s\n", name, desc, unit);
124 
125  counter_info *cntr;
126 
127  if ( num_events >= table_size )
128  if (PAPI_OK != resize_native_table()) {
129  SUBDBG("EXIT: can not resize native table\n" );
130  return NULL;
131  }
132 
133  cntr = malloc( sizeof ( counter_info ) );
134 
135  if ( cntr == NULL ) {
136  SUBDBG("EXIT: can not allocate memory for new counter\n" );
137  return NULL;
138  }
139 
140  cntr->idx=num_events;
141  cntr->name = strdup( name );
142  cntr->description = strdup( desc );
143  cntr->unit = strdup( unit );
144  cntr->value = 0;
145 
147 
148  num_events++;
149 
150 SUBDBG("EXIT: cntr: %p\n", cntr);
151  return cntr;
152 }
static int num_events
static int table_size
Definition: linux-lustre.c:89
return PAPI_OK
Definition: linux-nvml.c:458
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
char * name
Definition: iozone.c:23648
static counter_info ** lustre_native_table
Definition: linux-lustre.c:87
static int resize_native_table()
Definition: linux-lustre.c:99

Here is the call graph for this function:

Here is the caller graph for this function:

static int addLustreFS ( const char *  name,
const char *  procpath_general,
const char *  procpath_readahead 
)
static

adds a Lustre fs to the fs list and creates the counters for it

Parameters
namefs name
procpath_generalpath to the 'stats' file in /proc/fs/lustre/... for this fs
procpath_readaheadpath to the 'readahead' file in /proc/fs/lustre/... for this fs

Definition at line 161 of file linux-lustre.c.

164 {
165  lustre_fs *fs, *last;
166  char counter_name[512];
167  FILE *fff;
168 
169  SUBDBG("Adding lustre fs\n");
170 
171  fs = malloc( sizeof ( lustre_fs ) );
172  if ( fs == NULL ) {
173  SUBDBG("can not allocate memory for new Lustre FS description\n" );
174  return PAPI_ENOMEM;
175  }
176 
177  fs->proc_file=strdup(procpath_general);
178  fff = fopen( procpath_general, "r" );
179  if ( fff == NULL ) {
180  SUBDBG("can not open '%s'\n", procpath_general );
181  free(fs);
182  return PAPI_ESYS;
183  }
184  fclose(fff);
185 
186  fs->proc_file_readahead = strdup(procpath_readahead);
187  fff = fopen( procpath_readahead, "r" );
188  if ( fff == NULL ) {
189  SUBDBG("can not open '%s'\n", procpath_readahead );
190  free(fs);
191  return PAPI_ESYS;
192  }
193  fclose(fff);
194 
195  sprintf( counter_name, "%s_llread", name );
196  if (NULL == (fs->read_cntr = addCounter( counter_name,
197  "bytes read on this lustre client",
198  "bytes" ))) {
199  free(fs);
200  return PAPI_ENOMEM;
201  }
202 
203  sprintf( counter_name, "%s_llwrite", name );
204  if ( NULL == (fs->write_cntr = addCounter( counter_name,
205  "bytes written on this lustre client",
206  "bytes" ))) {
207  free(fs->read_cntr);
208  free(fs);
209  return PAPI_ENOMEM;
210  }
211 
212  sprintf( counter_name, "%s_wrong_readahead", name );
213  if ( NULL == (fs->readahead_cntr = addCounter( counter_name,
214  "bytes read but discarded due to readahead",
215  "bytes" ))) {
216  free(fs->read_cntr);
217  free(fs->write_cntr);
218  free(fs);
219  return PAPI_ENOMEM;
220  }
221 
222  fs->next = NULL;
223 
224  /* Insert into the linked list */
225  /* Does this need locking? */
226  if ( root_lustre_fs == NULL ) {
227  root_lustre_fs = fs;
228  } else {
229  last = root_lustre_fs;
230 
231  while ( last->next != NULL )
232  last = last->next;
233 
234  last->next = fs;
235  }
236  return PAPI_OK;
237 }
struct lustre_fs_struct * next
Definition: linux-lustre.c:54
sprintf(splash[splash_line++],"\tIozone: Performance Test of File I/O\n")
static counter_info * addCounter(const char *name, const char *desc, const char *unit)
Definition: linux-lustre.c:121
char * proc_file_readahead
Definition: linux-lustre.c:50
counter_info * read_cntr
Definition: linux-lustre.c:52
return PAPI_OK
Definition: linux-nvml.c:458
fclose(thread_wqfd)
char * proc_file
Definition: linux-lustre.c:49
FILE * fff[MAX_EVENTS]
free(dummyfile[xx])
#define PAPI_ESYS
Definition: papi.h:253
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
counter_info * write_cntr
Definition: linux-lustre.c:51
static struct temp_event * last
#define PAPI_ENOMEM
Definition: papi.h:252
static lustre_fs * root_lustre_fs
Definition: linux-lustre.c:92
char * name
Definition: iozone.c:23648
counter_info * readahead_cntr
Definition: linux-lustre.c:53

Here is the call graph for this function:

Here is the caller graph for this function:

static int detect_lustre ( )
static

see if lustre filesystem is supported by kernel

Definition at line 410 of file linux-lustre.c.

411 {
412  char lustre_directory[BUFSIZ];
413  DIR *proc_dir;
414 
415  sprintf(lustre_directory,"%s/llite",proc_base_path);
416 
417  proc_dir = opendir( proc_base_path );
418  if ( proc_dir == NULL ) {
419  SUBDBG("we are not able to read %s\n",lustre_directory);
420  return PAPI_ESYS;
421  }
422 
423  closedir(proc_dir);
424 
425  return PAPI_OK;
426 }
sprintf(splash[splash_line++],"\tIozone: Performance Test of File I/O\n")
return PAPI_OK
Definition: linux-nvml.c:458
#define PAPI_ESYS
Definition: papi.h:253
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
const char proc_base_path[]
Definition: linux-lustre.c:84

Here is the call graph for this function:

Here is the caller graph for this function:

static void host_finalize ( void  )
static

frees all allocated resources

Definition at line 375 of file linux-lustre.c.

376 {
377  int i;
378  lustre_fs *fs, *next_fs;
379  counter_info *cntr;
380 
381  for(i=0;i<num_events;i++) {
382  cntr=lustre_native_table[i];
383  if ( cntr != NULL ) {
384  free( cntr->name );
385  free( cntr->description );
386  free( cntr->unit );
387  free( cntr );
388  }
389  lustre_native_table[i]=NULL;
390  }
391 
392  fs = root_lustre_fs;
393 
394  while ( fs != NULL ) {
395  next_fs = fs->next;
396  free(fs->proc_file);
398  free( fs );
399  fs = next_fs;
400  }
401 
402  root_lustre_fs = NULL;
403 }
struct lustre_fs_struct * next
Definition: linux-lustre.c:54
static int num_events
char * proc_file_readahead
Definition: linux-lustre.c:50
char * proc_file
Definition: linux-lustre.c:49
int i
Definition: fileop.c:140
free(dummyfile[xx])
static lustre_fs * root_lustre_fs
Definition: linux-lustre.c:92
static counter_info ** lustre_native_table
Definition: linux-lustre.c:87

Here is the call graph for this function:

Here is the caller graph for this function:

static int init_lustre_counters ( void  )
static

goes through proc and tries to discover all mounted Lustre fs

Definition at line 244 of file linux-lustre.c.

245 {
246  SUBDBG("ENTER:\n");
247  char lustre_dir[PATH_MAX];
248  char path[PATH_MAX];
249  char path_readahead[PATH_MAX],path_stats[PATH_MAX];
250  char *ptr;
251  char fs_name[100];
252  int idx = 0;
253  int tmp_fd;
254  DIR *proc_dir;
255  struct dirent *entry;
256 
257  sprintf(lustre_dir,"%s/llite",proc_base_path);
258 
259  proc_dir = opendir( lustre_dir );
260  if ( proc_dir == NULL ) {
261  SUBDBG("EXIT: Cannot open %s\n",lustre_dir);
262  return PAPI_ESYS;
263  }
264 
265  while ( (entry = readdir( proc_dir )) != NULL ) {
266  memset( path, 0, PATH_MAX );
267  snprintf( path, PATH_MAX - 1, "%s/%s/stats", lustre_dir,
268  entry->d_name );
269  SUBDBG("checking for file %s\n", path);
270 
271  if ( ( tmp_fd = open( path, O_RDONLY ) ) != -1 ) {
272  close( tmp_fd );
273 
274  /* erase \r and \n at the end of path */
275  /* why is this necessary? */
276 
277  idx = strlen( path );
278  idx--;
279 
280  while ( path[idx] == '\r' || path[idx] == '\n' )
281  path[idx--] = 0;
282 
283  /* Lustre paths are of type server-UUID */
284 
285  idx = 0;
286 
287  ptr = strstr(path,"llite/") + 6;
288  if (ptr == NULL) {
289  SUBDBG("Path: %s, missing llite directory, performance event not created.\n", path);
290  continue;
291  }
292 
293  strncpy(fs_name, ptr, sizeof(fs_name)-1);
294  fs_name[sizeof(fs_name)-1] = '\0';
295 
296  SUBDBG("found Lustre FS: %s\n", fs_name);
297 
298  snprintf( path_stats, PATH_MAX - 1,
299  "%s/%s/stats",
300  lustre_dir,
301  entry->d_name );
302  SUBDBG("Found file %s\n", path_stats);
303 
304  snprintf( path_readahead, PATH_MAX - 1,
305  "%s/%s/read_ahead_stats",
306  lustre_dir,
307  entry->d_name );
308  SUBDBG("Now checking for file %s\n", path_readahead);
309 
310 
311  strcpy( ptr, "read_ahead_stats" );
312  addLustreFS( fs_name, path_stats, path_readahead );
313 
314  }
315  }
316  closedir( proc_dir );
317 
318  SUBDBG("EXIT: PAPI_OK\n");
319  return PAPI_OK;
320 }
sprintf(splash[splash_line++],"\tIozone: Performance Test of File I/O\n")
memset(eventId, 0, size)
int close(int fd)
Definition: appio.c:175
return PAPI_OK
Definition: linux-nvml.c:458
struct cache_ent * entry
Definition: libasync.c:1170
int open(const char *pathname, int flags, mode_t mode)
Definition: appio.c:184
#define PAPI_ESYS
Definition: papi.h:253
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
const char proc_base_path[]
Definition: linux-lustre.c:84
strcpy(filename, default_filename)
#define PATH_MAX
Definition: fileop.c:68
static int addLustreFS(const char *name, const char *procpath_general, const char *procpath_readahead)
Definition: linux-lustre.c:161
char * ptr
Definition: iozone.c:23586

Here is the call graph for this function:

Here is the caller graph for this function:

static void read_lustre_counter ( )
static

updates all Lustre related counters

Definition at line 326 of file linux-lustre.c.

327 {
329  FILE *fff;
330  char buffer[BUFSIZ];
331 
332  while ( fs != NULL ) {
333 
334  /* read values from stats file */
335  fff=fopen(fs->proc_file,"r" );
336  if (fff != NULL) {
337  while(1) {
338  if (fgets(buffer,BUFSIZ,fff)==NULL) break;
339 
340  if (strstr( buffer, "write_bytes" )) {
341  sscanf(buffer,"%*s %*d %*s %*s %*d %*d %llu",&fs->write_cntr->value);
342  SUBDBG("Read %llu write_bytes\n",fs->write_cntr->value);
343  }
344 
345  if (strstr( buffer, "read_bytes" )) {
346  sscanf(buffer,"%*s %*d %*s %*s %*d %*d %llu",&fs->read_cntr->value);
347  SUBDBG("Read %llu read_bytes\n",fs->read_cntr->value);
348  }
349  }
350  fclose(fff);
351  }
352 
353  fff=fopen(fs->proc_file_readahead,"r");
354  if (fff != NULL) {
355  while(1) {
356  if (fgets(buffer,BUFSIZ,fff)==NULL) break;
357 
358  if (strstr( buffer, "read but discarded")) {
359  sscanf(buffer,"%*s %*s %*s %llu",&fs->readahead_cntr->value);
360  SUBDBG("Read %llu discared\n",fs->readahead_cntr->value);
361  break;
362  }
363  }
364  fclose(fff);
365  }
366  fs = fs->next;
367  }
368 }
struct lustre_fs_struct * next
Definition: linux-lustre.c:54
char * proc_file_readahead
Definition: linux-lustre.c:50
counter_info * read_cntr
Definition: linux-lustre.c:52
fclose(thread_wqfd)
char * proc_file
Definition: linux-lustre.c:49
FILE * fff[MAX_EVENTS]
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
counter_info * write_cntr
Definition: linux-lustre.c:51
char * buffer
Definition: iozone.c:1366
static lustre_fs * root_lustre_fs
Definition: linux-lustre.c:92
sscanf(mnc->m_child_port,"%d",&mc.m_child_port)
counter_info * readahead_cntr
Definition: linux-lustre.c:53

Here is the call graph for this function:

Here is the caller graph for this function:

static int resize_native_table ( )
static

Definition at line 99 of file linux-lustre.c.

99  {
100  counter_info** new_table;
101  int new_size = table_size*2;
102  new_table = (counter_info**)papi_malloc(sizeof(counter_info*) * new_size);
103  if (NULL==new_table)
104  return PAPI_ENOMEM;
105  if ( lustre_native_table) {
106  memcpy(new_table, lustre_native_table, sizeof(counter_info*) * table_size );
108  }
109  lustre_native_table = new_table;
110  table_size*=2;
111  return PAPI_OK;
112 }
#define papi_free(a)
Definition: papi_memory.h:35
#define papi_malloc(a)
Definition: papi_memory.h:34
static int table_size
Definition: linux-lustre.c:89
return PAPI_OK
Definition: linux-nvml.c:458
#define PAPI_ENOMEM
Definition: papi.h:252
static counter_info ** lustre_native_table
Definition: linux-lustre.c:87

Here is the caller graph for this function:

Variable Documentation

papi_vector_t _lustre_vector

Definition at line 94 of file linux-lustre.c.

counter_info** lustre_native_table = NULL
static

Definition at line 87 of file linux-lustre.c.

int num_events = 0
static

Definition at line 88 of file linux-lustre.c.

const char proc_base_path[] = "/proc/fs/lustre/"

Definition at line 84 of file linux-lustre.c.

lustre_fs* root_lustre_fs = NULL
static

Definition at line 92 of file linux-lustre.c.

int table_size = 32
static

Definition at line 89 of file linux-lustre.c.