Commit 501753dd authored by Philip Carns's avatar Philip Carns

bzip2 read support in darshan-logutils

- needs more thorough testing
- API change: functions no longer report end of file flag; this is now
  detected by looking for a return code of zero on getjob().


git-svn-id: https://svn.mcs.anl.gov/repos/darshan/trunk@441 3b7491f3-a168-0410-bf4b-c445ed680a29
parent 8e765fd3
......@@ -37,7 +37,6 @@ int process_log(const char *fname, double *io_ratio, int *used_mpio, int *used_p
int f_count;
double total_io_time;
double total_job_time;
int nofiles = 0;
zfile = darshan_log_open(fname, "r");
if (zfile == NULL)
......@@ -55,7 +54,7 @@ int process_log(const char *fname, double *io_ratio, int *used_mpio, int *used_p
return -1;
}
ret = darshan_log_getexe(zfile, tmp_string, &nofiles);
ret = darshan_log_getexe(zfile, tmp_string);
if (ret < 0)
{
perror("darshan_log_getexe");
......
......@@ -140,7 +140,6 @@ int main(int argc, char **argv)
struct darshan_job job;
struct darshan_file cp_file;
char tmp_string[1024];
int no_files_flag = 0;
darshan_fd infile;
darshan_fd outfile;
int i;
......@@ -197,7 +196,7 @@ int main(int argc, char **argv)
return(-1);
}
ret = darshan_log_getexe(infile, tmp_string, &no_files_flag);
ret = darshan_log_getexe(infile, tmp_string);
if(ret < 0)
{
fprintf(stderr, "Error: unable to read trailing job information.\n");
......@@ -215,8 +214,7 @@ int main(int argc, char **argv)
return(-1);
}
ret = darshan_log_getmounts(infile, &devs, &mnt_pts, &fs_types, &mount_count,
&no_files_flag);
ret = darshan_log_getmounts(infile, &devs, &mnt_pts, &fs_types, &mount_count);
if(ret < 0)
{
fprintf(stderr, "Error: unable to read trailing job information.\n");
......@@ -232,13 +230,19 @@ int main(int argc, char **argv)
return(-1);
}
if(no_files_flag)
ret = darshan_log_getfile(infile, &job, &cp_file);
if(ret < 0)
{
fprintf(stderr, "Error: failed to process log file.\n");
fflush(stderr);
}
if(ret == 0)
{
darshan_log_close(infile);
darshan_log_close(outfile);
}
while((ret = darshan_log_getfile(infile, &job, &cp_file)) == 1)
do
{
if(cp_file.rank != -1 && cp_file.rank < last_rank)
{
......@@ -257,7 +261,7 @@ int main(int argc, char **argv)
fprintf(stderr, "Error: failed to write file record.\n");
break;
}
}
} while((ret = darshan_log_getfile(infile, &job, &cp_file)) == 1);
if(ret < 0)
{
......
This diff is collapsed.
......@@ -17,9 +17,12 @@ struct darshan_fd_s
#ifdef HAVE_LIBBZ2
BZFILE* bzf;
#endif
int64_t pos;
char mode[2];
int swap_flag;
char version[10];
int job_struct_size;
char* name;
};
typedef struct darshan_fd_s* darshan_fd;
......@@ -35,14 +38,13 @@ int darshan_log_getfile(darshan_fd fd,
int darshan_log_putfile(darshan_fd fd,
struct darshan_job* job,
struct darshan_file *file);
int darshan_log_getexe(darshan_fd fd, char *buf, int *flag);
int darshan_log_getexe(darshan_fd fd, char *buf);
int darshan_log_putexe(darshan_fd fd, char *buf);
int darshan_log_getmounts(darshan_fd fd,
int64_t** devs,
char*** mnt_pts,
char*** fs_types,
int* count,
int *flag);
int* count);
int darshan_log_putmounts(darshan_fd fd,
int64_t* devs,
char** mnt_pts,
......
......@@ -180,7 +180,6 @@ int main(int argc, char **argv)
struct darshan_job job;
struct darshan_file cp_file;
char tmp_string[1024];
int no_files_flag = 0;
time_t tmp_time = 0;
darshan_fd file;
int i;
......@@ -223,7 +222,7 @@ int main(int argc, char **argv)
/* warn user about any missing information in this log format */
darshan_log_print_version_warnings(&job);
ret = darshan_log_getexe(file, tmp_string, &no_files_flag);
ret = darshan_log_getexe(file, tmp_string);
if(ret < 0)
{
fprintf(stderr, "Error: unable to read trailing job information.\n");
......@@ -261,8 +260,7 @@ int main(int argc, char **argv)
}
/* print table of mounted file systems */
ret = darshan_log_getmounts(file, &devs, &mnt_pts, &fs_types, &mount_count,
&no_files_flag);
ret = darshan_log_getmounts(file, &devs, &mnt_pts, &fs_types, &mount_count);
printf("\n# mounted file systems (device, mount point, and fs type)\n");
printf("# -------------------------------------------------------\n");
for(i=0; i<mount_count; i++)
......@@ -270,7 +268,15 @@ int main(int argc, char **argv)
printf("# mount entry: %" PRId64 "\t%s\t%s\n", devs[i], mnt_pts[i], fs_types[i]);
}
if(no_files_flag)
/* try to retrieve first record (may not exist) */
ret = darshan_log_getfile(file, &job, &cp_file);
if(ret < 0)
{
fprintf(stderr, "Error: failed to parse log file.\n");
fflush(stderr);
return(-1);
}
if(ret == 0)
{
/* it looks like the app didn't open any files */
printf("# no files opened.\n");
......@@ -350,7 +356,7 @@ int main(int argc, char **argv)
memset(pdata.rank_cumul_md_time, 0, sizeof(double)*job.nprocs);
}
while((ret = darshan_log_getfile(file, &job, &cp_file)) == 1)
do
{
char* mnt_pt = NULL;
char* fs_type = NULL;
......@@ -415,7 +421,7 @@ int main(int argc, char **argv)
CP_F_PRINT(&job, &cp_file, i, mnt_pt, fs_type);
}
}
}
}while((ret = darshan_log_getfile(file, &job, &cp_file)) == 1);
/* Total Calc */
if ((mask & OPTION_TOTAL))
......
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