Commit ec0fcc53 authored by Shane Snyder's avatar Shane Snyder

slew of modifications for porting lustre mod over

parent 7d8ebfa0
......@@ -45,8 +45,7 @@ enum darshan_lustre_indices
*/
struct darshan_lustre_record
{
darshan_record_id rec_id;
int64_t rank;
struct darshan_base_record base_rec;
int64_t counters[LUSTRE_NUM_INDICES];
OST_ID ost_ids[1];
};
......
struct lustre_record_runtime
struct lustre_record_ref
{
struct darshan_lustre_record *record;
size_t record_size;
UT_hash_handle hlink;
};
struct lustre_runtime
{
int record_count; /* number of records defined */
size_t record_buffer_max; /* size of the allocated buffer pointed to by record_buffer */
size_t record_buffer_used; /* size of the allocated buffer actually used */
void *next_free_record; /* pointer to end of record_buffer */
void *record_buffer; /* buffer in which records are created */
struct lustre_record_runtime *record_runtime_array;
struct lustre_record_runtime *record_runtime_hash;
int record_count; /* number of records stored in record_id_hash */
void *record_id_hash;
int record_buffer_size; /* size of record_buffer in bytes */
void *record_buffer;
int record_ref_array_ndx; /* current index into record_ref_array */
struct lustre_record_ref **record_ref_array;
};
This diff is collapsed.
......@@ -121,7 +121,6 @@ struct posix_file_record_ref
int access_count;
void *stride_root;
int stride_count;
int fs_type; /* same as darshan_fs_info->fs_type */
struct posix_aio_tracker* aio_list;
};
......@@ -147,7 +146,7 @@ struct posix_aio_tracker
static void posix_runtime_initialize(
void);
static struct posix_file_record_ref *posix_track_new_file_record(
darshan_record_id rec_id, const char *path);
darshan_record_id rec_id, const char *path, int fd);
static void posix_aio_tracker_add(
int fd, void *aiocbp);
static struct posix_aio_tracker* posix_aio_tracker_del(
......@@ -166,10 +165,12 @@ static void posix_shutdown(
MPI_Comm mod_comm, darshan_record_id *shared_recs,
int shared_rec_count, void **posix_buf, int *posix_buf_sz);
#ifdef DARSHAN_LUSTRE
/* XXX modules don't expose an API for other modules, so use extern to get
* Lustre instrumentation function
*/
extern void darshan_instrument_lustre_file(const char *filepath, int fd);
#endif
static struct posix_runtime *posix_runtime = NULL;
static pthread_mutex_t posix_runtime_mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
......@@ -206,7 +207,7 @@ static int darshan_mem_alignment = 1;
} \
rec_id = darshan_core_gen_record_id(newpath); \
rec_ref = darshan_lookup_record_ref(posix_runtime->rec_id_hash, &rec_id, sizeof(darshan_record_id)); \
if(!rec_ref) rec_ref = posix_track_new_file_record(rec_id, newpath); \
if(!rec_ref) rec_ref = posix_track_new_file_record(rec_id, newpath, __ret); \
if(!rec_ref) { \
if(newpath != __path) free(newpath); \
break; \
......@@ -226,8 +227,6 @@ static int darshan_mem_alignment = 1;
DARSHAN_TIMER_INC_NO_OVERLAP(rec_ref->file_rec->fcounters[POSIX_F_META_TIME], \
__tm1, __tm2, rec_ref->last_meta_end); \
darshan_add_record_ref(&(posix_runtime->fd_hash), &__ret, sizeof(int), rec_ref); \
if(rec_ref->fs_type == LL_SUPER_MAGIC) \
darshan_instrument_lustre_file(__path, __ret); \
if(newpath != __path) free(newpath); \
} while(0)
......@@ -356,7 +355,7 @@ static int darshan_mem_alignment = 1;
} \
rec_id = darshan_core_gen_record_id(newpath); \
rec_ref = darshan_lookup_record_ref(posix_runtime->rec_id_hash, &rec_id, sizeof(darshan_record_id)); \
if(!rec_ref) rec_ref = posix_track_new_file_record(rec_id, newpath); \
if(!rec_ref) rec_ref = posix_track_new_file_record(rec_id, newpath, -1); \
if(newpath != __path) free(newpath); \
if(rec_ref) { \
POSIX_RECORD_STAT(rec_ref, __statbuf, __tm1, __tm2); \
......@@ -1452,7 +1451,7 @@ static void posix_runtime_initialize()
}
static struct posix_file_record_ref *posix_track_new_file_record(
darshan_record_id rec_id, const char *path)
darshan_record_id rec_id, const char *path, int fd)
{
struct darshan_posix_file *file_rec = NULL;
struct posix_file_record_ref *rec_ref = NULL;
......@@ -1497,9 +1496,17 @@ static struct posix_file_record_ref *posix_track_new_file_record(
file_rec->counters[POSIX_MEM_ALIGNMENT] = darshan_mem_alignment;
file_rec->counters[POSIX_FILE_ALIGNMENT] = fs_info.block_size;
rec_ref->file_rec = file_rec;
rec_ref->fs_type = fs_info.fs_type;
posix_runtime->file_rec_count++;
if(fd >= 0)
{
#ifdef DARSHAN_LUSTRE
/* allow lustre to generate a record if we configured with lustre support */
if(fs_info.fs_type == LL_SUPER_MAGIC)
darshan_instrument_lustre_file(path, fd);
#endif
}
return(rec_ref);
}
......
This diff is collapsed.
......@@ -341,14 +341,6 @@ int main(int argc, char **argv)
return(-1);
}
mod_buf = malloc(DEF_MOD_BUF_SIZE);
if (!mod_buf)
{
darshan_log_close(infile);
darshan_log_close(outfile);
return(-1);
}
/* loop over each module and convert it's data to the new format */
for(i=0; i<DARSHAN_MAX_MODS; i++)
{
......@@ -375,7 +367,6 @@ int main(int argc, char **argv)
darshan_log_close(infile);
darshan_log_close(outfile);
unlink(outfile_name);
free(mod_buf);
return(-1);
}
......@@ -398,7 +389,6 @@ int main(int argc, char **argv)
}
} while((ret = mod_logutils[i]->log_get_record(infile, mod_buf)) == 1);
}
free(mod_buf);
darshan_log_close(infile);
darshan_log_close(outfile);
......
......@@ -13,8 +13,6 @@
#include "darshan-logutils.h"
#include "uthash-1.9.2/src/uthash.h"
#define DEF_MOD_BUF_SIZE 1024 /* 1 KiB is enough for all current mod records ... */
struct darshan_mod_record_ref
{
int rank;
......
......@@ -24,8 +24,7 @@ char *lustre_counter_names[] = {
};
#undef X
static int darshan_log_get_lustre_record(darshan_fd fd, void* lustre_buf,
darshan_record_id* rec_id);
static int darshan_log_get_lustre_record(darshan_fd fd, void* lustre_buf);
static int darshan_log_put_lustre_record(darshan_fd fd, void* lustre_buf, int ver);
static void darshan_log_print_lustre_record(void *file_rec,
char *file_name, char *mnt_pt, char *fs_type, int ver);
......@@ -42,15 +41,14 @@ struct darshan_mod_logutil_funcs lustre_logutils =
.log_print_diff = &darshan_log_print_lustre_record_diff
};
static int darshan_log_get_lustre_record(darshan_fd fd, void* lustre_buf,
darshan_record_id* rec_id)
static int darshan_log_get_lustre_record(darshan_fd fd, void* lustre_buf)
{
struct darshan_lustre_record *rec;
int i;
int ret;
/* retrieve the fixed-size portion of the record */
ret = darshan_log_getmod(fd, DARSHAN_LUSTRE_MOD, lustre_buf,
ret = darshan_log_get_mod(fd, DARSHAN_LUSTRE_MOD, lustre_buf,
sizeof(struct darshan_lustre_record));
if(ret < 0)
return(-1);
......@@ -62,15 +60,16 @@ static int darshan_log_get_lustre_record(darshan_fd fd, void* lustre_buf,
/* swap bytes if necessary */
if(fd->swap_flag)
{
DARSHAN_BSWAP64(&rec->rec_id);
DARSHAN_BSWAP64(&rec->rank);
DARSHAN_BSWAP64(&rec->base_rec.id);
DARSHAN_BSWAP64(&rec->base_rec.rank);
for(i=0; i<LUSTRE_NUM_INDICES; i++)
DARSHAN_BSWAP64(&rec->counters[i]);
DARSHAN_BSWAP64(&(rec->ost_ids[0]));
}
/* now read the rest of the record */
if ( rec->counters[LUSTRE_STRIPE_WIDTH] > 1 ) {
ret = darshan_log_getmod(
ret = darshan_log_get_mod(
fd,
DARSHAN_LUSTRE_MOD,
(void*)(&(rec->ost_ids[1])),
......@@ -86,7 +85,6 @@ static int darshan_log_get_lustre_record(darshan_fd fd, void* lustre_buf,
DARSHAN_BSWAP64(&(rec->ost_ids[i]));
}
*rec_id = rec->rec_id;
return(1);
}
......@@ -95,7 +93,7 @@ static int darshan_log_put_lustre_record(darshan_fd fd, void* lustre_buf, int ve
struct darshan_lustre_record *rec = (struct darshan_lustre_record *)lustre_buf;
int ret;
ret = darshan_log_putmod(fd, DARSHAN_LUSTRE_MOD, rec,
ret = darshan_log_put_mod(fd, DARSHAN_LUSTRE_MOD, rec,
LUSTRE_RECORD_SIZE(rec->counters[LUSTRE_STRIPE_WIDTH]), ver);
if(ret < 0)
return(-1);
......@@ -113,7 +111,7 @@ static void darshan_log_print_lustre_record(void *rec, char *file_name,
for(i=0; i<LUSTRE_NUM_INDICES; i++)
{
DARSHAN_COUNTER_PRINT(darshan_module_names[DARSHAN_LUSTRE_MOD],
lustre_rec->rank, lustre_rec->rec_id, lustre_counter_names[i],
lustre_rec->base_rec.rank, lustre_rec->base_rec.id, lustre_counter_names[i],
lustre_rec->counters[i], file_name, mnt_pt, fs_type);
}
......@@ -122,8 +120,8 @@ static void darshan_log_print_lustre_record(void *rec, char *file_name,
char strbuf[25];
snprintf( strbuf, 25, "LUSTRE_OST_ID_%d", i );
DARSHAN_COUNTER_PRINT(darshan_module_names[DARSHAN_LUSTRE_MOD],
lustre_rec->rank,
lustre_rec->rec_id,
lustre_rec->base_rec.rank,
lustre_rec->base_rec.id,
strbuf,
lustre_rec->ost_ids[i],
file_name,
......@@ -165,27 +163,27 @@ static void darshan_log_print_lustre_record_diff(void *rec1, char *file_name1,
{
printf("- ");
DARSHAN_COUNTER_PRINT(darshan_module_names[DARSHAN_LUSTRE_MOD],
lustre_rec1->rank, lustre_rec1->rec_id, lustre_counter_names[i],
lustre_rec1->counters[i], file_name1, "", "");
lustre_rec1->base_rec.rank, lustre_rec1->base_rec.id,
lustre_counter_names[i], lustre_rec1->counters[i], file_name1, "", "");
}
else if(!lustre_rec1)
{
printf("+ ");
DARSHAN_COUNTER_PRINT(darshan_module_names[DARSHAN_LUSTRE_MOD],
lustre_rec2->rank, lustre_rec2->rec_id, lustre_counter_names[i],
lustre_rec2->counters[i], file_name2, "", "");
lustre_rec2->base_rec.rank, lustre_rec2->base_rec.id,
lustre_counter_names[i], lustre_rec2->counters[i], file_name2, "", "");
}
else if(lustre_rec1->counters[i] != lustre_rec2->counters[i])
{
printf("- ");
DARSHAN_COUNTER_PRINT(darshan_module_names[DARSHAN_LUSTRE_MOD],
lustre_rec1->rank, lustre_rec1->rec_id, lustre_counter_names[i],
lustre_rec1->counters[i], file_name1, "", "");
lustre_rec1->base_rec.rank, lustre_rec1->base_rec.id,
lustre_counter_names[i], lustre_rec1->counters[i], file_name1, "", "");
printf("+ ");
DARSHAN_COUNTER_PRINT(darshan_module_names[DARSHAN_LUSTRE_MOD],
lustre_rec2->rank, lustre_rec2->rec_id, lustre_counter_names[i],
lustre_rec2->counters[i], file_name2, "", "");
lustre_rec2->base_rec.rank, lustre_rec2->base_rec.id,
lustre_counter_names[i], lustre_rec2->counters[i], file_name2, "", "");
}
}
......@@ -199,8 +197,8 @@ static void darshan_log_print_lustre_record_diff(void *rec1, char *file_name1,
snprintf( strbuf, 25, "LUSTRE_OST_ID_%d", i );
printf("- ");
DARSHAN_COUNTER_PRINT(darshan_module_names[DARSHAN_LUSTRE_MOD],
lustre_rec1->rank,
lustre_rec1->rec_id,
lustre_rec1->base_rec.rank,
lustre_rec1->base_rec.id,
strbuf,
lustre_rec1->ost_ids[i],
file_name1,
......@@ -208,8 +206,8 @@ static void darshan_log_print_lustre_record_diff(void *rec1, char *file_name1,
"");
printf("+ ");
DARSHAN_COUNTER_PRINT(darshan_module_names[DARSHAN_LUSTRE_MOD],
lustre_rec2->rank,
lustre_rec2->rec_id,
lustre_rec2->base_rec.rank,
lustre_rec2->base_rec.id,
strbuf,
lustre_rec2->ost_ids[i],
file_name2,
......
......@@ -9,8 +9,6 @@
#include "darshan-logutils.h"
#define DEF_MOD_BUF_SIZE 1024 /* 1 KiB is enough for all current mod records ... */
struct darshan_shared_record_ref
{
darshan_record_id id;
......
......@@ -54,9 +54,6 @@
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment