Skip to content

Commit

Permalink
Add "extra info" field to the records
Browse files Browse the repository at this point in the history
  • Loading branch information
roblatham00 committed Mar 14, 2024
1 parent 84862c8 commit 13c2bac
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 4 deletions.
33 changes: 33 additions & 0 deletions darshan-runtime/lib/darshan-dxt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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();
Expand All @@ -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();

Expand Down Expand Up @@ -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();
Expand All @@ -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();

Expand Down Expand Up @@ -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();
Expand All @@ -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();

Expand Down Expand Up @@ -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();
Expand Down
16 changes: 12 additions & 4 deletions darshan-util/darshan-dxt-logutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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++) {
Expand All @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions include/darshan-dxt-log-format.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#define DXT_POSIX_VER 1
#define DXT_MPIIO_VER 2

#define EXTRA_INFO_LEN 64
#define HOSTNAME_SIZE 64

/*
Expand All @@ -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,
Expand Down

0 comments on commit 13c2bac

Please sign in to comment.