Commit 1d3113d4 authored by Philip Carns's avatar Philip Carns

updated analyzer utility to use logutils api


git-svn-id: https://svn.mcs.anl.gov/repos/darshan/trunk@124 3b7491f3-a168-0410-bf4b-c445ed680a29
parent 7155d95c
......@@ -36,8 +36,8 @@ mktestdir::
darshan-parser: darshan-parser.c darshan.h darshan-log-format.h darshan-logutils.o
gcc $(CFLAGS) -lz $< darshan-logutils.o -o $@
darshan-analyzer: darshan-analyzer.c darshan.h darshan-log-format.h
gcc $(CFLAGS) -lz $< -o $@
darshan-analyzer: darshan-analyzer.c darshan.h darshan-log-format.h darshan-logutils.o
gcc $(CFLAGS) -lz $< darshan-logutils.o -o $@
darshan-log-params: darshan-log-params.c darshan-log-format.h
gcc $(CFLAGS) -lz $< -o $@
......
......@@ -4,184 +4,7 @@
#include <ftw.h>
#include <zlib.h>
#include "darshan-log-format.h"
// old format
enum darshan_indices_v121
{
V121_CP_INDEP_OPENS = 0, /* count of MPI independent opens */
V121_CP_COLL_OPENS, /* count of MPI collective opens */
V121_CP_INDEP_READS, /* count of independent MPI reads */
V121_CP_INDEP_WRITES, /* count of independent MPI writes */
V121_CP_COLL_READS, /* count of collective MPI reads */
V121_CP_COLL_WRITES, /* count of collective MPI writes */
V121_CP_SPLIT_READS, /* count of split collective MPI reads */
V121_CP_SPLIT_WRITES, /* count of split collective MPI writes */
V121_CP_NB_READS, /* count of nonblocking MPI reads */
V121_CP_NB_WRITES, /* count of nonblocking MPI writes */
V121_CP_SYNCS,
V121_CP_POSIX_READS, /* count of posix reads */
V121_CP_POSIX_WRITES, /* count of posix writes */
V121_CP_POSIX_OPENS, /* count of posix opens */
V121_CP_POSIX_SEEKS, /* count of posix seeks */
V121_CP_POSIX_STATS, /* count of posix stat/lstat/fstats */
V121_CP_POSIX_MMAPS, /* count of posix mmaps */
V121_CP_POSIX_FREADS,
V121_CP_POSIX_FWRITES,
V121_CP_POSIX_FOPENS,
V121_CP_POSIX_FSEEKS,
V121_CP_POSIX_FSYNCS,
V121_CP_POSIX_FDSYNCS,
/* type categories */
V121_CP_COMBINER_NAMED, /* count of each MPI datatype category */
V121_CP_COMBINER_DUP,
V121_CP_COMBINER_CONTIGUOUS,
V121_CP_COMBINER_VECTOR,
V121_CP_COMBINER_HVECTOR_INTEGER,
V121_CP_COMBINER_HVECTOR,
V121_CP_COMBINER_INDEXED,
V121_CP_COMBINER_HINDEXED_INTEGER,
V121_CP_COMBINER_HINDEXED,
V121_CP_COMBINER_INDEXED_BLOCK,
V121_CP_COMBINER_STRUCT_INTEGER,
V121_CP_COMBINER_STRUCT,
V121_CP_COMBINER_SUBARRAY,
V121_CP_COMBINER_DARRAY,
V121_CP_COMBINER_F90_REAL,
V121_CP_COMBINER_F90_COMPLEX,
V121_CP_COMBINER_F90_INTEGER,
V121_CP_COMBINER_RESIZED,
V121_CP_HINTS, /* count of MPI hints used */
V121_CP_VIEWS, /* count of MPI set view calls */
V121_CP_MODE, /* mode of file */
V121_CP_BYTES_READ, /* total bytes read */
V121_CP_BYTES_WRITTEN, /* total bytes written */
V121_CP_MAX_BYTE_READ, /* highest offset byte read */
V121_CP_MAX_BYTE_WRITTEN, /* highest offset byte written */
V121_CP_CONSEC_READS, /* count of consecutive reads */
V121_CP_CONSEC_WRITES, /* count of consecutive writes */
V121_CP_SEQ_READS, /* count of sequential reads */
V121_CP_SEQ_WRITES, /* count of sequential writes */
V121_CP_RW_SWITCHES, /* number of times switched between read and write */
V121_CP_MEM_NOT_ALIGNED, /* count of accesses not mem aligned */
V121_CP_MEM_ALIGNMENT, /* mem alignment in bytes */
V121_CP_FILE_NOT_ALIGNED, /* count of accesses not file aligned */
V121_CP_FILE_ALIGNMENT, /* file alignment in bytes */
/* buckets */
V121_CP_SIZE_READ_0_100, /* count of posix read size ranges */
V121_CP_SIZE_READ_100_1K,
V121_CP_SIZE_READ_1K_10K,
V121_CP_SIZE_READ_10K_100K,
V121_CP_SIZE_READ_100K_1M,
V121_CP_SIZE_READ_1M_4M,
V121_CP_SIZE_READ_4M_10M,
V121_CP_SIZE_READ_10M_100M,
V121_CP_SIZE_READ_100M_1G,
V121_CP_SIZE_READ_1G_PLUS,
/* buckets */
V121_CP_SIZE_WRITE_0_100, /* count of posix write size ranges */
V121_CP_SIZE_WRITE_100_1K,
V121_CP_SIZE_WRITE_1K_10K,
V121_CP_SIZE_WRITE_10K_100K,
V121_CP_SIZE_WRITE_100K_1M,
V121_CP_SIZE_WRITE_1M_4M,
V121_CP_SIZE_WRITE_4M_10M,
V121_CP_SIZE_WRITE_10M_100M,
V121_CP_SIZE_WRITE_100M_1G,
V121_CP_SIZE_WRITE_1G_PLUS,
/* buckets */
V121_CP_SIZE_READ_AGG_0_100, /* count of MPI read size ranges */
V121_CP_SIZE_READ_AGG_100_1K,
V121_CP_SIZE_READ_AGG_1K_10K,
V121_CP_SIZE_READ_AGG_10K_100K,
V121_CP_SIZE_READ_AGG_100K_1M,
V121_CP_SIZE_READ_AGG_1M_4M,
V121_CP_SIZE_READ_AGG_4M_10M,
V121_CP_SIZE_READ_AGG_10M_100M,
V121_CP_SIZE_READ_AGG_100M_1G,
V121_CP_SIZE_READ_AGG_1G_PLUS,
V121_CP_SIZE_WRITE_AGG_0_100, /* count of MPI write size ranges */
V121_CP_SIZE_WRITE_AGG_100_1K,
V121_CP_SIZE_WRITE_AGG_1K_10K,
V121_CP_SIZE_WRITE_AGG_10K_100K,
V121_CP_SIZE_WRITE_AGG_100K_1M,
V121_CP_SIZE_WRITE_AGG_1M_4M,
V121_CP_SIZE_WRITE_AGG_4M_10M,
V121_CP_SIZE_WRITE_AGG_10M_100M,
V121_CP_SIZE_WRITE_AGG_100M_1G,
V121_CP_SIZE_WRITE_AGG_1G_PLUS,
/* buckets */
V121_CP_EXTENT_READ_0_100, /* count of MPI read extent ranges */
V121_CP_EXTENT_READ_100_1K,
V121_CP_EXTENT_READ_1K_10K,
V121_CP_EXTENT_READ_10K_100K,
V121_CP_EXTENT_READ_100K_1M,
V121_CP_EXTENT_READ_1M_4M,
V121_CP_EXTENT_READ_4M_10M,
V121_CP_EXTENT_READ_10M_100M,
V121_CP_EXTENT_READ_100M_1G,
V121_CP_EXTENT_READ_1G_PLUS,
/* buckets */
V121_CP_EXTENT_WRITE_0_100, /* count of MPI write extent ranges */
V121_CP_EXTENT_WRITE_100_1K,
V121_CP_EXTENT_WRITE_1K_10K,
V121_CP_EXTENT_WRITE_10K_100K,
V121_CP_EXTENT_WRITE_100K_1M,
V121_CP_EXTENT_WRITE_1M_4M,
V121_CP_EXTENT_WRITE_4M_10M,
V121_CP_EXTENT_WRITE_10M_100M,
V121_CP_EXTENT_WRITE_100M_1G,
V121_CP_EXTENT_WRITE_1G_PLUS,
/* counters */
V121_CP_STRIDE1_STRIDE, /* the four most frequently appearing strides */
V121_CP_STRIDE2_STRIDE,
V121_CP_STRIDE3_STRIDE,
V121_CP_STRIDE4_STRIDE,
V121_CP_STRIDE1_COUNT, /* count of each of the most frequent strides */
V121_CP_STRIDE2_COUNT,
V121_CP_STRIDE3_COUNT,
V121_CP_STRIDE4_COUNT,
V121_CP_ACCESS1_ACCESS, /* the four most frequently appearing access sizes */
V121_CP_ACCESS2_ACCESS,
V121_CP_ACCESS3_ACCESS,
V121_CP_ACCESS4_ACCESS,
V121_CP_ACCESS1_COUNT, /* count of each of the most frequent access sizes */
V121_CP_ACCESS2_COUNT,
V121_CP_ACCESS3_COUNT,
V121_CP_ACCESS4_COUNT,
V121_CP_NUM_INDICES,
};
/* floating point statistics */
enum f_darshan_indices_v121
{
V121_CP_F_OPEN_TIMESTAMP = 0, /* timestamp of first open */
V121_CP_F_READ_START_TIMESTAMP, /* timestamp of first read */
V121_CP_F_WRITE_START_TIMESTAMP, /* timestamp of first write */
V121_CP_F_CLOSE_TIMESTAMP, /* timestamp of last close */
V121_CP_F_READ_END_TIMESTAMP, /* timestamp of last read */
V121_CP_F_WRITE_END_TIMESTAMP, /* timestamp of last write */
V121_CP_F_POSIX_READ_TIME, /* cumulative posix read time */
V121_CP_F_POSIX_WRITE_TIME, /* cumulative posix write time */
V121_CP_F_POSIX_META_TIME, /* cumulative posix meta time */
V121_CP_F_MPI_META_TIME, /* cumulative mpi-io meta time */
V121_CP_F_MPI_READ_TIME, /* cumulative mpi-io read time */
V121_CP_F_MPI_WRITE_TIME, /* cumulative mpi-io write time */
V121_CP_F_NUM_INDICES,
};
/* statistics for any kind of file */
struct darshan_file_v121
{
uint64_t hash;
int rank;
int64_t counters[V121_CP_NUM_INDICES];
double fcounters[V121_CP_F_NUM_INDICES];
char name_suffix[CP_NAME_SUFFIX_LEN+1];
};
// old format
#include "darshan-logutils.h"
#define BUCKET1 0.20
#define BUCKET2 0.40
......@@ -208,82 +31,43 @@ int process_log(const char *fname, double *io_ratio, int *used_mpio, int *used_p
{
struct darshan_job job;
struct darshan_file cp_file;
struct darshan_file_v121 cp_file_v121;
char tmp_string[1024];
gzFile zfile;
darshan_fd zfile;
int ret;
int old;
int f_count;
double total_io_time;
double total_job_time;
int nofiles = 0;
zfile = gzopen(fname, "r");
zfile = darshan_log_open(fname);
if (zfile == NULL)
{
perror("gzopen");
perror("darshan_log_open");
return -1;
}
ret = gzread(zfile, &job, sizeof(job));
if (ret < sizeof(job))
ret = darshan_log_getjob(zfile, &job);
if (ret < 0)
{
perror("gzread");
perror("darshan_log_getjob");
fprintf(stderr, "%s\n", fname);
gzclose(zfile);
return -1;
}
if (strcmp(job.version_string, CP_VERSION) == 0)
{
old = 0;
}
else if (strcmp(job.version_string, "1.21") == 0)
{
old = 1;
}
else
{
printf("unknown version: %s\n", job.version_string);
gzclose(zfile);
darshan_log_close(zfile);
return -1;
}
ret = gzread(zfile, tmp_string, (CP_EXE_LEN+1));
if (ret < (CP_EXE_LEN+1))
ret = darshan_log_getexe(zfile, tmp_string, &nofiles);
if (ret < 0)
{
perror("gzread");
perror("darshan_log_getexe");
fprintf(stderr, "%s\n", fname);
gzclose(zfile);
darshan_log_close(zfile);
return -1;
}
f_count = 0;
total_io_time = 0.0;
if (old)
{
while ((ret = gzread(zfile, &cp_file_v121, sizeof(cp_file_v121))) == sizeof(cp_file_v121))
{
f_count += 1;
if (cp_file_v121.rank == -1)
*used_single = 1;
else
*used_multi = 1;
*used_mpio += cp_file_v121.counters[V121_CP_INDEP_OPENS];
*used_mpio += cp_file_v121.counters[V121_CP_COLL_OPENS];
total_io_time += cp_file_v121.fcounters[V121_CP_F_POSIX_READ_TIME];
total_io_time += cp_file_v121.fcounters[V121_CP_F_POSIX_WRITE_TIME];
total_io_time += cp_file_v121.fcounters[V121_CP_F_POSIX_META_TIME];
}
}
else
{
while ((ret = gzread(zfile, &cp_file, sizeof(cp_file))) == sizeof(cp_file))
while ((ret = darshan_log_getfile(zfile, &job, &cp_file)) == 1)
{
f_count += 1;
......@@ -303,8 +87,6 @@ int process_log(const char *fname, double *io_ratio, int *used_mpio, int *used_p
total_io_time += cp_file.fcounters[CP_F_POSIX_META_TIME];
}
}
total_job_time = (double)job.end_time - (double)job.start_time;
if (total_job_time < 1.0)
{
......@@ -320,7 +102,7 @@ int process_log(const char *fname, double *io_ratio, int *used_mpio, int *used_p
*io_ratio = 0.0;
}
gzclose(zfile);
darshan_log_close(zfile);
return 0;
}
......
......@@ -201,7 +201,7 @@ struct darshan_file_1_21
static void shift_missing_1_21(struct darshan_file* file);
/* a rather crude API for accessing raw binary darshan files */
darshan_fd darshan_log_open(char *name)
darshan_fd darshan_log_open(const char *name)
{
return gzopen(name, "r");
}
......@@ -319,6 +319,7 @@ int darshan_log_getexe(darshan_fd fd, char *buf, int *flag)
perror("gzread");
return(-1);
}
*flag = 0;
return (0);
}
......
......@@ -12,7 +12,7 @@ typedef gzFile darshan_fd;
extern char *darshan_names[];
extern char *darshan_f_names[];
darshan_fd darshan_log_open(char *name);
darshan_fd darshan_log_open(const char *name);
int darshan_log_getjob(darshan_fd file, struct darshan_job *job);
int darshan_log_getfile(darshan_fd fd,
struct darshan_job* job,
......
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