Commit be3912a8 authored by Shane Snyder's avatar Shane Snyder

update utilities and log format to use base rec

parent ed103a2a
......@@ -53,8 +53,7 @@ enum darshan_bgq_f_indices
*/
struct darshan_bgq_record
{
darshan_record_id f_id;
int64_t rank;
struct darshan_base_record base_rec;
int alignment;
int64_t counters[BGQ_NUM_INDICES];
double fcounters[BGQ_F_NUM_INDICES];
......
......@@ -47,8 +47,7 @@ enum darshan_hdf5_f_indices
*/
struct darshan_hdf5_file
{
darshan_record_id f_id;
int64_t rank;
struct darshan_base_record base_rec;
int64_t counters[HDF5_NUM_INDICES];
double fcounters[HDF5_F_NUM_INDICES];
};
......
......@@ -146,8 +146,7 @@ enum darshan_mpiio_f_indices
*/
struct darshan_mpiio_file
{
darshan_record_id f_id;
int64_t rank;
struct darshan_base_record base_rec;
int64_t counters[MPIIO_NUM_INDICES];
double fcounters[MPIIO_F_NUM_INDICES];
};
......
......@@ -50,8 +50,7 @@ enum darshan_null_f_indices
*/
struct darshan_null_record
{
darshan_record_id f_id;
int64_t rank;
struct darshan_base_record base_rec;
int64_t counters[NULL_NUM_INDICES];
double fcounters[NULL_F_NUM_INDICES];
};
......
......@@ -49,8 +49,7 @@ enum darshan_pnetcdf_f_indices
*/
struct darshan_pnetcdf_file
{
darshan_record_id f_id;
int64_t rank;
struct darshan_base_record base_rec;
int64_t counters[PNETCDF_NUM_INDICES];
double fcounters[PNETCDF_F_NUM_INDICES];
};
......
......@@ -38,7 +38,6 @@ int process_log(const char *fname, double *io_ratio, int *used_mpio, int *used_p
struct darshan_job job;
struct darshan_mod_logutil_funcs *psx_mod = mod_logutils[DARSHAN_POSIX_MOD];
struct darshan_posix_file psx_rec;
darshan_record_id rec_id;
int f_count;
double total_io_time;
double total_job_time;
......@@ -64,7 +63,7 @@ int process_log(const char *fname, double *io_ratio, int *used_mpio, int *used_p
f_count = 0;
total_io_time = 0.0;
while((ret = psx_mod->log_get_record(file, &psx_rec, &rec_id)) == 1)
while((ret = psx_mod->log_get_record(file, &psx_rec)) == 1)
{
f_count += 1;
......
......@@ -30,8 +30,7 @@ char *bgq_f_counter_names[] = {
};
#undef X
static int darshan_log_get_bgq_rec(darshan_fd fd, void* bgq_buf,
darshan_record_id* rec_id);
static int darshan_log_get_bgq_rec(darshan_fd fd, void* bgq_buf);
static int darshan_log_put_bgq_rec(darshan_fd fd, void* bgq_buf);
static void darshan_log_print_bgq_rec(void *file_rec,
char *file_name, char *mnt_pt, char *fs_type);
......@@ -43,8 +42,7 @@ struct darshan_mod_logutil_funcs bgq_logutils =
.log_print_record = &darshan_log_print_bgq_rec,
};
static int darshan_log_get_bgq_rec(darshan_fd fd, void* bgq_buf,
darshan_record_id* rec_id)
static int darshan_log_get_bgq_rec(darshan_fd fd, void* bgq_buf)
{
struct darshan_bgq_record *rec;
int i;
......@@ -62,15 +60,14 @@ static int darshan_log_get_bgq_rec(darshan_fd fd, void* bgq_buf,
if(fd->swap_flag)
{
/* swap bytes if necessary */
DARSHAN_BSWAP64(&rec->f_id);
DARSHAN_BSWAP64(&rec->rank);
DARSHAN_BSWAP64(&(rec->base_rec.id));
DARSHAN_BSWAP64(&(rec->base_rec.rank));
for(i=0; i<BGQ_NUM_INDICES; i++)
DARSHAN_BSWAP64(&rec->counters[i]);
for(i=0; i<BGQ_F_NUM_INDICES; i++)
DARSHAN_BSWAP64(&rec->fcounters[i]);
}
*rec_id = rec->f_id;
return(1);
}
}
......@@ -98,15 +95,17 @@ static void darshan_log_print_bgq_rec(void *file_rec, char *file_name,
for(i=0; i<BGQ_NUM_INDICES; i++)
{
DARSHAN_COUNTER_PRINT(darshan_module_names[DARSHAN_BGQ_MOD],
bgq_file_rec->rank, bgq_file_rec->f_id, bgq_counter_names[i],
bgq_file_rec->counters[i], file_name, mnt_pt, fs_type);
bgq_file_rec->base_rec.rank, bgq_file_rec->base_rec.id,
bgq_counter_names[i], bgq_file_rec->counters[i],
file_name, mnt_pt, fs_type);
}
for(i=0; i<BGQ_F_NUM_INDICES; i++)
{
DARSHAN_F_COUNTER_PRINT(darshan_module_names[DARSHAN_BGQ_MOD],
bgq_file_rec->rank, bgq_file_rec->f_id, bgq_f_counter_names[i],
bgq_file_rec->fcounters[i], file_name, mnt_pt, fs_type);
bgq_file_rec->base_rec.rank, bgq_file_rec->base_rec.id,
bgq_f_counter_names[i], bgq_file_rec->fcounters[i],
file_name, mnt_pt, fs_type);
}
return;
......
......@@ -342,7 +342,7 @@ int main(int argc, char **argv)
/* loop over each module and convert it's data to the new format */
for(i=0; i<DARSHAN_MAX_MODS; i++)
{
darshan_record_id rec_id;
struct darshan_base_record *base_rec;
/* check each module for any data */
if(infile->mod_map[i].len == 0)
......@@ -357,7 +357,7 @@ int main(int argc, char **argv)
/* we have module data to convert */
memset(mod_buf, 0, DEF_MOD_BUF_SIZE);
ret = mod_logutils[i]->log_get_record(infile, mod_buf, &rec_id);
ret = mod_logutils[i]->log_get_record(infile, mod_buf);
if(ret != 1)
{
fprintf(stderr, "Error: failed to parse the first %s module record.\n",
......@@ -371,7 +371,9 @@ int main(int argc, char **argv)
/* loop over each of the module's records and convert */
do
{
if(!hash || hash == rec_id)
base_rec = (struct darshan_base_record *)mod_buf;
if(!hash || hash == base_rec->id)
{
ret = mod_logutils[i]->log_put_record(outfile, mod_buf);
if(ret < 0)
......@@ -383,7 +385,7 @@ int main(int argc, char **argv)
memset(mod_buf, 0, DEF_MOD_BUF_SIZE);
}
} while((ret = mod_logutils[i]->log_get_record(infile, mod_buf, &rec_id)) == 1);
} while((ret = mod_logutils[i]->log_get_record(infile, mod_buf)) == 1);
}
darshan_log_close(infile);
......
......@@ -30,8 +30,7 @@ char *hdf5_f_counter_names[] = {
};
#undef X
static int darshan_log_get_hdf5_file(darshan_fd fd, void* hdf5_buf,
darshan_record_id* rec_id);
static int darshan_log_get_hdf5_file(darshan_fd fd, void* hdf5_buf);
static int darshan_log_put_hdf5_file(darshan_fd fd, void* hdf5_buf);
static void darshan_log_print_hdf5_file(void *file_rec,
char *file_name, char *mnt_pt, char *fs_type);
......@@ -43,8 +42,7 @@ struct darshan_mod_logutil_funcs hdf5_logutils =
.log_print_record = &darshan_log_print_hdf5_file,
};
static int darshan_log_get_hdf5_file(darshan_fd fd, void* hdf5_buf,
darshan_record_id* rec_id)
static int darshan_log_get_hdf5_file(darshan_fd fd, void* hdf5_buf)
{
struct darshan_hdf5_file *file;
int i;
......@@ -62,15 +60,14 @@ static int darshan_log_get_hdf5_file(darshan_fd fd, void* hdf5_buf,
if(fd->swap_flag)
{
/* swap bytes if necessary */
DARSHAN_BSWAP64(&file->f_id);
DARSHAN_BSWAP64(&file->rank);
DARSHAN_BSWAP64(&(file->base_rec.id));
DARSHAN_BSWAP64(&(file->base_rec.rank));
for(i=0; i<HDF5_NUM_INDICES; i++)
DARSHAN_BSWAP64(&file->counters[i]);
for(i=0; i<HDF5_F_NUM_INDICES; i++)
DARSHAN_BSWAP64(&file->fcounters[i]);
}
*rec_id = file->f_id;
return(1);
}
}
......@@ -98,15 +95,17 @@ static void darshan_log_print_hdf5_file(void *file_rec, char *file_name,
for(i=0; i<HDF5_NUM_INDICES; i++)
{
DARSHAN_COUNTER_PRINT(darshan_module_names[DARSHAN_HDF5_MOD],
hdf5_file_rec->rank, hdf5_file_rec->f_id, hdf5_counter_names[i],
hdf5_file_rec->counters[i], file_name, mnt_pt, fs_type);
hdf5_file_rec->base_rec.rank, hdf5_file_rec->base_rec.id,
hdf5_counter_names[i], hdf5_file_rec->counters[i],
file_name, mnt_pt, fs_type);
}
for(i=0; i<HDF5_F_NUM_INDICES; i++)
{
DARSHAN_F_COUNTER_PRINT(darshan_module_names[DARSHAN_HDF5_MOD],
hdf5_file_rec->rank, hdf5_file_rec->f_id, hdf5_f_counter_names[i],
hdf5_file_rec->fcounters[i], file_name, mnt_pt, fs_type);
hdf5_file_rec->base_rec.rank, hdf5_file_rec->base_rec.id,
hdf5_f_counter_names[i], hdf5_file_rec->fcounters[i],
file_name, mnt_pt, fs_type);
}
return;
......
......@@ -59,8 +59,7 @@ struct darshan_mod_logutil_funcs
*/
int (*log_get_record)(
darshan_fd fd,
void* buf,
darshan_record_id* rec_id
void* buf
);
/* put a single module record into the log file.
* return 0 on success, -1 on error
......
......@@ -30,8 +30,7 @@ char *mpiio_f_counter_names[] = {
};
#undef X
static int darshan_log_get_mpiio_file(darshan_fd fd, void* mpiio_buf,
darshan_record_id* rec_id);
static int darshan_log_get_mpiio_file(darshan_fd fd, void* mpiio_buf);
static int darshan_log_put_mpiio_file(darshan_fd fd, void* mpiio_buf);
static void darshan_log_print_mpiio_file(void *file_rec,
char *file_name, char *mnt_pt, char *fs_type);
......@@ -43,8 +42,7 @@ struct darshan_mod_logutil_funcs mpiio_logutils =
.log_print_record = &darshan_log_print_mpiio_file,
};
static int darshan_log_get_mpiio_file(darshan_fd fd, void* mpiio_buf,
darshan_record_id* rec_id)
static int darshan_log_get_mpiio_file(darshan_fd fd, void* mpiio_buf)
{
struct darshan_mpiio_file *file;
int i;
......@@ -62,15 +60,14 @@ static int darshan_log_get_mpiio_file(darshan_fd fd, void* mpiio_buf,
if(fd->swap_flag)
{
/* swap bytes if necessary */
DARSHAN_BSWAP64(&file->f_id);
DARSHAN_BSWAP64(&file->rank);
DARSHAN_BSWAP64(&(file->base_rec.id));
DARSHAN_BSWAP64(&(file->base_rec.rank));
for(i=0; i<MPIIO_NUM_INDICES; i++)
DARSHAN_BSWAP64(&file->counters[i]);
for(i=0; i<MPIIO_F_NUM_INDICES; i++)
DARSHAN_BSWAP64(&file->fcounters[i]);
}
*rec_id = file->f_id;
return(1);
}
}
......@@ -98,15 +95,17 @@ static void darshan_log_print_mpiio_file(void *file_rec, char *file_name,
for(i=0; i<MPIIO_NUM_INDICES; i++)
{
DARSHAN_COUNTER_PRINT(darshan_module_names[DARSHAN_MPIIO_MOD],
mpiio_file_rec->rank, mpiio_file_rec->f_id, mpiio_counter_names[i],
mpiio_file_rec->counters[i], file_name, mnt_pt, fs_type);
mpiio_file_rec->base_rec.rank, mpiio_file_rec->base_rec.id,
mpiio_counter_names[i], mpiio_file_rec->counters[i],
file_name, mnt_pt, fs_type);
}
for(i=0; i<MPIIO_F_NUM_INDICES; i++)
{
DARSHAN_F_COUNTER_PRINT(darshan_module_names[DARSHAN_MPIIO_MOD],
mpiio_file_rec->rank, mpiio_file_rec->f_id, mpiio_f_counter_names[i],
mpiio_file_rec->fcounters[i], file_name, mnt_pt, fs_type);
mpiio_file_rec->base_rec.rank, mpiio_file_rec->base_rec.id,
mpiio_f_counter_names[i], mpiio_file_rec->fcounters[i],
file_name, mnt_pt, fs_type);
}
return;
......
......@@ -32,8 +32,7 @@ char *null_f_counter_names[] = {
#undef X
/* prototypes for each of the NULL module's logutil functions */
static int darshan_log_get_null_record(darshan_fd fd, void* null_buf,
darshan_record_id* rec_id);
static int darshan_log_get_null_record(darshan_fd fd, void* null_buf);
static int darshan_log_put_null_record(darshan_fd fd, void* null_buf);
static void darshan_log_print_null_record(void *file_rec,
char *file_name, char *mnt_pt, char *fs_type);
......@@ -53,8 +52,7 @@ struct darshan_mod_logutil_funcs null_logutils =
* buffer in 'null_buf' and the corresponding Darshan record id in
* 'rec_id'. Return 1 on successful record read, .
*/
static int darshan_log_get_null_record(darshan_fd fd, void* null_buf,
darshan_record_id* rec_id)
static int darshan_log_get_null_record(darshan_fd fd, void* null_buf)
{
struct darshan_null_record *rec;
int i;
......@@ -74,16 +72,14 @@ static int darshan_log_get_null_record(darshan_fd fd, void* null_buf,
if(fd->swap_flag)
{
/* swap bytes if necessary */
DARSHAN_BSWAP64(&rec->f_id);
DARSHAN_BSWAP64(&rec->rank);
DARSHAN_BSWAP64(&(rec->base_rec.id));
DARSHAN_BSWAP64(&(rec->base_rec.rank));
for(i=0; i<NULL_NUM_INDICES; i++)
DARSHAN_BSWAP64(&rec->counters[i]);
for(i=0; i<NULL_F_NUM_INDICES; i++)
DARSHAN_BSWAP64(&rec->fcounters[i]);
}
/* set the output record id */
*rec_id = rec->f_id;
return(1);
}
}
......@@ -118,16 +114,18 @@ static void darshan_log_print_null_record(void *file_rec, char *file_name,
{
/* macro defined in darshan-logutils.h */
DARSHAN_COUNTER_PRINT(darshan_module_names[DARSHAN_NULL_MOD],
null_rec->rank, null_rec->f_id, null_counter_names[i],
null_rec->counters[i], file_name, mnt_pt, fs_type);
null_rec->base_rec.rank, null_rec->base_rec.id,
null_counter_names[i], null_rec->counters[i],
file_name, mnt_pt, fs_type);
}
for(i=0; i<NULL_F_NUM_INDICES; i++)
{
/* macro defined in darshan-logutils.h */
DARSHAN_F_COUNTER_PRINT(darshan_module_names[DARSHAN_NULL_MOD],
null_rec->rank, null_rec->f_id, null_f_counter_names[i],
null_rec->fcounters[i], file_name, mnt_pt, fs_type);
null_rec->base_rec.rank, null_rec->base_rec.id,
null_f_counter_names[i], null_rec->fcounters[i],
file_name, mnt_pt, fs_type);
}
return;
......
......@@ -348,7 +348,7 @@ int main(int argc, char **argv)
for(i=0; i<DARSHAN_MAX_MODS; i++)
{
darshan_record_id rec_id;
struct darshan_base_record *base_rec;
void *save_io, *save_md;
/* check each module for any data */
......@@ -389,7 +389,7 @@ int main(int argc, char **argv)
DARSHAN_PRINT_HEADER();
}
ret = mod_logutils[i]->log_get_record(fd, mod_buf, &rec_id);
ret = mod_logutils[i]->log_get_record(fd, mod_buf);
if(ret != 1)
{
fprintf(stderr, "Error: failed to parse the first %s module record.\n",
......@@ -404,9 +404,10 @@ int main(int argc, char **argv)
char *mnt_pt = NULL;
char *fs_type = NULL;
hash_entry_t *hfile = NULL;
base_rec = (struct darshan_base_record *)mod_buf;
/* get the pathname for this record */
HASH_FIND(hlink, rec_hash, &rec_id, sizeof(darshan_record_id), ref);
HASH_FIND(hlink, rec_hash, &(base_rec->id), sizeof(darshan_record_id), ref);
assert(ref);
/* get mount point and fs type associated with this record */
......@@ -437,7 +438,7 @@ int main(int argc, char **argv)
if(i != DARSHAN_POSIX_MOD && i != DARSHAN_MPIIO_MOD)
continue;
HASH_FIND(hlink, file_hash, &rec_id, sizeof(darshan_record_id), hfile);
HASH_FIND(hlink, file_hash, &(base_rec->id), sizeof(darshan_record_id), hfile);
if(!hfile)
{
hfile = malloc(sizeof(*hfile));
......@@ -449,14 +450,14 @@ int main(int argc, char **argv)
/* init */
memset(hfile, 0, sizeof(*hfile));
hfile->rec_id = rec_id;
hfile->rec_id = base_rec->id;
hfile->type = 0;
hfile->procs = 0;
hfile->rec_dat = NULL;
hfile->cumul_time = 0.0;
hfile->slowest_time = 0.0;
HASH_ADD(hlink, file_hash, rec_id, sizeof(darshan_record_id), hfile);
HASH_ADD(hlink, file_hash,rec_id, sizeof(darshan_record_id), hfile);
}
if(i == DARSHAN_POSIX_MOD)
......@@ -474,7 +475,7 @@ int main(int argc, char **argv)
memset(mod_buf, 0, DEF_MOD_BUF_SIZE);
} while((ret = mod_logutils[i]->log_get_record(fd, mod_buf, &rec_id)) == 1);
} while((ret = mod_logutils[i]->log_get_record(fd, mod_buf)) == 1);
if (ret < 0)
{
ret = -1;
......@@ -858,7 +859,7 @@ void mpiio_accum_file(struct darshan_mpiio_file *mfile,
hfile->procs += 1;
if(mfile->rank == -1)
if(mfile->base_rec.rank == -1)
{
hfile->slowest_time = mfile->fcounters[MPIIO_F_SLOWEST_RANK_TIME];
}
......@@ -870,7 +871,7 @@ void mpiio_accum_file(struct darshan_mpiio_file *mfile,
mfile->fcounters[MPIIO_F_WRITE_TIME]));
}
if(mfile->rank == -1)
if(mfile->base_rec.rank == -1)
{
hfile->procs = nprocs;
hfile->type |= FILETYPE_SHARED;
......@@ -1111,7 +1112,7 @@ void mpiio_accum_perf(struct darshan_mpiio_file *mfile,
* by_slowest: use slowest rank time from log data
* (most accurate but requires newer log version)
*/
if(mfile->rank == -1)
if(mfile->base_rec.rank == -1)
{
/* by_open */
if(mfile->fcounters[MPIIO_F_CLOSE_TIMESTAMP] >
......@@ -1162,11 +1163,12 @@ void mpiio_accum_perf(struct darshan_mpiio_file *mfile,
*/
else
{
pdata->rank_cumul_io_time[mfile->rank] +=
pdata->rank_cumul_io_time[mfile->base_rec.rank] +=
(mfile->fcounters[MPIIO_F_META_TIME] +
mfile->fcounters[MPIIO_F_READ_TIME] +
mfile->fcounters[MPIIO_F_WRITE_TIME]);
pdata->rank_cumul_md_time[mfile->rank] += mfile->fcounters[MPIIO_F_META_TIME];
pdata->rank_cumul_md_time[mfile->base_rec.rank] +=
mfile->fcounters[MPIIO_F_META_TIME];
}
return;
......
......@@ -30,8 +30,7 @@ char *pnetcdf_f_counter_names[] = {
};
#undef X
static int darshan_log_get_pnetcdf_file(darshan_fd fd, void* pnetcdf_buf,
darshan_record_id* rec_id);
static int darshan_log_get_pnetcdf_file(darshan_fd fd, void* pnetcdf_buf);
static int darshan_log_put_pnetcdf_file(darshan_fd fd, void* pnetcdf_buf);
static void darshan_log_print_pnetcdf_file(void *file_rec,
char *file_name, char *mnt_pt, char *fs_type);
......@@ -43,8 +42,7 @@ struct darshan_mod_logutil_funcs pnetcdf_logutils =
.log_print_record = &darshan_log_print_pnetcdf_file,
};
static int darshan_log_get_pnetcdf_file(darshan_fd fd, void* pnetcdf_buf,
darshan_record_id* rec_id)
static int darshan_log_get_pnetcdf_file(darshan_fd fd, void* pnetcdf_buf)
{
struct darshan_pnetcdf_file *file;
int i;
......@@ -62,15 +60,14 @@ static int darshan_log_get_pnetcdf_file(darshan_fd fd, void* pnetcdf_buf,
if(fd->swap_flag)
{
/* swap bytes if necessary */
DARSHAN_BSWAP64(&file->f_id);
DARSHAN_BSWAP64(&file->rank);
DARSHAN_BSWAP64(&(file->base_rec.id));
DARSHAN_BSWAP64(&(file->base_rec.rank));
for(i=0; i<PNETCDF_NUM_INDICES; i++)
DARSHAN_BSWAP64(&file->counters[i]);
for(i=0; i<PNETCDF_F_NUM_INDICES; i++)
DARSHAN_BSWAP64(&file->fcounters[i]);
}
*rec_id = file->f_id;
return(1);
}
}
......@@ -98,15 +95,17 @@ static void darshan_log_print_pnetcdf_file(void *file_rec, char *file_name,
for(i=0; i<PNETCDF_NUM_INDICES; i++)
{
DARSHAN_COUNTER_PRINT(darshan_module_names[DARSHAN_PNETCDF_MOD],
pnetcdf_file_rec->rank, pnetcdf_file_rec->f_id, pnetcdf_counter_names[i],
pnetcdf_file_rec->counters[i], file_name, mnt_pt, fs_type);
pnetcdf_file_rec->base_rec.rank, pnetcdf_file_rec->base_rec.id,
pnetcdf_counter_names[i], pnetcdf_file_rec->counters[i],
file_name, mnt_pt, fs_type);
}
for(i=0; i<PNETCDF_F_NUM_INDICES; i++)
{
DARSHAN_F_COUNTER_PRINT(darshan_module_names[DARSHAN_PNETCDF_MOD],
pnetcdf_file_rec->rank, pnetcdf_file_rec->f_id, pnetcdf_f_counter_names[i],
pnetcdf_file_rec->fcounters[i], file_name, mnt_pt, fs_type);
pnetcdf_file_rec->base_rec.rank, pnetcdf_file_rec->base_rec.id,
pnetcdf_f_counter_names[i], pnetcdf_file_rec->fcounters[i],
file_name, mnt_pt, fs_type);
}
return;
......
......@@ -30,8 +30,7 @@ char *posix_f_counter_names[] = {
};
#undef X
static int darshan_log_get_posix_file(darshan_fd fd, void* posix_buf,
darshan_record_id* rec_id);
static int darshan_log_get_posix_file(darshan_fd fd, void* posix_buf);
static int darshan_log_put_posix_file(darshan_fd fd, void* posix_buf);
static void darshan_log_print_posix_file(void *file_rec,
char *file_name, char *mnt_pt, char *fs_type);
......@@ -43,8 +42,7 @@ struct darshan_mod_logutil_funcs posix_logutils =
.log_print_record = &darshan_log_print_posix_file,
};
static int darshan_log_get_posix_file(darshan_fd fd, void* posix_buf,
darshan_record_id* rec_id)
static int darshan_log_get_posix_file(darshan_fd fd, void* posix_buf)
{
struct darshan_posix_file *file;
int i;
......@@ -70,7 +68,6 @@ static int darshan_log_get_posix_file(darshan_fd fd, void* posix_buf,
DARSHAN_BSWAP64(&file->fcounters[i]);
}
*rec_id = file->base_rec.id;
return(1);
}
}
......
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