PAPI  5.6.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 _lustre_init_component (int cidx)
 
static int _lustre_init_thread (hwd_context_t *ctx)
 
static int _lustre_shutdown_component (void)
 
static int _lustre_shutdown_thread (hwd_context_t *ctx)
 
static int _lustre_init_control_state (hwd_control_state_t *ctl)
 
static int _lustre_update_control_state (hwd_control_state_t *ctl, NativeInfo_t *native, int count, hwd_context_t *ctx)
 
static int _lustre_start (hwd_context_t *ctx, hwd_control_state_t *ctl)
 
static int _lustre_stop (hwd_context_t *ctx, hwd_control_state_t *ctl)
 
static int _lustre_read (hwd_context_t *ctx, hwd_control_state_t *ctl, long long **events, int flags)
 
static int _lustre_reset (hwd_context_t *ctx, hwd_control_state_t *ctrl)
 
static int _lustre_ctl (hwd_context_t *ctx, int code, _papi_int_option_t *option)
 
static int _lustre_set_domain (hwd_control_state_t *cntrl, int domain)
 
static int _lustre_ntv_code_to_name (unsigned int EventCode, char *name, int len)
 
static int _lustre_ntv_code_to_descr (unsigned int EventCode, char *name, int len)
 
static 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

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

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

654 {
655  ( void ) ctx;
656  ( void ) code;
657  ( void ) option;
658 
659  return PAPI_OK;
660 }
return PAPI_OK
Definition: linux-nvml.c:497
void
Definition: iozone.c:18627
static int _lustre_init_component ( int  cidx)
static

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

428 {
429  SUBDBG("ENTER:\n");
430  int ret = PAPI_OK;
431 
433  ret=init_lustre_counters();
434  if (ret!=PAPI_OK) {
436  "No lustre filesystems found",PAPI_MAX_STR_LEN);
437  SUBDBG("EXIT: ret: %d\n", ret);
438  return ret;
439  }
440 
443 
444  SUBDBG("EXIT: ret: %d\n", ret);
445  return ret;
446 }
papi_vector_t _lustre_vector
Definition: linux-lustre.c:94
return PAPI_OK
Definition: linux-nvml.c:497
PAPI_component_info_t cmp_info
Definition: papi_vector.h:20
long long ret
Definition: iozone.c:1346
static int cidx
char disabled_reason[PAPI_MAX_STR_LEN]
Definition: papi.h:636
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
static int num_events
Definition: linux-lustre.c:88
static int init_lustre_counters(void)
Definition: linux-lustre.c:248
#define PAPI_MAX_STR_LEN
Definition: papi.h:465
static int resize_native_table()
Definition: linux-lustre.c:99

Here is the call graph for this function:

static int _lustre_init_control_state ( hwd_control_state_t ctl)
static

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

498 {
499  LUSTRE_control_state_t *lustre_ctl = (LUSTRE_control_state_t *)ctl;
500 
501  memset(lustre_ctl->start_count,0,sizeof(long long)*LUSTRE_MAX_COUNTERS);
502  memset(lustre_ctl->current_count,0,sizeof(long long)*LUSTRE_MAX_COUNTERS);
503 
504  return PAPI_OK;
505 }
return PAPI_OK
Definition: linux-nvml.c:497
#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
static int _lustre_init_thread ( hwd_context_t ctx)
static

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

457 {
458  (void) ctx;
459 
460  return PAPI_OK;
461 }
return PAPI_OK
Definition: linux-nvml.c:497
void
Definition: iozone.c:18627
static int _lustre_ntv_code_to_descr ( unsigned int  EventCode,
char *  name,
int  len 
)
static

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

713 {
714  SUBDBG("ENTER: EventCode: %#x, name: %p, len: %d\n", EventCode, name, len);
715  int event=EventCode;
716 
717  if (event >=0 && event < num_events) {
718  strncpy( name, lustre_native_table[event]->description, len-1 );
719  name[len-1] = '\0';
720  SUBDBG("EXIT: description: %s\n", name);
721  return PAPI_OK;
722  }
723  SUBDBG("EXIT: PAPI_ENOEVNT\n");
724  return PAPI_ENOEVNT;
725 }
#define PAPI_ENOEVNT
Definition: papi.h:260
return PAPI_OK
Definition: linux-nvml.c:497
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
static int num_events
Definition: linux-lustre.c:88
char * name
Definition: iozone.c:23648
static counter_info ** lustre_native_table
Definition: linux-lustre.c:87
static int _lustre_ntv_code_to_name ( unsigned int  EventCode,
char *  name,
int  len 
)
static

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

693 {
694  SUBDBG("ENTER: EventCode: %#x, name: %p, len: %d\n", EventCode, name, len);
695  int event=EventCode;
696 
697  if (event >=0 && event < num_events) {
698  strncpy( name, lustre_native_table[event]->name, len-1 );
699  name[len-1] = '\0';
700  SUBDBG("EXIT: event name: %s\n", name);
701  return PAPI_OK;
702  }
703  SUBDBG("EXIT: PAPI_ENOEVNT\n");
704  return PAPI_ENOEVNT;
705 }
#define PAPI_ENOEVNT
Definition: papi.h:260
return PAPI_OK
Definition: linux-nvml.c:497
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
static int num_events
Definition: linux-lustre.c:88
char * name
Definition: iozone.c:23648
static counter_info ** lustre_native_table
Definition: linux-lustre.c:87
static int _lustre_ntv_enum_events ( unsigned int EventCode,
int  modifier 
)
static

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

733 {
734  SUBDBG("ENTER: EventCode: %p, modifier: %d\n", EventCode, modifier);
735 
736  if ( modifier == PAPI_ENUM_FIRST ) {
737  if (num_events==0) return PAPI_ENOEVNT;
738  *EventCode = 0;
739  SUBDBG("EXIT: *EventCode: %#x\n", *EventCode);
740  return PAPI_OK;
741  }
742 
743  if ( modifier == PAPI_ENUM_EVENTS ) {
744  int index = *EventCode;
745 
746  if ((index+1 < num_events) && lustre_native_table[index + 1]) {
747  *EventCode = *EventCode + 1;
748  SUBDBG("EXIT: *EventCode: %#x\n", *EventCode);
749  return PAPI_OK;
750  } else {
751  SUBDBG("EXIT: PAPI_ENOEVNT\n");
752  return PAPI_ENOEVNT;
753  }
754  }
755 
756 
757  SUBDBG("EXIT: PAPI_EINVAL\n");
758  return PAPI_EINVAL;
759 }
#define PAPI_ENOEVNT
Definition: papi.h:260
return PAPI_OK
Definition: linux-nvml.c:497
return PAPI_EINVAL
Definition: linux-nvml.c:436
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
static int num_events
Definition: linux-lustre.c:88
static counter_info ** lustre_native_table
Definition: linux-lustre.c:87
static int _lustre_read ( hwd_context_t ctx,
hwd_control_state_t ctl,
long long **  events,
int  flags 
)
static

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

590 {
591  (void) ctx;
592  ( void ) flags;
593 
594  LUSTRE_control_state_t *lustre_ctl = (LUSTRE_control_state_t *)ctl;
595  int i;
596 
598 
599  for(i=0;i<lustre_ctl->num_events;i++) {
600  lustre_ctl->current_count[i]=
601  lustre_native_table[lustre_ctl->which_counter[i]]->value;
602  lustre_ctl->difference[i]=lustre_ctl->current_count[i]-
603  lustre_ctl->start_count[i];
604  }
605 
606  *events = lustre_ctl->difference;
607 
608  return PAPI_OK;
609 
610 }
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:497
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:338

Here is the call graph for this function:

static int _lustre_reset ( hwd_context_t ctx,
hwd_control_state_t ctrl 
)
static

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

620 {
621 
622  /* re-initializes counter_start values to current */
623 
624  _lustre_start(ctx,ctrl);
625 
626  return PAPI_OK;
627 }
static int _lustre_start(hwd_context_t *ctx, hwd_control_state_t *ctl)
Definition: linux-lustre.c:538
return PAPI_OK
Definition: linux-nvml.c:497

Here is the call graph for this function:

static int _lustre_set_domain ( hwd_control_state_t cntrl,
int  domain 
)
static

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

676 {
677  ( void ) cntrl;
678  ( void ) domain;
679  SUBDBG("ENTER: \n");
680 
681  // this component does not allow limiting which domains will increment event counts
682 
683  SUBDBG("EXIT: PAPI_OK\n");
684  return PAPI_OK;
685 }
return PAPI_OK
Definition: linux-nvml.c:497
void
Definition: iozone.c:18627
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
static int _lustre_shutdown_component ( void  )
static

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

469 {
470  SUBDBG("ENTER:\n");
471  host_finalize( );
473  lustre_native_table = NULL;
474  num_events = 0;
475  table_size = 32;
476  SUBDBG("EXIT:\n");
477  return PAPI_OK;
478 }
#define papi_free(a)
Definition: papi_memory.h:35
static int table_size
Definition: linux-lustre.c:89
return PAPI_OK
Definition: linux-nvml.c:497
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
static int num_events
Definition: linux-lustre.c:88
static void host_finalize(void)
Definition: linux-lustre.c:387
static counter_info ** lustre_native_table
Definition: linux-lustre.c:87

Here is the call graph for this function:

static int _lustre_shutdown_thread ( hwd_context_t ctx)
static

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

485 {
486  ( void ) ctx;
487 
488  return PAPI_OK;
489 }
return PAPI_OK
Definition: linux-nvml.c:497
void
Definition: iozone.c:18627
static int _lustre_start ( hwd_context_t ctx,
hwd_control_state_t ctl 
)
static

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

539 {
540  ( void ) ctx;
541 
542  LUSTRE_control_state_t *lustre_ctl = (LUSTRE_control_state_t *)ctl;
543  int i;
544 
546 
547  for(i=0;i<lustre_ctl->num_events;i++) {
548  lustre_ctl->current_count[i]=
549  lustre_native_table[lustre_ctl->which_counter[i]]->value;
550  }
551 
552  memcpy( lustre_ctl->start_count,
553  lustre_ctl->current_count,
554  LUSTRE_MAX_COUNTERS * sizeof ( long long ) );
555 
556  return PAPI_OK;
557 }
return PAPI_OK
Definition: linux-nvml.c:497
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:338

Here is the call graph for this function:

Here is the caller graph for this function:

static int _lustre_stop ( hwd_context_t ctx,
hwd_control_state_t ctl 
)
static

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

565 {
566 
567  (void) ctx;
568  LUSTRE_control_state_t *lustre_ctl = (LUSTRE_control_state_t *)ctl;
569  int i;
570 
572 
573  for(i=0;i<lustre_ctl->num_events;i++) {
574  lustre_ctl->current_count[i]=
575  lustre_native_table[lustre_ctl->which_counter[i]]->value;
576  }
577 
578  return PAPI_OK;
579 
580 }
return PAPI_OK
Definition: linux-nvml.c:497
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:338

Here is the call graph for this function:

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

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

516 {
517  SUBDBG("ENTER: ctl: %p, native: %p, count: %d, ctx: %p\n", ctl, native, count, ctx);
518  LUSTRE_control_state_t *lustre_ctl = (LUSTRE_control_state_t *)ctl;
519  ( void ) ctx;
520  int i, index;
521 
522  for ( i = 0; i < count; i++ ) {
523  index = native[i].ni_event;
524  lustre_ctl->which_counter[i]=index;
525  native[i].ni_position = i;
526  }
527 
528  lustre_ctl->num_events=count;
529  SUBDBG("EXIT: PAPI_OK\n");
530  return PAPI_OK;
531 }
return PAPI_OK
Definition: linux-nvml.c:497
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
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 125 of file linux-lustre.c.

126 {
127  SUBDBG("ENTER: name: %s, desc: %s, unit: %s\n", name, desc, unit);
128 
129  counter_info *cntr;
130 
131  if ( num_events >= table_size )
132  if (PAPI_OK != resize_native_table()) {
133  SUBDBG("EXIT: can not resize native table\n" );
134  return NULL;
135  }
136 
137  cntr = malloc( sizeof ( counter_info ) );
138 
139  if ( cntr == NULL ) {
140  SUBDBG("EXIT: can not allocate memory for new counter\n" );
141  return NULL;
142  }
143 
144  cntr->idx=num_events;
145  cntr->name = strdup( name );
146  cntr->description = strdup( desc );
147  cntr->unit = strdup( unit );
148  cntr->value = 0;
149 
151 
152  num_events++;
153 
154 SUBDBG("EXIT: cntr: %p\n", cntr);
155  return cntr;
156 }
static int table_size
Definition: linux-lustre.c:89
return PAPI_OK
Definition: linux-nvml.c:497
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
static int num_events
Definition: linux-lustre.c:88
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 165 of file linux-lustre.c.

168 {
169  lustre_fs *fs, *last;
170  char counter_name[512];
171  FILE *fff;
172 
173  SUBDBG("Adding lustre fs\n");
174 
175  fs = malloc( sizeof ( lustre_fs ) );
176  if ( fs == NULL ) {
177  SUBDBG("can not allocate memory for new Lustre FS description\n" );
178  return PAPI_ENOMEM;
179  }
180 
181  fs->proc_file=strdup(procpath_general);
182  fff = fopen( procpath_general, "r" );
183  if ( fff == NULL ) {
184  SUBDBG("can not open '%s'\n", procpath_general );
185  free(fs);
186  return PAPI_ESYS;
187  }
188  fclose(fff);
189 
190  fs->proc_file_readahead = strdup(procpath_readahead);
191  fff = fopen( procpath_readahead, "r" );
192  if ( fff == NULL ) {
193  SUBDBG("can not open '%s'\n", procpath_readahead );
194  free(fs);
195  return PAPI_ESYS;
196  }
197  fclose(fff);
198 
199  sprintf( counter_name, "%s_llread", name );
200  if (NULL == (fs->read_cntr = addCounter( counter_name,
201  "bytes read on this lustre client",
202  "bytes" ))) {
203  free(fs);
204  return PAPI_ENOMEM;
205  }
206 
207  sprintf( counter_name, "%s_llwrite", name );
208  if ( NULL == (fs->write_cntr = addCounter( counter_name,
209  "bytes written on this lustre client",
210  "bytes" ))) {
211  free(fs->read_cntr);
212  free(fs);
213  return PAPI_ENOMEM;
214  }
215 
216  sprintf( counter_name, "%s_wrong_readahead", name );
217  if ( NULL == (fs->readahead_cntr = addCounter( counter_name,
218  "bytes read but discarded due to readahead",
219  "bytes" ))) {
220  free(fs->read_cntr);
221  free(fs->write_cntr);
222  free(fs);
223  return PAPI_ENOMEM;
224  }
225 
226  fs->next = NULL;
227 
228  /* Insert into the linked list */
229  /* Does this need locking? */
230  if ( root_lustre_fs == NULL ) {
231  root_lustre_fs = fs;
232  } else {
233  last = root_lustre_fs;
234 
235  while ( last->next != NULL )
236  last = last->next;
237 
238  last->next = fs;
239  }
240  return PAPI_OK;
241 }
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:125
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:497
fclose(thread_wqfd)
char * proc_file
Definition: linux-lustre.c:49
FILE * fff[MAX_EVENTS]
free(dummyfile[xx])
#define PAPI_ESYS
Definition: papi.h:255
#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:254
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 void host_finalize ( void  )
static

frees all allocated resources

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

388 {
389  int i;
390  lustre_fs *fs, *next_fs;
391  counter_info *cntr;
392 
393  for(i=0;i<num_events;i++) {
394  cntr=lustre_native_table[i];
395  if ( cntr != NULL ) {
396  free( cntr->name );
397  free( cntr->description );
398  free( cntr->unit );
399  free( cntr );
400  }
401  lustre_native_table[i]=NULL;
402  }
403 
404  fs = root_lustre_fs;
405 
406  while ( fs != NULL ) {
407  next_fs = fs->next;
408  free(fs->proc_file);
410  free( fs );
411  fs = next_fs;
412  }
413 
414  root_lustre_fs = NULL;
415 }
struct lustre_fs_struct * next
Definition: linux-lustre.c:54
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 int num_events
Definition: linux-lustre.c:88
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 248 of file linux-lustre.c.

249 {
250  SUBDBG("ENTER:\n");
251  char lustre_dir[PATH_MAX];
252  char path[PATH_MAX];
253  char path_readahead[PATH_MAX],path_stats[PATH_MAX];
254  char *ptr;
255  char fs_name[100];
256  int found_luster_fs = 0;
257  int idx = 0;
258  int tmp_fd;
259  DIR *proc_dir;
260  struct dirent *entry;
261 
262  sprintf(lustre_dir,"%s/llite",proc_base_path);
263 
264  proc_dir = opendir( lustre_dir );
265  if ( proc_dir == NULL ) {
266  SUBDBG("EXIT: PAPI_ESYS (Cannot open %s)\n",lustre_dir);
267  return PAPI_ESYS;
268  }
269 
270  while ( (entry = readdir( proc_dir )) != NULL ) {
271  memset( path, 0, PATH_MAX );
272  snprintf( path, PATH_MAX - 1, "%s/%s/stats", lustre_dir,
273  entry->d_name );
274  SUBDBG("checking for file %s\n", path);
275 
276  if ( ( tmp_fd = open( path, O_RDONLY ) ) == -1 ) {
277  SUBDBG("Path: %s, can not be opened.\n", path);
278  continue;
279  }
280 
281  close( tmp_fd );
282 
283  /* erase \r and \n at the end of path */
284  /* why is this necessary? */
285 
286  idx = strlen( path );
287  idx--;
288 
289  while ( path[idx] == '\r' || path[idx] == '\n' )
290  path[idx--] = 0;
291 
292  /* Lustre paths are of type server-UUID */
293 
294  idx = 0;
295 
296  ptr = strstr(path,"llite/") + 6;
297  if (ptr == NULL) {
298  SUBDBG("Path: %s, missing llite directory, performance event not created.\n", path);
299  continue;
300  }
301 
302  strncpy(fs_name, ptr, sizeof(fs_name)-1);
303  fs_name[sizeof(fs_name)-1] = '\0';
304 
305  SUBDBG("found Lustre FS: %s\n", fs_name);
306 
307  snprintf( path_stats, PATH_MAX - 1,
308  "%s/%s/stats",
309  lustre_dir,
310  entry->d_name );
311  SUBDBG("Found file %s\n", path_stats);
312 
313  snprintf( path_readahead, PATH_MAX - 1,
314  "%s/%s/read_ahead_stats",
315  lustre_dir,
316  entry->d_name );
317  SUBDBG("Now checking for file %s\n", path_readahead);
318 
319  strcpy( ptr, "read_ahead_stats" );
320  addLustreFS( fs_name, path_stats, path_readahead );
321  found_luster_fs++;
322  }
323  closedir( proc_dir );
324 
325  if (found_luster_fs == 0) {
326  SUBDBG("EXIT: PAPI_ESYS (No luster file systems found)\n");
327  return PAPI_ESYS;
328  }
329 
330  SUBDBG("EXIT: PAPI_OK\n");
331  return PAPI_OK;
332 }
sprintf(splash[splash_line++],"\tIozone: Performance Test of File I/O\n")
int close(int fd)
Definition: appio.c:175
return PAPI_OK
Definition: linux-nvml.c:497
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:255
#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:165
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 338 of file linux-lustre.c.

339 {
341  FILE *fff;
342  char buffer[BUFSIZ];
343 
344  while ( fs != NULL ) {
345 
346  /* read values from stats file */
347  fff=fopen(fs->proc_file,"r" );
348  if (fff != NULL) {
349  while(1) {
350  if (fgets(buffer,BUFSIZ,fff)==NULL) break;
351 
352  if (strstr( buffer, "write_bytes" )) {
353  sscanf(buffer,"%*s %*d %*s %*s %*d %*d %llu",&fs->write_cntr->value);
354  SUBDBG("Read %llu write_bytes\n",fs->write_cntr->value);
355  }
356 
357  if (strstr( buffer, "read_bytes" )) {
358  sscanf(buffer,"%*s %*d %*s %*s %*d %*d %llu",&fs->read_cntr->value);
359  SUBDBG("Read %llu read_bytes\n",fs->read_cntr->value);
360  }
361  }
362  fclose(fff);
363  }
364 
365  fff=fopen(fs->proc_file_readahead,"r");
366  if (fff != NULL) {
367  while(1) {
368  if (fgets(buffer,BUFSIZ,fff)==NULL) break;
369 
370  if (strstr( buffer, "read but discarded")) {
371  sscanf(buffer,"%*s %*s %*s %llu",&fs->readahead_cntr->value);
372  SUBDBG("Read %llu discared\n",fs->readahead_cntr->value);
373  break;
374  }
375  }
376  fclose(fff);
377  }
378  fs = fs->next;
379  }
380 }
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  SUBDBG("ENTER:\n");
101  counter_info** new_table;
102  int new_size = table_size*2;
103  new_table = (counter_info**)papi_calloc(new_size, sizeof(counter_info*));
104  if (NULL==new_table) {
105  SUBDBG("EXIT: PAPI_ENOMEM\n");
106  return PAPI_ENOMEM;
107  }
108  if ( lustre_native_table) {
109  memcpy(new_table, lustre_native_table, sizeof(counter_info*) * table_size );
111  }
112  lustre_native_table = new_table;
113  table_size*=2;
114  SUBDBG("EXIT: PAPI_OK\n");
115  return PAPI_OK;
116 }
#define papi_free(a)
Definition: papi_memory.h:35
static int table_size
Definition: linux-lustre.c:89
return PAPI_OK
Definition: linux-nvml.c:497
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
#define PAPI_ENOMEM
Definition: papi.h:254
static counter_info ** lustre_native_table
Definition: linux-lustre.c:87
#define papi_calloc(a, b)
Definition: papi_memory.h:37

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.