A component for the luster filesystem.
More...
Go to the source code of this file.
|
| static int | resize_native_table () |
| |
| static counter_info * | addCounter (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) |
| |
◆ LUSTRE_MAX_COUNTER_TERMS
◆ LUSTRE_MAX_COUNTERS
| #define LUSTRE_MAX_COUNTERS 100 |
◆ LUSTRE_native_event_entry_t
◆ LUSTRE_reg_alloc_t
◆ LUSTRE_register_t
◆ _lustre_ctl()
◆ _lustre_init_component()
| static int _lustre_init_component |
( |
int |
cidx | ) |
|
|
static |
Definition at line 443 of file linux-lustre.c.
char disabled_reason[PAPI_MAX_STR_LEN]
papi_vector_t _lustre_vector
PAPI_component_info_t cmp_info
#define SUBDBG(format, args...)
static void host_finalize(void)
static int init_lustre_counters(void)
static int resize_native_table()
◆ _lustre_init_control_state()
Definition at line 510 of file linux-lustre.c.
#define LUSTRE_MAX_COUNTERS
long long current_count[LUSTRE_MAX_COUNTERS]
long long start_count[LUSTRE_MAX_COUNTERS]
◆ _lustre_init_thread()
◆ _lustre_ntv_code_to_descr()
| static int _lustre_ntv_code_to_descr |
( |
unsigned int |
EventCode, |
|
|
char * |
name, |
|
|
int |
len |
|
) |
| |
|
static |
Definition at line 725 of file linux-lustre.c.
727 SUBDBG(
"ENTER: EventCode: %#x, name: %p, len: %d\n", EventCode,
name, len);
736 SUBDBG(
"EXIT: PAPI_ENOEVNT\n");
#define SUBDBG(format, args...)
static counter_info ** lustre_native_table
◆ _lustre_ntv_code_to_name()
| static int _lustre_ntv_code_to_name |
( |
unsigned int |
EventCode, |
|
|
char * |
name, |
|
|
int |
len |
|
) |
| |
|
static |
Definition at line 705 of file linux-lustre.c.
707 SUBDBG(
"ENTER: EventCode: %#x, name: %p, len: %d\n", EventCode,
name, len);
716 SUBDBG(
"EXIT: PAPI_ENOEVNT\n");
#define SUBDBG(format, args...)
static counter_info ** lustre_native_table
◆ _lustre_ntv_enum_events()
| static int _lustre_ntv_enum_events |
( |
unsigned int * |
EventCode, |
|
|
int |
modifier |
|
) |
| |
|
static |
Definition at line 745 of file linux-lustre.c.
747 SUBDBG(
"ENTER: EventCode: %p, modifier: %d\n", EventCode, modifier);
752 SUBDBG(
"EXIT: *EventCode: %#x\n", *EventCode);
757 int index = *EventCode;
760 *EventCode = *EventCode + 1;
761 SUBDBG(
"EXIT: *EventCode: %#x\n", *EventCode);
764 SUBDBG(
"EXIT: PAPI_ENOEVNT\n");
770 SUBDBG(
"EXIT: PAPI_EINVAL\n");
#define SUBDBG(format, args...)
static counter_info ** lustre_native_table
◆ _lustre_read()
Definition at line 601 of file linux-lustre.c.
long long difference[LUSTRE_MAX_COUNTERS]
char events[MAX_EVENTS][BUFSIZ]
int which_counter[LUSTRE_MAX_COUNTERS]
long long current_count[LUSTRE_MAX_COUNTERS]
long long start_count[LUSTRE_MAX_COUNTERS]
static counter_info ** lustre_native_table
static void read_lustre_counter()
◆ _lustre_reset()
Definition at line 632 of file linux-lustre.c.
static int _lustre_start(hwd_context_t *ctx, hwd_control_state_t *ctl)
◆ _lustre_set_domain()
◆ _lustre_shutdown_component()
| static int _lustre_shutdown_component |
( |
void |
| ) |
|
|
static |
Definition at line 485 of file linux-lustre.c.
#define SUBDBG(format, args...)
static void host_finalize(void)
◆ _lustre_shutdown_thread()
◆ _lustre_start()
Definition at line 551 of file linux-lustre.c.
int which_counter[LUSTRE_MAX_COUNTERS]
#define LUSTRE_MAX_COUNTERS
long long current_count[LUSTRE_MAX_COUNTERS]
long long start_count[LUSTRE_MAX_COUNTERS]
static counter_info ** lustre_native_table
static void read_lustre_counter()
◆ _lustre_stop()
Definition at line 577 of file linux-lustre.c.
int which_counter[LUSTRE_MAX_COUNTERS]
long long current_count[LUSTRE_MAX_COUNTERS]
static counter_info ** lustre_native_table
static void read_lustre_counter()
◆ _lustre_update_control_state()
Definition at line 525 of file linux-lustre.c.
530 SUBDBG(
"ENTER: ctl: %p, native: %p, count: %d, ctx: %p\n", ctl,
native,
count, ctx);
542 SUBDBG(
"EXIT: PAPI_OK\n");
int which_counter[LUSTRE_MAX_COUNTERS]
#define SUBDBG(format, args...)
◆ addCounter()
| static counter_info* addCounter |
( |
const char * |
name, |
|
|
const char * |
desc, |
|
|
const char * |
unit |
|
) |
| |
|
static |
add a counter to the list of available counters
- Parameters
-
| name | the short name of the counter |
| desc | a longer description |
| unit | the unit for this counter |
Definition at line 125 of file linux-lustre.c.
127 SUBDBG(
"ENTER: name: %s, desc: %s, unit: %s\n",
name, desc, unit);
133 SUBDBG(
"EXIT: can not resize native table\n" );
139 if ( cntr == NULL ) {
140 SUBDBG(
"EXIT: can not allocate memory for new counter\n" );
147 cntr->
unit = strdup( unit );
154 SUBDBG(
"EXIT: cntr: %p\n", cntr);
#define SUBDBG(format, args...)
static counter_info ** lustre_native_table
static int resize_native_table()
◆ addLustreFS()
| 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
-
| name | fs name |
| procpath_general | path to the 'stats' file in /proc/fs/lustre/... for this fs |
| procpath_readahead | path to the 'readahead' file in /proc/fs/lustre/... for this fs |
Definition at line 165 of file linux-lustre.c.
170 char counter_name[512];
173 SUBDBG(
"Adding lustre fs\n");
177 SUBDBG(
"can not allocate memory for new Lustre FS description\n" );
182 fff = fopen( procpath_general,
"r" );
184 SUBDBG(
"can not open '%s'\n", procpath_general );
192 fff = fopen( procpath_readahead,
"r" );
194 SUBDBG(
"can not open '%s'\n", procpath_readahead );
202 sprintf( counter_name,
"%s_llread",
name );
204 "bytes read on this lustre client",
212 sprintf( counter_name,
"%s_llwrite",
name );
214 "bytes written on this lustre client",
223 sprintf( counter_name,
"%s_wrong_readahead",
name );
225 "bytes read but discarded due to readahead",
struct lustre_fs_struct * next
static counter_info * addCounter(const char *name, const char *desc, const char *unit)
char * proc_file_readahead
#define SUBDBG(format, args...)
counter_info * write_cntr
static struct temp_event * last
static lustre_fs * root_lustre_fs
counter_info * readahead_cntr
◆ host_finalize()
| static void host_finalize |
( |
void |
| ) |
|
|
static |
frees all allocated resources
Definition at line 396 of file linux-lustre.c.
404 if ( cntr != NULL ) {
420 while ( fs != NULL ) {
struct lustre_fs_struct * next
char * proc_file_readahead
counter_info * write_cntr
static lustre_fs * root_lustre_fs
static counter_info ** lustre_native_table
◆ init_lustre_counters()
| static int init_lustre_counters |
( |
void |
| ) |
|
|
static |
goes through proc and tries to discover all mounted Lustre fs
Definition at line 257 of file linux-lustre.c.
265 int found_luster_fs = 0;
269 struct dirent *entry;
273 proc_dir = opendir( lustre_dir );
274 if ( proc_dir == NULL ) {
275 SUBDBG(
"EXIT: PAPI_ESYS (Cannot open %s)\n",lustre_dir);
279 while ( (entry = readdir( proc_dir )) != NULL ) {
281 snprintf( path,
PATH_MAX - 1,
"%s/%s/stats", lustre_dir,
283 SUBDBG(
"checking for file %s\n", path);
285 if ( ( tmp_fd =
open( path, O_RDONLY ) ) == -1 ) {
286 SUBDBG(
"Path: %s, can not be opened.\n", path);
295 idx = strlen( path );
298 while ( path[idx] ==
'\r' || path[idx] ==
'\n' )
305 ptr = strstr(path,
"llite/") + 6;
307 SUBDBG(
"Path: %s, missing llite directory, performance event not created.\n", path);
311 strncpy(fs_name, ptr,
sizeof(fs_name)-1);
312 fs_name[
sizeof(fs_name)-1] =
'\0';
314 SUBDBG(
"found Lustre FS: %s\n", fs_name);
320 SUBDBG(
"Found file %s\n", path_stats);
322 snprintf( path_readahead,
PATH_MAX - 1,
323 "%s/%s/read_ahead_stats",
326 SUBDBG(
"Now checking for file %s\n", path_readahead);
328 strcpy( ptr,
"read_ahead_stats" );
329 addLustreFS( fs_name, path_stats, path_readahead );
332 closedir( proc_dir );
334 if (found_luster_fs == 0) {
335 SUBDBG(
"EXIT: PAPI_ESYS (No luster file systems found)\n");
339 SUBDBG(
"EXIT: PAPI_OK\n");
int open(const char *pathname, int flags, mode_t mode)
#define SUBDBG(format, args...)
const char proc_base_path[]
static int addLustreFS(const char *name, const char *procpath_general, const char *procpath_readahead)
◆ read_lustre_counter()
| static void read_lustre_counter |
( |
| ) |
|
|
static |
updates all Lustre related counters
Definition at line 347 of file linux-lustre.c.
353 while ( fs != NULL ) {
359 if (fgets(
buffer,BUFSIZ,
fff)==NULL)
break;
361 if (strstr(
buffer,
"write_bytes" )) {
366 if (strstr(
buffer,
"read_bytes" )) {
377 if (fgets(
buffer,BUFSIZ,
fff)==NULL)
break;
379 if (strstr(
buffer,
"read but discarded")) {
struct lustre_fs_struct * next
char * proc_file_readahead
#define SUBDBG(format, args...)
counter_info * write_cntr
static lustre_fs * root_lustre_fs
counter_info * readahead_cntr
◆ resize_native_table()
| static int resize_native_table |
( |
| ) |
|
|
static |
Definition at line 99 of file linux-lustre.c.
104 if (NULL==new_table) {
105 SUBDBG(
"EXIT: PAPI_ENOMEM\n");
114 SUBDBG(
"EXIT: PAPI_OK\n");
#define SUBDBG(format, args...)
static counter_info ** lustre_native_table
#define papi_calloc(a, b)
◆ _lustre_vector
◆ lustre_native_table
◆ num_events
◆ proc_base_path
| const char proc_base_path[] = "/proc/fs/lustre/" |
◆ root_lustre_fs
◆ table_size