Commit 173d38b8 authored by Shane Snyder's avatar Shane Snyder

update util interfaces to support mod-specific ver

parent 66181457
......@@ -388,7 +388,6 @@ void darshan_core_shutdown()
{
fprintf(stderr, "darshan library warning: unable to open log file %s\n",
logfile_name);
unlink(logfile_name);
}
free(logfile_name);
darshan_core_cleanup(final_core);
......
......@@ -32,9 +32,9 @@ char *bgq_f_counter_names[] = {
static int darshan_log_get_bgq_rec(darshan_fd fd, void* bgq_buf,
darshan_record_id* rec_id);
static int darshan_log_put_bgq_rec(darshan_fd fd, void* bgq_buf);
static int darshan_log_put_bgq_rec(darshan_fd fd, void* bgq_buf, int ver);
static void darshan_log_print_bgq_rec(void *file_rec,
char *file_name, char *mnt_pt, char *fs_type);
char *file_name, char *mnt_pt, char *fs_type, int ver);
struct darshan_mod_logutil_funcs bgq_logutils =
{
......@@ -75,13 +75,13 @@ 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 int darshan_log_put_bgq_rec(darshan_fd fd, void* bgq_buf, int ver)
{
struct darshan_bgq_record *rec = (struct darshan_bgq_record *)bgq_buf;
int ret;
ret = darshan_log_putmod(fd, DARSHAN_BGQ_MOD, rec,
sizeof(struct darshan_bgq_record));
sizeof(struct darshan_bgq_record), ver);
if(ret < 0)
return(-1);
......@@ -89,7 +89,7 @@ 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)
char *mnt_pt, char *fs_type, int ver)
{
int i;
struct darshan_bgq_record *bgq_file_rec =
......
......@@ -373,7 +373,7 @@ int main(int argc, char **argv)
{
if(!hash || hash == rec_id)
{
ret = mod_logutils[i]->log_put_record(outfile, mod_buf);
ret = mod_logutils[i]->log_put_record(outfile, mod_buf, infile->mod_ver[i]);
if(ret < 0)
{
darshan_log_close(infile);
......
......@@ -32,9 +32,9 @@ char *hdf5_f_counter_names[] = {
static int darshan_log_get_hdf5_file(darshan_fd fd, void* hdf5_buf,
darshan_record_id* rec_id);
static int darshan_log_put_hdf5_file(darshan_fd fd, void* hdf5_buf);
static int darshan_log_put_hdf5_file(darshan_fd fd, void* hdf5_buf, int ver);
static void darshan_log_print_hdf5_file(void *file_rec,
char *file_name, char *mnt_pt, char *fs_type);
char *file_name, char *mnt_pt, char *fs_type, int ver);
struct darshan_mod_logutil_funcs hdf5_logutils =
{
......@@ -75,13 +75,13 @@ 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 int darshan_log_put_hdf5_file(darshan_fd fd, void* hdf5_buf, int ver)
{
struct darshan_hdf5_file *file = (struct darshan_hdf5_file *)hdf5_buf;
int ret;
ret = darshan_log_putmod(fd, DARSHAN_HDF5_MOD, file,
sizeof(struct darshan_hdf5_file));
sizeof(struct darshan_hdf5_file), ver);
if(ret < 0)
return(-1);
......@@ -89,7 +89,7 @@ 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)
char *mnt_pt, char *fs_type, int ver)
{
int i;
struct darshan_hdf5_file *hdf5_file_rec =
......
......@@ -730,7 +730,7 @@ int darshan_log_getmod(darshan_fd fd, darshan_module_id mod_id,
* returns number of bytes written on success, -1 on failure
*/
int darshan_log_putmod(darshan_fd fd, darshan_module_id mod_id,
void *mod_buf, int mod_buf_sz)
void *mod_buf, int mod_buf_sz, int ver)
{
struct darshan_fd_int_state *state = fd->state;
int ret;
......@@ -755,6 +755,9 @@ int darshan_log_putmod(darshan_fd fd, darshan_module_id mod_id,
return(-1);
}
/* set the version number for this module's data */
fd->mod_ver[mod_id] = ver;
return(0);
}
......@@ -883,8 +886,10 @@ static int darshan_log_getheader(darshan_fd fd)
}
}
/* set some fd fields based on what's stored in the header */
state->comp_type = header.comp_type;
fd->partial_flag = header.partial_flag;
memcpy(fd->mod_ver, header.mod_ver, DARSHAN_MAX_MODS * sizeof(uint32_t));
/* save the mapping of data within log file to this file descriptor */
fd->job_map.off = sizeof(struct darshan_header);
......
......@@ -33,6 +33,8 @@ struct darshan_fd_s
struct darshan_log_map job_map;
struct darshan_log_map rec_map;
struct darshan_log_map mod_map[DARSHAN_MAX_MODS];
/* module-specific log-format versions contained in log */
uint32_t mod_ver[DARSHAN_MAX_MODS];
/* KEEP OUT -- remaining state hidden in logutils source */
struct darshan_fd_int_state *state;
......@@ -64,14 +66,16 @@ struct darshan_mod_logutil_funcs
*/
int (*log_put_record)(
darshan_fd fd,
void *buf
void *buf,
int ver
);
/* print the counters for a given log file record */
void (*log_print_record)(
void *file_rec,
char *file_name,
char *mnt_pt,
char *fs_type
char *fs_type,
int ver
);
};
......@@ -99,7 +103,7 @@ int darshan_log_puthash(darshan_fd fd, struct darshan_record_ref *hash);
int darshan_log_getmod(darshan_fd fd, darshan_module_id mod_id,
void *mod_buf, int mod_buf_sz);
int darshan_log_putmod(darshan_fd fd, darshan_module_id mod_id,
void *mod_buf, int mod_buf_sz);
void *mod_buf, int mod_buf_sz, int ver);
void darshan_log_close(darshan_fd file);
/* convenience macros for printing Darshan counters */
......
......@@ -32,9 +32,9 @@ char *mpiio_f_counter_names[] = {
static int darshan_log_get_mpiio_file(darshan_fd fd, void* mpiio_buf,
darshan_record_id* rec_id);
static int darshan_log_put_mpiio_file(darshan_fd fd, void* mpiio_buf);
static int darshan_log_put_mpiio_file(darshan_fd fd, void* mpiio_buf, int ver);
static void darshan_log_print_mpiio_file(void *file_rec,
char *file_name, char *mnt_pt, char *fs_type);
char *file_name, char *mnt_pt, char *fs_type, int ver);
struct darshan_mod_logutil_funcs mpiio_logutils =
{
......@@ -75,13 +75,13 @@ 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 int darshan_log_put_mpiio_file(darshan_fd fd, void* mpiio_buf, int ver)
{
struct darshan_mpiio_file *file = (struct darshan_mpiio_file *)mpiio_buf;
int ret;
ret = darshan_log_putmod(fd, DARSHAN_MPIIO_MOD, file,
sizeof(struct darshan_mpiio_file));
sizeof(struct darshan_mpiio_file), ver);
if(ret < 0)
return(-1);
......@@ -89,7 +89,7 @@ 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)
char *mnt_pt, char *fs_type, int ver)
{
int i;
struct darshan_mpiio_file *mpiio_file_rec =
......
......@@ -34,9 +34,9 @@ char *null_f_counter_names[] = {
/* 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_put_null_record(darshan_fd fd, void* null_buf);
static int darshan_log_put_null_record(darshan_fd fd, void* null_buf, int ver);
static void darshan_log_print_null_record(void *file_rec,
char *file_name, char *mnt_pt, char *fs_type);
char *file_name, char *mnt_pt, char *fs_type, int ver);
/* structure storing each function needed for implementing the darshan
* logutil interface. these functions are used for reading, writing, and
......@@ -91,14 +91,14 @@ static int darshan_log_get_null_record(darshan_fd fd, void* null_buf,
/* write the NULL record stored in 'null_buf' to log file descriptor 'fd'.
* Return 0 on success, -1 on failure
*/
static int darshan_log_put_null_record(darshan_fd fd, void* null_buf)
static int darshan_log_put_null_record(darshan_fd fd, void* null_buf, int ver)
{
struct darshan_null_record *rec = (struct darshan_null_record *)null_buf;
int ret;
/* append NULL record to darshan log file */
ret = darshan_log_putmod(fd, DARSHAN_NULL_MOD, rec,
sizeof(struct darshan_null_record));
sizeof(struct darshan_null_record), ver);
if(ret < 0)
return(-1);
......@@ -107,7 +107,7 @@ static int darshan_log_put_null_record(darshan_fd fd, void* null_buf)
/* print all I/O data record statistics for the given NULL record */
static void darshan_log_print_null_record(void *file_rec, char *file_name,
char *mnt_pt, char *fs_type)
char *mnt_pt, char *fs_type, int ver)
{
int i;
struct darshan_null_record *null_rec =
......
......@@ -299,17 +299,17 @@ int main(int argc, char **argv)
}
/* print breakdown of each log file region's contribution to file size */
printf("\n# log file region sizes (compressed)\n");
printf("\n# log file regions\n");
printf("# -------------------------------------------------------\n");
printf("# header: %zu bytes (uncompressed)\n", sizeof(struct darshan_header));
printf("# job data: %zu bytes\n", fd->job_map.len);
printf("# record table: %zu bytes\n", fd->rec_map.len);
printf("# job data: %zu bytes (compressed)\n", fd->job_map.len);
printf("# record table: %zu bytes (compressed)\n", fd->rec_map.len);
for(i=0; i<DARSHAN_MAX_MODS; i++)
{
if(fd->mod_map[i].len)
{
printf("# %s module: %zu bytes\n", darshan_module_names[i],
fd->mod_map[i].len);
printf("# %s module: %zu bytes (compressed), ver=%d\n",
darshan_module_names[i], fd->mod_map[i].len, fd->mod_ver[i]);
}
}
......@@ -417,7 +417,7 @@ int main(int argc, char **argv)
{
/* print the corresponding module data for this record */
mod_logutils[i]->log_print_record(mod_buf, ref->rec.name,
mnt_pt, fs_type);
mnt_pt, fs_type, fd->mod_ver[i]);
}
/* we calculate more detailed stats for POSIX and MPI-IO modules,
......
......@@ -32,9 +32,9 @@ char *pnetcdf_f_counter_names[] = {
static int darshan_log_get_pnetcdf_file(darshan_fd fd, void* pnetcdf_buf,
darshan_record_id* rec_id);
static int darshan_log_put_pnetcdf_file(darshan_fd fd, void* pnetcdf_buf);
static int darshan_log_put_pnetcdf_file(darshan_fd fd, void* pnetcdf_buf, int ver);
static void darshan_log_print_pnetcdf_file(void *file_rec,
char *file_name, char *mnt_pt, char *fs_type);
char *file_name, char *mnt_pt, char *fs_type, int ver);
struct darshan_mod_logutil_funcs pnetcdf_logutils =
{
......@@ -75,13 +75,13 @@ 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 int darshan_log_put_pnetcdf_file(darshan_fd fd, void* pnetcdf_buf, int ver)
{
struct darshan_pnetcdf_file *file = (struct darshan_pnetcdf_file *)pnetcdf_buf;
int ret;
ret = darshan_log_putmod(fd, DARSHAN_PNETCDF_MOD, file,
sizeof(struct darshan_pnetcdf_file));
sizeof(struct darshan_pnetcdf_file), ver);
if(ret < 0)
return(-1);
......@@ -89,7 +89,7 @@ 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)
char *mnt_pt, char *fs_type, int ver)
{
int i;
struct darshan_pnetcdf_file *pnetcdf_file_rec =
......
......@@ -32,9 +32,9 @@ char *posix_f_counter_names[] = {
static int darshan_log_get_posix_file(darshan_fd fd, void* posix_buf,
darshan_record_id* rec_id);
static int darshan_log_put_posix_file(darshan_fd fd, void* posix_buf);
static int darshan_log_put_posix_file(darshan_fd fd, void* posix_buf, int ver);
static void darshan_log_print_posix_file(void *file_rec,
char *file_name, char *mnt_pt, char *fs_type);
char *file_name, char *mnt_pt, char *fs_type, int ver);
struct darshan_mod_logutil_funcs posix_logutils =
{
......@@ -75,13 +75,13 @@ 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 int darshan_log_put_posix_file(darshan_fd fd, void* posix_buf, int ver)
{
struct darshan_posix_file *file = (struct darshan_posix_file *)posix_buf;
int ret;
ret = darshan_log_putmod(fd, DARSHAN_POSIX_MOD, file,
sizeof(struct darshan_posix_file));
sizeof(struct darshan_posix_file), ver);
if(ret < 0)
return(-1);
......@@ -89,7 +89,7 @@ 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)
char *mnt_pt, char *fs_type, int ver)
{
int i;
struct darshan_posix_file *posix_file_rec =
......
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