PAPI  5.4.1.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)
 
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 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:458
void
Definition: iozone.c:18627
int _lustre_init_component ( int  cidx)

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
static int num_events
return PAPI_OK
Definition: linux-nvml.c:458
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
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
static int init_lustre_counters(void)
Definition: linux-lustre.c:248
#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 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: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
int _lustre_init_thread ( hwd_context_t ctx)

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:458
void
Definition: iozone.c:18627
int _lustre_ntv_code_to_descr ( unsigned int  EventCode,
char *  name,
int  len 
)

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

711 {
712  SUBDBG("ENTER: EventCode: %#x, name: %p, len: %d\n", EventCode, name, len);
713  int event=EventCode;
714 
715  if (event >=0 && event < num_events) {
716  strncpy( name, lustre_native_table[event]->description, len-1 );
717  name[len-1] = '\0';
718  SUBDBG("EXIT: description: %s\n", name);
719  return PAPI_OK;
720  }
721  SUBDBG("EXIT: PAPI_ENOEVNT\n");
722  return PAPI_ENOEVNT;
723 }
#define PAPI_ENOEVNT
Definition: papi.h:258
static int num_events
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 690 of file linux-lustre.c.

691 {
692  SUBDBG("ENTER: EventCode: %#x, name: %p, len: %d\n", EventCode, name, len);
693  int event=EventCode;
694 
695  if (event >=0 && event < num_events) {
696  strncpy( name, lustre_native_table[event]->name, len-1 );
697  name[len-1] = '\0';
698  SUBDBG("EXIT: event name: %s\n", name);
699  return PAPI_OK;
700  }
701  SUBDBG("EXIT: PAPI_ENOEVNT\n");
702  return PAPI_ENOEVNT;
703 }
#define PAPI_ENOEVNT
Definition: papi.h:258
static int num_events
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 730 of file linux-lustre.c.

731 {
732  SUBDBG("ENTER: EventCode: %p, modifier: %d\n", EventCode, modifier);
733 
734  if ( modifier == PAPI_ENUM_FIRST ) {
735  if (num_events==0) return PAPI_ENOEVNT;
736  *EventCode = 0;
737  SUBDBG("EXIT: *EventCode: %#x\n", *EventCode);
738  return PAPI_OK;
739  }
740 
741  if ( modifier == PAPI_ENUM_EVENTS ) {
742  int index = *EventCode;
743 
744  if ( lustre_native_table[index + 1] ) {
745  *EventCode = *EventCode + 1;
746  SUBDBG("EXIT: *EventCode: %#x\n", *EventCode);
747  return PAPI_OK;
748  } else {
749  SUBDBG("EXIT: PAPI_ENOEVNT\n");
750  return PAPI_ENOEVNT;
751  }
752  }
753 
754 
755  SUBDBG("EXIT: PAPI_EINVAL\n");
756  return PAPI_EINVAL;
757 }
#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 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: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:338

Here is the call graph for this function:

int _lustre_reset ( hwd_context_t ctx,
hwd_control_state_t ctrl 
)

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 }
return PAPI_OK
Definition: linux-nvml.c:458
int _lustre_start(hwd_context_t *ctx, hwd_control_state_t *ctl)
Definition: linux-lustre.c:538

Here is the call graph for this function:

int _lustre_set_domain ( hwd_control_state_t cntrl,
int  domain 
)

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

676 {
677  SUBDBG("ENTER: cntrl: %p, domain: %#x\n", cntrl, domain);
678 
679  // this component does not allow limiting which domains will increment event counts
680 
681  SUBDBG("EXIT: PAPI_OK\n");
682  return PAPI_OK;
683 }
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 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 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
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:

int _lustre_shutdown_thread ( hwd_context_t ctx)

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:458
void
Definition: iozone.c:18627
int _lustre_start ( hwd_context_t ctx,
hwd_control_state_t ctl 
)

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: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:338

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 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: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:338

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 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: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 634 of file linux-lustre.c.

635 {
636  ( void ) ctx;
637  ( void ) ctrl;
638  ( void ) from;
639 
640  return PAPI_OK;
641 }
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 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 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 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: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 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
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 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: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: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_malloc(sizeof(counter_info*) * new_size);
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
#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 SUBDBG(format, args...)
Definition: papi_debug.h:63
#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.