From 13c2bac779452a599d1deee818d0022b059b64fd Mon Sep 17 00:00:00 2001 From: Rob Latham Date: Wed, 14 Dec 2016 16:04:58 -0600 Subject: [PATCH] Add "extra info" field to the records --- darshan-runtime/lib/darshan-dxt.c | 33 +++++++++++++++++++++++++++++ darshan-util/darshan-dxt-logutils.c | 16 ++++++++++---- include/darshan-dxt-log-format.h | 2 ++ 3 files changed, 47 insertions(+), 4 deletions(-) diff --git a/darshan-runtime/lib/darshan-dxt.c b/darshan-runtime/lib/darshan-dxt.c index 7412b4e4c..ba023b5e5 100644 --- a/darshan-runtime/lib/darshan-dxt.c +++ b/darshan-runtime/lib/darshan-dxt.c @@ -227,6 +227,7 @@ void dxt_posix_write(darshan_record_id rec_id, int64_t offset, { struct dxt_file_record_ref* rec_ref = NULL; struct dxt_file_record *file_rec; + char *s; DXT_LOCK(); @@ -262,6 +263,13 @@ void dxt_posix_write(darshan_record_id rec_id, int64_t offset, rec_ref->write_traces[file_rec->write_count].length = length; rec_ref->write_traces[file_rec->write_count].start_time = start_time; rec_ref->write_traces[file_rec->write_count].end_time = end_time; + s = getenv("DARSHAN_DXT_EXTRA_INFO"); + if (s != NULL) { + strncpy(rec_ref->write_traces[file_rec->write_count].extra_info, s, + EXTRA_INFO_LEN-1); + } else { + rec_ref->write_traces[file_rec->write_count].extra_info[0] = '\0'; + } file_rec->write_count += 1; DXT_UNLOCK(); @@ -272,6 +280,7 @@ void dxt_posix_read(darshan_record_id rec_id, int64_t offset, { struct dxt_file_record_ref* rec_ref = NULL; struct dxt_file_record *file_rec; + char *s; DXT_LOCK(); @@ -307,6 +316,14 @@ void dxt_posix_read(darshan_record_id rec_id, int64_t offset, rec_ref->read_traces[file_rec->read_count].length = length; rec_ref->read_traces[file_rec->read_count].start_time = start_time; rec_ref->read_traces[file_rec->read_count].end_time = end_time; + s = getenv("DARSHAN_DXT_EXTRA_INFO"); + if (s != NULL) { + strncpy(rec_ref->read_traces[file_rec->read_count].extra_info, s, + EXTRA_INFO_LEN-1); + } else { + rec_ref->write_traces[file_rec->write_count].extra_info[0] = '\0'; + } + file_rec->read_count += 1; DXT_UNLOCK(); @@ -317,6 +334,7 @@ void dxt_mpiio_write(darshan_record_id rec_id, int64_t offset, { struct dxt_file_record_ref* rec_ref = NULL; struct dxt_file_record *file_rec; + char *s; DXT_LOCK(); @@ -352,6 +370,13 @@ void dxt_mpiio_write(darshan_record_id rec_id, int64_t offset, rec_ref->write_traces[file_rec->write_count].offset = offset; rec_ref->write_traces[file_rec->write_count].start_time = start_time; rec_ref->write_traces[file_rec->write_count].end_time = end_time; + s = getenv("DARSHAN_DXT_EXTRA_INFO"); + if (s != NULL) { + strncpy(rec_ref->write_traces[file_rec->write_count].extra_info, s, + EXTRA_INFO_LEN-1); + } else { + rec_ref->write_traces[file_rec->write_count].extra_info[0] = '\0'; + } file_rec->write_count += 1; DXT_UNLOCK(); @@ -362,6 +387,7 @@ void dxt_mpiio_read(darshan_record_id rec_id, int64_t offset, { struct dxt_file_record_ref* rec_ref = NULL; struct dxt_file_record *file_rec; + char *s; DXT_LOCK(); @@ -397,6 +423,13 @@ void dxt_mpiio_read(darshan_record_id rec_id, int64_t offset, rec_ref->read_traces[file_rec->read_count].offset = offset; rec_ref->read_traces[file_rec->read_count].start_time = start_time; rec_ref->read_traces[file_rec->read_count].end_time = end_time; + s = getenv("DARSHAN_DXT_EXTRA_INFO"); + if (s != NULL) { + strncpy(rec_ref->read_traces[file_rec->read_count].extra_info, s, + EXTRA_INFO_LEN-1); + } else { + rec_ref->write_traces[file_rec->write_count].extra_info[0] = '\0'; + } file_rec->read_count += 1; DXT_UNLOCK(); diff --git a/darshan-util/darshan-dxt-logutils.c b/darshan-util/darshan-dxt-logutils.c index 28eb50a52..aa7e2415d 100644 --- a/darshan-util/darshan-dxt-logutils.c +++ b/darshan-util/darshan-dxt-logutils.c @@ -294,6 +294,7 @@ void dxt_log_print_posix_file(void *posix_file_rec, char *file_name, int64_t length; double start_time; double end_time; + char *extra_info; int i; darshan_record_id f_id = file_rec->base_rec.id; @@ -352,8 +353,10 @@ void dxt_log_print_posix_file(void *posix_file_rec, char *file_name, length = io_trace[i].length; start_time = io_trace[i].start_time; end_time = io_trace[i].end_time; + extra_info = io_trace[i].extra_info; + if (*extra_info == '\0') *extra_info = ""; - printf("%8s%8" PRId64 "%7s%9d%16" PRId64 "%16" PRId64 "%12.4f%12.4f", "X_POSIX", rank, "write", i, offset, length, start_time, end_time); + printf("%8s%8" PRId64 "%7s%9d%16" PRId64 "%16" PRId64 "%12.4f%12.4f %s", "X_POSIX", rank, "write", i, offset, length, start_time, end_time, extra_info); if (lustreFS) { cur_offset = offset; @@ -380,8 +383,10 @@ void dxt_log_print_posix_file(void *posix_file_rec, char *file_name, length = io_trace[i].length; start_time = io_trace[i].start_time; end_time = io_trace[i].end_time; + extra_info = io_trace[i].extra_info; + if (extra_info == NULL) extra_info = ""; - printf("%8s%8" PRId64 "%7s%9d%16" PRId64 "%16" PRId64 "%12.4f%12.4f", "X_POSIX", rank, "read", (int)(i - write_count), offset, length, start_time, end_time); + printf("%8s%8" PRId64 "%7s%9d%16" PRId64 "%16" PRId64 "%12.4f%12.4f %s", "X_POSIX", rank, "read", (int)(i - write_count), offset, length, start_time, end_time, extra_info); if (lustreFS) { cur_offset = offset; @@ -415,6 +420,7 @@ void dxt_log_print_mpiio_file(void *mpiio_file_rec, char *file_name, int64_t offset; double start_time; double end_time; + char * extra_info; int i; darshan_record_id f_id = file_rec->base_rec.id; @@ -443,8 +449,10 @@ void dxt_log_print_mpiio_file(void *mpiio_file_rec, char *file_name, length = io_trace[i].length; start_time = io_trace[i].start_time; end_time = io_trace[i].end_time; + extra_info = io_trace[i].extra_info; + if (extra_info == NULL) extra_info = ""; - printf("%8s%8" PRId64 "%7s%9d%16" PRId64 "%16" PRId64 "%12.4f%12.4f\n", "X_MPIIO", rank, "write", i, offset, length, start_time, end_time); + printf("%8s%8" PRId64 "%7s%9d%16" PRId64 "%16" PRId64 "%12.4f%12.4f %s\n", "X_MPIIO", rank, "write", i, offset, length, start_time, end_time, extra_info); } for (i = write_count; i < write_count + read_count; i++) { @@ -453,7 +461,7 @@ void dxt_log_print_mpiio_file(void *mpiio_file_rec, char *file_name, start_time = io_trace[i].start_time; end_time = io_trace[i].end_time; - printf("%8s%8" PRId64 "%7s%9d%16" PRId64 "%16" PRId64 "%12.4f%12.4f\n", "X_MPIIO", rank, "read", (int)(i - write_count), offset, length, start_time, end_time); + printf("%8s%8" PRId64 "%7s%9d%16" PRId64 "%16" PRId64 "%12.4f%12.4f %s\n", "X_MPIIO", rank, "read", (int)(i - write_count), offset, length, start_time, end_time, extra_info); } return; diff --git a/include/darshan-dxt-log-format.h b/include/darshan-dxt-log-format.h index b31fc9928..5f40ae837 100644 --- a/include/darshan-dxt-log-format.h +++ b/include/darshan-dxt-log-format.h @@ -10,6 +10,7 @@ #define DXT_POSIX_VER 1 #define DXT_MPIIO_VER 2 +#define EXTRA_INFO_LEN 64 #define HOSTNAME_SIZE 64 /* @@ -21,6 +22,7 @@ typedef struct segment_info { int64_t length; double start_time; double end_time; + char extra_info[EXTRA_INFO_LEN]; } segment_info; #define X(a) a,