Commit af5dfe77 authored by Philip Carns's avatar Philip Carns

update stdio module logutils to match new apis

parent ad6ea64f
......@@ -32,8 +32,7 @@ char *stdio_f_counter_names[] = {
#undef X
/* prototypes for each of the STDIO module's logutil functions */
static int darshan_log_get_stdio_record(darshan_fd fd, void* stdio_buf,
darshan_record_id* rec_id);
static int darshan_log_get_stdio_record(darshan_fd fd, void* stdio_buf);
static int darshan_log_put_stdio_record(darshan_fd fd, void* stdio_buf, int ver);
static void darshan_log_print_stdio_record(void *file_rec,
char *file_name, char *mnt_pt, char *fs_type, int ver);
......@@ -55,41 +54,37 @@ struct darshan_mod_logutil_funcs stdio_logutils =
};
/* retrieve a STDIO record from log file descriptor 'fd', storing the
* buffer in 'stdio_buf' and the corresponding Darshan record id in
* 'rec_id'. Return 1 on successful record read, 0 on no more data,
* and -1 on error.
* buffer in 'stdio_buf'. Return 1 on successful record read, 0 on no
* more data, and -1 on error.
*/
static int darshan_log_get_stdio_record(darshan_fd fd, void* stdio_buf,
darshan_record_id* rec_id)
static int darshan_log_get_stdio_record(darshan_fd fd, void* stdio_buf)
{
struct darshan_stdio_record *rec;
struct darshan_stdio_file *file;
int i;
int ret;
/* read a STDIO module record from the darshan log file */
ret = darshan_log_getmod(fd, DARSHAN_STDIO_MOD, stdio_buf,
sizeof(struct darshan_stdio_record));
ret = darshan_log_get_mod(fd, DARSHAN_STDIO_MOD, stdio_buf,
sizeof(struct darshan_stdio_file));
if(ret < 0)
return(-1);
else if(ret < sizeof(struct darshan_stdio_record))
else if(ret < sizeof(struct darshan_stdio_file))
return(0);
else
{
/* if the read was successful, do any necessary byte-swapping */
rec = (struct darshan_stdio_record *)stdio_buf;
file = (struct darshan_stdio_file *)stdio_buf;
if(fd->swap_flag)
{
/* swap bytes if necessary */
DARSHAN_BSWAP64(&rec->f_id);
DARSHAN_BSWAP64(&rec->rank);
DARSHAN_BSWAP64(&file->base_rec.id);
DARSHAN_BSWAP64(&file->base_rec.rank);
for(i=0; i<STDIO_NUM_INDICES; i++)
DARSHAN_BSWAP64(&rec->counters[i]);
DARSHAN_BSWAP64(&file->counters[i]);
for(i=0; i<STDIO_F_NUM_INDICES; i++)
DARSHAN_BSWAP64(&rec->fcounters[i]);
DARSHAN_BSWAP64(&file->fcounters[i]);
}
/* set the output record id */
*rec_id = rec->f_id;
return(1);
}
}
......@@ -99,12 +94,12 @@ static int darshan_log_get_stdio_record(darshan_fd fd, void* stdio_buf,
*/
static int darshan_log_put_stdio_record(darshan_fd fd, void* stdio_buf, int ver)
{
struct darshan_stdio_record *rec = (struct darshan_stdio_record *)stdio_buf;
struct darshan_stdio_file *rec = (struct darshan_stdio_file *)stdio_buf;
int ret;
/* append STDIO record to darshan log file */
ret = darshan_log_putmod(fd, DARSHAN_STDIO_MOD, rec,
sizeof(struct darshan_stdio_record), ver);
ret = darshan_log_put_mod(fd, DARSHAN_STDIO_MOD, rec,
sizeof(struct darshan_stdio_file), ver);
if(ret < 0)
return(-1);
......@@ -116,15 +111,15 @@ static void darshan_log_print_stdio_record(void *file_rec, char *file_name,
char *mnt_pt, char *fs_type, int ver)
{
int i;
struct darshan_stdio_record *stdio_rec =
(struct darshan_stdio_record *)file_rec;
struct darshan_stdio_file *stdio_rec =
(struct darshan_stdio_file *)file_rec;
/* print each of the integer and floating point counters for the STDIO module */
for(i=0; i<STDIO_NUM_INDICES; i++)
{
/* macro defined in darshan-logutils.h */
DARSHAN_COUNTER_PRINT(darshan_module_names[DARSHAN_STDIO_MOD],
stdio_rec->rank, stdio_rec->f_id, stdio_counter_names[i],
stdio_rec->base_rec.rank, stdio_rec->base_rec.id, stdio_counter_names[i],
stdio_rec->counters[i], file_name, mnt_pt, fs_type);
}
......@@ -132,7 +127,7 @@ static void darshan_log_print_stdio_record(void *file_rec, char *file_name,
{
/* macro defined in darshan-logutils.h */
DARSHAN_F_COUNTER_PRINT(darshan_module_names[DARSHAN_STDIO_MOD],
stdio_rec->rank, stdio_rec->f_id, stdio_f_counter_names[i],
stdio_rec->base_rec.rank, stdio_rec->base_rec.id, stdio_f_counter_names[i],
stdio_rec->fcounters[i], file_name, mnt_pt, fs_type);
}
......@@ -156,8 +151,8 @@ static void darshan_log_print_stdio_description()
static void darshan_log_print_stdio_record_diff(void *file_rec1, char *file_name1,
void *file_rec2, char *file_name2)
{
struct darshan_stdio_record *file1 = (struct darshan_stdio_record *)file_rec1;
struct darshan_stdio_record *file2 = (struct darshan_stdio_record *)file_rec2;
struct darshan_stdio_file *file1 = (struct darshan_stdio_file *)file_rec1;
struct darshan_stdio_file *file2 = (struct darshan_stdio_file *)file_rec2;
int i;
/* NOTE: we assume that both input records are the same module format version */
......@@ -168,7 +163,7 @@ static void darshan_log_print_stdio_record_diff(void *file_rec1, char *file_name
{
printf("- ");
DARSHAN_COUNTER_PRINT(darshan_module_names[DARSHAN_STDIO_MOD],
file1->rank, file1->f_id, stdio_counter_names[i],
file1->base_rec.rank, file1->base_rec.id, stdio_counter_names[i],
file1->counters[i], file_name1, "", "");
}
......@@ -176,18 +171,18 @@ static void darshan_log_print_stdio_record_diff(void *file_rec1, char *file_name
{
printf("+ ");
DARSHAN_COUNTER_PRINT(darshan_module_names[DARSHAN_STDIO_MOD],
file2->rank, file2->f_id, stdio_counter_names[i],
file2->base_rec.rank, file2->base_rec.id, stdio_counter_names[i],
file2->counters[i], file_name2, "", "");
}
else if(file1->counters[i] != file2->counters[i])
{
printf("- ");
DARSHAN_COUNTER_PRINT(darshan_module_names[DARSHAN_STDIO_MOD],
file1->rank, file1->f_id, stdio_counter_names[i],
file1->base_rec.rank, file1->base_rec.id, stdio_counter_names[i],
file1->counters[i], file_name1, "", "");
printf("+ ");
DARSHAN_COUNTER_PRINT(darshan_module_names[DARSHAN_STDIO_MOD],
file2->rank, file2->f_id, stdio_counter_names[i],
file2->base_rec.rank, file2->base_rec.id, stdio_counter_names[i],
file2->counters[i], file_name2, "", "");
}
}
......@@ -198,7 +193,7 @@ static void darshan_log_print_stdio_record_diff(void *file_rec1, char *file_name
{
printf("- ");
DARSHAN_F_COUNTER_PRINT(darshan_module_names[DARSHAN_STDIO_MOD],
file1->rank, file1->f_id, stdio_f_counter_names[i],
file1->base_rec.rank, file1->base_rec.id, stdio_f_counter_names[i],
file1->fcounters[i], file_name1, "", "");
}
......@@ -206,18 +201,18 @@ static void darshan_log_print_stdio_record_diff(void *file_rec1, char *file_name
{
printf("+ ");
DARSHAN_F_COUNTER_PRINT(darshan_module_names[DARSHAN_STDIO_MOD],
file2->rank, file2->f_id, stdio_f_counter_names[i],
file2->base_rec.rank, file2->base_rec.id, stdio_f_counter_names[i],
file2->fcounters[i], file_name2, "", "");
}
else if(file1->fcounters[i] != file2->fcounters[i])
{
printf("- ");
DARSHAN_F_COUNTER_PRINT(darshan_module_names[DARSHAN_STDIO_MOD],
file1->rank, file1->f_id, stdio_f_counter_names[i],
file1->base_rec.rank, file1->base_rec.id, stdio_f_counter_names[i],
file1->fcounters[i], file_name1, "", "");
printf("+ ");
DARSHAN_F_COUNTER_PRINT(darshan_module_names[DARSHAN_STDIO_MOD],
file2->rank, file2->f_id, stdio_f_counter_names[i],
file2->base_rec.rank, file2->base_rec.id, stdio_f_counter_names[i],
file2->fcounters[i], file_name2, "", "");
}
}
......
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