PAPI  5.3.2.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 657 of file linux-lustre.c.

658 {
659  ( void ) ctx;
660  ( void ) code;
661  ( void ) option;
662 
663  return PAPI_OK;
664 }
return PAPI_OK
Definition: linux-nvml.c:458
void
Definition: iozone.c:18627
int _lustre_init_component ( int  cidx)

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

435 {
436 
437  int ret = PAPI_OK;
438 
439  /* See if lustre filesystem exists */
440  ret=detect_lustre();
441  if (ret!=PAPI_OK) {
443  "No lustre filesystems found",PAPI_MAX_STR_LEN);
444  return ret;
445  }
446 
448  ret=init_lustre_counters();
449 
452 
453  return ret;
454 }
papi_vector_t _lustre_vector
Definition: linux-lustre.c:94
#define PAPI_MAX_STR_LEN
Definition: fpapi.h:43
static int num_events
return PAPI_OK
Definition: linux-nvml.c:458
static int detect_lustre()
Definition: linux-lustre.c:406
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:632
static int cidx
Definition: event_info.c:40
static int init_lustre_counters(void)
Definition: linux-lustre.c:239
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 502 of file linux-lustre.c.

503 {
504  LUSTRE_control_state_t *lustre_ctl = (LUSTRE_control_state_t *)ctl;
505 
506  memset(lustre_ctl->start_count,0,sizeof(long long)*LUSTRE_MAX_COUNTERS);
507  memset(lustre_ctl->current_count,0,sizeof(long long)*LUSTRE_MAX_COUNTERS);
508 
509  return PAPI_OK;
510 }
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 464 of file linux-lustre.c.

465 {
466  (void) ctx;
467 
468  return PAPI_OK;
469 }
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 
713  int event=EventCode;
714 
715  if (event >=0 && event < num_events) {
716  strncpy( name, lustre_native_table[event]->description, len );
717  return PAPI_OK;
718  }
719  return PAPI_ENOEVNT;
720 }
#define PAPI_ENOEVNT
Definition: fpapi.h:112
static int num_events
device[deviceId] domain[domainId] event
Definition: linux-cuda.c:306
return PAPI_OK
Definition: linux-nvml.c:458
char description[PAPI_MAX_STR_LEN]
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 693 of file linux-lustre.c.

694 {
695 
696  int event=EventCode;
697 
698  if (event >=0 && event < num_events) {
699  strncpy( name, lustre_native_table[event]->name, len );
700  return PAPI_OK;
701  }
702  return PAPI_ENOEVNT;
703 }
#define PAPI_ENOEVNT
Definition: fpapi.h:112
static int num_events
device[deviceId] domain[domainId] event
Definition: linux-cuda.c:306
return PAPI_OK
Definition: linux-nvml.c:458
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 727 of file linux-lustre.c.

728 {
729 
730  if ( modifier == PAPI_ENUM_FIRST ) {
731  if (num_events==0) return PAPI_ENOEVNT;
732  *EventCode = 0;
733  return PAPI_OK;
734  }
735 
736  if ( modifier == PAPI_ENUM_EVENTS ) {
737  int index = *EventCode;
738 
739  if ( lustre_native_table[index + 1] ) {
740  *EventCode = *EventCode + 1;
741  return PAPI_OK;
742  } else {
743  return PAPI_ENOEVNT;
744  }
745  }
746 
747 
748  return PAPI_EINVAL;
749 }
#define PAPI_ENOEVNT
Definition: fpapi.h:112
static int num_events
return PAPI_OK
Definition: linux-nvml.c:458
return PAPI_EINVAL
Definition: linux-nvml.c:408
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 592 of file linux-lustre.c.

594 {
595  (void) ctx;
596  ( void ) flags;
597 
598  LUSTRE_control_state_t *lustre_ctl = (LUSTRE_control_state_t *)ctl;
599  int i;
600 
602 
603  for(i=0;i<lustre_ctl->num_events;i++) {
604  lustre_ctl->current_count[i]=
605  lustre_native_table[lustre_ctl->which_counter[i]]->value;
606  lustre_ctl->difference[i]=lustre_ctl->current_count[i]-
607  lustre_ctl->start_count[i];
608  }
609 
610  *events = lustre_ctl->difference;
611 
612  return PAPI_OK;
613 
614 }
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
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
char events[MAX_EVENTS][BUFSIZ]
static counter_info ** lustre_native_table
Definition: linux-lustre.c:87
static void read_lustre_counter()
Definition: linux-lustre.c:322

Here is the call graph for this function:

int _lustre_reset ( hwd_context_t ctx,
hwd_control_state_t ctrl 
)

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

624 {
625 
626  /* re-initializes counter_start values to current */
627 
628  _lustre_start(ctx,ctrl);
629 
630  return PAPI_OK;
631 }
return PAPI_OK
Definition: linux-nvml.c:458
int _lustre_start(hwd_context_t *ctx, hwd_control_state_t *ctl)
Definition: linux-lustre.c:542

Here is the call graph for this function:

int _lustre_set_domain ( hwd_control_state_t cntrl,
int  domain 
)

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

679 {
680  ( void ) cntrl;
681  if ( PAPI_DOM_USER != domain ) {
682  return PAPI_EINVAL;
683  }
684 
685  return PAPI_OK;
686 }
return PAPI_OK
Definition: linux-nvml.c:458
void
Definition: iozone.c:18627
return PAPI_EINVAL
Definition: linux-nvml.c:408
#define PAPI_DOM_USER
Definition: fpapi.h:21
int _lustre_shutdown_component ( void  )

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

477 {
478 
479  host_finalize( );
481 
482  return PAPI_OK;
483 }
#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:371
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 489 of file linux-lustre.c.

490 {
491  ( void ) ctx;
492 
493  return PAPI_OK;
494 }
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 542 of file linux-lustre.c.

543 {
544  ( void ) ctx;
545 
546  LUSTRE_control_state_t *lustre_ctl = (LUSTRE_control_state_t *)ctl;
547  int i;
548 
550 
551  for(i=0;i<lustre_ctl->num_events;i++) {
552  lustre_ctl->current_count[i]=
553  lustre_native_table[lustre_ctl->which_counter[i]]->value;
554  }
555 
556  memcpy( lustre_ctl->start_count,
557  lustre_ctl->current_count,
558  LUSTRE_MAX_COUNTERS * sizeof ( long long ) );
559 
560  return PAPI_OK;
561 }
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:322

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

569 {
570 
571  (void) ctx;
572  LUSTRE_control_state_t *lustre_ctl = (LUSTRE_control_state_t *)ctl;
573  int i;
574 
576 
577  for(i=0;i<lustre_ctl->num_events;i++) {
578  lustre_ctl->current_count[i]=
579  lustre_native_table[lustre_ctl->which_counter[i]]->value;
580  }
581 
582  return PAPI_OK;
583 
584 }
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:322

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

521 {
522  LUSTRE_control_state_t *lustre_ctl = (LUSTRE_control_state_t *)ctl;
523  ( void ) ctx;
524  int i, index;
525 
526  for ( i = 0; i < count; i++ ) {
527  index = native[i].ni_event;
528  lustre_ctl->which_counter[i]=index;
529  native[i].ni_position = i;
530  }
531 
532  lustre_ctl->num_events=count;
533 
534  return PAPI_OK;
535 }
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
int _lustre_write ( hwd_context_t ctx,
hwd_control_state_t ctrl,
long long from 
)

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

639 {
640  ( void ) ctx;
641  ( void ) ctrl;
642  ( void ) from;
643 
644  return PAPI_OK;
645 }
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  counter_info *cntr;
124 
125  if ( num_events >= table_size )
126  if (PAPI_OK != resize_native_table())
127  return NULL;
128 
129  cntr = malloc( sizeof ( counter_info ) );
130 
131  if ( cntr == NULL ) {
132  SUBDBG("can not allocate memory for new counter\n" );
133  return NULL;
134  }
135 
136  cntr->idx=num_events;
137  cntr->name = strdup( name );
138  cntr->description = strdup( desc );
139  cntr->unit = strdup( unit );
140  cntr->value = 0;
141 
143 
144  num_events++;
145 
146  return cntr;
147 }
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 156 of file linux-lustre.c.

159 {
160  lustre_fs *fs, *last;
161  char counter_name[512];
162  FILE *fff;
163 
164  SUBDBG("Adding lustre fs\n");
165 
166  fs = malloc( sizeof ( lustre_fs ) );
167  if ( fs == NULL ) {
168  SUBDBG("can not allocate memory for new Lustre FS description\n" );
169  return PAPI_ENOMEM;
170  }
171 
172  fs->proc_file=strdup(procpath_general);
173  fff = fopen( procpath_general, "r" );
174  if ( fff == NULL ) {
175  SUBDBG("can not open '%s'\n", procpath_general );
176  free(fs);
177  return PAPI_ESYS;
178  }
179  fclose(fff);
180 
181  fs->proc_file_readahead = strdup(procpath_readahead);
182  fff = fopen( procpath_readahead, "r" );
183  if ( fff == NULL ) {
184  SUBDBG("can not open '%s'\n", procpath_readahead );
185  free(fs);
186  return PAPI_ESYS;
187  }
188  fclose(fff);
189 
190  sprintf( counter_name, "%s_llread", name );
191  if (NULL == (fs->read_cntr = addCounter( counter_name,
192  "bytes read on this lustre client",
193  "bytes" ))) {
194  free(fs);
195  return PAPI_ENOMEM;
196  }
197 
198  sprintf( counter_name, "%s_llwrite", name );
199  if ( NULL == (fs->write_cntr = addCounter( counter_name,
200  "bytes written on this lustre client",
201  "bytes" ))) {
202  free(fs->read_cntr);
203  free(fs);
204  return PAPI_ENOMEM;
205  }
206 
207  sprintf( counter_name, "%s_wrong_readahead", name );
208  if ( NULL == (fs->readahead_cntr = addCounter( counter_name,
209  "bytes read but discarded due to readahead",
210  "bytes" ))) {
211  free(fs->read_cntr);
212  free(fs->write_cntr);
213  free(fs);
214  return PAPI_ENOMEM;
215  }
216 
217  fs->next = NULL;
218 
219  /* Insert into the linked list */
220  /* Does this need locking? */
221  if ( root_lustre_fs == NULL ) {
222  root_lustre_fs = fs;
223  } else {
224  last = root_lustre_fs;
225 
226  while ( last->next != NULL )
227  last = last->next;
228 
229  last->next = fs;
230  }
231  return PAPI_OK;
232 }
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
#define PAPI_ENOMEM
Definition: fpapi.h:107
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 SUBDBG(format, args...)
Definition: papi_debug.h:63
counter_info * write_cntr
Definition: linux-lustre.c:51
static struct temp_event * last
#define PAPI_ESYS
Definition: fpapi.h:108
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 406 of file linux-lustre.c.

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

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

372 {
373  int i;
374  lustre_fs *fs, *next_fs;
375  counter_info *cntr;
376 
377  for(i=0;i<num_events;i++) {
378  cntr=lustre_native_table[i];
379  if ( cntr != NULL ) {
380  free( cntr->name );
381  free( cntr->description );
382  free( cntr->unit );
383  free( cntr );
384  }
385  lustre_native_table[i]=NULL;
386  }
387 
388  fs = root_lustre_fs;
389 
390  while ( fs != NULL ) {
391  next_fs = fs->next;
392  free(fs->proc_file);
394  free( fs );
395  fs = next_fs;
396  }
397 
398  root_lustre_fs = NULL;
399 }
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 239 of file linux-lustre.c.

240 {
241  char lustre_dir[PATH_MAX];
242  char path[PATH_MAX];
243  char path_readahead[PATH_MAX],path_stats[PATH_MAX];
244  char *ptr;
245  char fs_name[100];
246  int idx = 0;
247  int tmp_fd;
248  DIR *proc_dir;
249  struct dirent *entry;
250 
251  sprintf(lustre_dir,"%s/llite",proc_base_path);
252 
253  proc_dir = opendir( lustre_dir );
254  if ( proc_dir == NULL ) {
255  SUBDBG("Cannot open %s\n",lustre_dir);
256  return PAPI_ESYS;
257  }
258 
259  entry = readdir( proc_dir );
260 
261  while ( entry != NULL ) {
262  memset( path, 0, PATH_MAX );
263  snprintf( path, PATH_MAX - 1, "%s/%s/stats", lustre_dir,
264  entry->d_name );
265  SUBDBG("checking for file %s\n", path);
266 
267  if ( ( tmp_fd = open( path, O_RDONLY ) ) != -1 ) {
268  close( tmp_fd );
269 
270  /* erase \r and \n at the end of path */
271  /* why is this necessary? */
272 
273  idx = strlen( path );
274  idx--;
275 
276  while ( path[idx] == '\r' || path[idx] == '\n' )
277  path[idx--] = 0;
278 
279  /* Lustre paths are of type server-UUID */
280 
281  idx = 0;
282 
283  ptr = strstr(path,"llite/") + 6;
284 
285  while ( *ptr && idx < 100 ) {
286  fs_name[idx] = *ptr;
287  ptr++;
288  idx++;
289  }
290 
291  SUBDBG("found Lustre FS: %s\n", fs_name);
292 
293  snprintf( path_stats, PATH_MAX - 1,
294  "%s/%s/stats",
295  lustre_dir,
296  entry->d_name );
297  SUBDBG("Found file %s\n", path_stats);
298 
299  snprintf( path_readahead, PATH_MAX - 1,
300  "%s/%s/read_ahead_stats",
301  lustre_dir,
302  entry->d_name );
303  SUBDBG("Now checking for file %s\n", path_readahead);
304 
305 
306  strcpy( ptr, "read_ahead_stats" );
307  addLustreFS( fs_name, path_stats, path_readahead );
308 
309  }
310  entry = readdir( proc_dir );
311  }
312  closedir( proc_dir );
313 
314  return PAPI_OK;
315 
316 }
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 SUBDBG(format, args...)
Definition: papi_debug.h:63
const char proc_base_path[]
Definition: linux-lustre.c:84
#define PAPI_ESYS
Definition: fpapi.h:108
strcpy(filename, default_filename)
#define PATH_MAX
Definition: fileop.c:68
char path[PATH_MAX]
static int addLustreFS(const char *name, const char *procpath_general, const char *procpath_readahead)
Definition: linux-lustre.c:156
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 322 of file linux-lustre.c.

323 {
325  FILE *fff;
326  char buffer[BUFSIZ];
327 
328  while ( fs != NULL ) {
329 
330  /* read values from stats file */
331  fff=fopen(fs->proc_file,"r" );
332  if (fff != NULL) {
333  while(1) {
334  if (fgets(buffer,BUFSIZ,fff)==NULL) break;
335 
336  if (strstr( buffer, "write_bytes" )) {
337  sscanf(buffer,"%*s %*d %*s %*s %*d %*d %llu",&fs->write_cntr->value);
338  SUBDBG("Read %llu write_bytes\n",fs->write_cntr->value);
339  }
340 
341  if (strstr( buffer, "read_bytes" )) {
342  sscanf(buffer,"%*s %*d %*s %*s %*d %*d %llu",&fs->read_cntr->value);
343  SUBDBG("Read %llu read_bytes\n",fs->read_cntr->value);
344  }
345  }
346  fclose(fff);
347  }
348 
349  fff=fopen(fs->proc_file_readahead,"r");
350  if (fff != NULL) {
351  while(1) {
352  if (fgets(buffer,BUFSIZ,fff)==NULL) break;
353 
354  if (strstr( buffer, "read but discarded")) {
355  sscanf(buffer,"%*s %*s %*s %llu",&fs->readahead_cntr->value);
356  SUBDBG("Read %llu discared\n",fs->readahead_cntr->value);
357  break;
358  }
359  }
360  fclose(fff);
361  }
362  fs = fs->next;
363  }
364 }
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_ENOMEM
Definition: fpapi.h:107
#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
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.