Commit 7ec53306 authored by Shane Snyder's avatar Shane Snyder
Browse files

Merge branch 'master' into 'master'

Merge Darshan eXtended Tracing (DXT) to Darshan Main stream

See merge request !2
parents 45c766b9 61272682
/*
* Copyright (C) 2016 Intel Corporation.
* See COPYRIGHT in top-level directory.
*/
#ifndef __DARSHAN_DXT_LOG_FORMAT_H
#define __DARSHAN_DXT_LOG_FORMAT_H
/* current DXT log format version */
#define DXT_POSIX_VER 1
#define DXT_MPIIO_VER 1
#define HOSTNAME_SIZE 64
/*
* DXT, the segment_info structure maintains detailed Segment IO tracing
* information
*/
typedef struct segment_info {
int64_t offset;
int64_t length;
double start_time;
double end_time;
} segment_info;
#define X(a) a,
#undef X
/* file record structure for DXT files. a record is created and stored for
* every DXT file opened by the original application. For the DXT module,
* the record includes:
* - a darshan_base_record structure, which contains the record id & rank
* - integer file I/O statistics (open, read/write counts, etc)
* - floating point I/O statistics (timestamps, cumulative timers, etc.)
*/
struct dxt_file_record {
struct darshan_base_record base_rec;
int64_t shared_record; /* -1 means it is a shared file record */
char hostname[HOSTNAME_SIZE];
int64_t write_count;
int64_t read_count;
};
#endif /* __DARSHAN_DXT_LOG_FORMAT_H */
......@@ -117,6 +117,8 @@ struct darshan_base_record
#include "darshan-bgq-log-format.h"
#include "darshan-lustre-log-format.h"
#include "darshan-stdio-log-format.h"
/* DXT */
#include "darshan-dxt-log-format.h"
/* X-macro for keeping module ordering consistent */
/* NOTE: first val used to define module enum values,
......@@ -136,7 +138,10 @@ struct darshan_base_record
X(DARSHAN_PNETCDF_MOD, "PNETCDF", DARSHAN_PNETCDF_VER, &pnetcdf_logutils) \
X(DARSHAN_BGQ_MOD, "BG/Q", DARSHAN_BGQ_VER, &bgq_logutils) \
X(DARSHAN_LUSTRE_MOD, "LUSTRE", DARSHAN_LUSTRE_VER, &lustre_logutils) \
X(DARSHAN_STDIO_MOD, "STDIO", DARSHAN_STDIO_VER, &stdio_logutils)
X(DARSHAN_STDIO_MOD, "STDIO", DARSHAN_STDIO_VER, &stdio_logutils) \
/* DXT */ \
X(DXT_POSIX_MOD, "X_POSIX", DXT_POSIX_VER, &dxt_posix_logutils) \
X(DXT_MPIIO_MOD, "X_MPIIO", DXT_MPIIO_VER, &dxt_mpiio_logutils)
/* unique identifiers to distinguish between available darshan modules */
/* NOTES: - valid ids range from [0...DARSHAN_MAX_MODS-1]
......
......@@ -35,8 +35,8 @@ CFLAGS_SHARED = -DDARSHAN_CONFIG_H=\"darshan-runtime-config.h\" -I . -I$(srcdir)
LIBS = -lz @LIBBZ2@
DARSHAN_STATIC_MOD_OBJS = lib/darshan-posix.o lib/darshan-mpiio.o lib/darshan-hdf5.o lib/darshan-pnetcdf.o lib/darshan-stdio.o
DARSHAN_DYNAMIC_MOD_OBJS = lib/darshan-posix.po lib/darshan-mpiio.po lib/darshan-hdf5.po lib/darshan-pnetcdf.po lib/darshan-stdio.po
DARSHAN_STATIC_MOD_OBJS = lib/darshan-posix.o lib/darshan-mpiio.o lib/darshan-hdf5.o lib/darshan-pnetcdf.o lib/darshan-stdio.o lib/darshan-dxt.o
DARSHAN_DYNAMIC_MOD_OBJS = lib/darshan-posix.po lib/darshan-mpiio.po lib/darshan-hdf5.po lib/darshan-pnetcdf.po lib/darshan-stdio.po lib/darshan-dxt.po
ifdef DARSHAN_USE_BGQ
DARSHAN_STATIC_MOD_OBJS += lib/darshan-bgq.o
......@@ -127,6 +127,12 @@ lib/darshan-stdio.o: lib/darshan-stdio.c darshan.h darshan-common.h $(DARSHAN_LO
lib/darshan-stdio.po: lib/darshan-stdio.c darshan.h darshan-dynamic.h darshan-common.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-stdio-log-format.h | lib
$(CC) $(CFLAGS_SHARED) -c $< -o $@
lib/darshan-dxt.o: lib/darshan-dxt.c darshan.h darshan-common.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-dxt-log-format.h | lib
$(CC) $(CFLAGS) -c $< -o $@
lib/darshan-dxt.po: lib/darshan-dxt.c darshan.h darshan-dynamic.h darshan-common.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-dxt-log-format.h | lib
$(CC) $(CFLAGS_SHARED) -c $< -o $@
lib/lookup3.o: lib/lookup3.c
$(CC) $(CFLAGS) -c $< -o $@
......
......@@ -607,6 +607,12 @@ void darshan_core_shutdown()
final_core->log_hdr_p->mod_map[i].len =
gz_fp - final_core->log_hdr_p->mod_map[i].off;
/* XXX: DXT manages its own module memory buffers, so we need to
* explicitly free them
*/
if(i == DXT_POSIX_MOD || i == DXT_MPIIO_MOD)
free(mod_buf);
/* error out if the log append failed */
DARSHAN_MPI_CALL(PMPI_Allreduce)(&ret, &all_ret, 1, MPI_INT,
MPI_LOR, MPI_COMM_WORLD);
......
This diff is collapsed.
......@@ -87,10 +87,17 @@ static void mpiio_shutdown(
MPI_Comm mod_comm, darshan_record_id *shared_recs,
int shared_rec_count, void **mpiio_buf, int *mpiio_buf_sz);
/* extern DXT function defs */
extern void dxt_mpiio_write(darshan_record_id rec_id, int64_t length,
double start_time, double end_time);
extern void dxt_mpiio_read(darshan_record_id rec_id, int64_t length,
double start_time, double end_time);
static struct mpiio_runtime *mpiio_runtime = NULL;
static pthread_mutex_t mpiio_runtime_mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
static int instrumentation_disabled = 0;
static int my_rank = -1;
static int enable_dxt_io_trace = 0;
#define MPIIO_LOCK() pthread_mutex_lock(&mpiio_runtime_mutex)
#define MPIIO_UNLOCK() pthread_mutex_unlock(&mpiio_runtime_mutex)
......@@ -98,7 +105,9 @@ static int my_rank = -1;
#define MPIIO_PRE_RECORD() do { \
MPIIO_LOCK(); \
if(!instrumentation_disabled) { \
if(!mpiio_runtime) mpiio_runtime_initialize(); \
if(!mpiio_runtime) { \
mpiio_runtime_initialize(); \
} \
if(mpiio_runtime) break; \
} \
MPIIO_UNLOCK(); \
......@@ -154,6 +163,10 @@ static int my_rank = -1;
if(!rec_ref) break; \
DARSHAN_MPI_CALL(PMPI_Type_size)(__datatype, &size); \
size = size * __count; \
/* DXT to record detailed read tracing information */ \
if(enable_dxt_io_trace) { \
dxt_mpiio_read(rec_ref->file_rec->base_rec.id, size, __tm1, __tm2); \
} \
DARSHAN_BUCKET_INC(&(rec_ref->file_rec->counters[MPIIO_SIZE_READ_AGG_0_100]), size); \
darshan_common_val_counter(&rec_ref->access_root, &rec_ref->access_count, size, \
&(rec_ref->file_rec->counters[MPIIO_ACCESS1_ACCESS]), \
......@@ -183,6 +196,10 @@ static int my_rank = -1;
if(!rec_ref) break; \
DARSHAN_MPI_CALL(PMPI_Type_size)(__datatype, &size); \
size = size * __count; \
/* DXT to record detailed write tracing information */ \
if(enable_dxt_io_trace) { \
dxt_mpiio_write(rec_ref->file_rec->base_rec.id, size, __tm1, __tm2); \
} \
DARSHAN_BUCKET_INC(&(rec_ref->file_rec->counters[MPIIO_SIZE_WRITE_AGG_0_100]), size); \
darshan_common_val_counter(&rec_ref->access_root, &rec_ref->access_count, size, \
&(rec_ref->file_rec->counters[MPIIO_ACCESS1_ACCESS]), \
......@@ -844,6 +861,11 @@ static void mpiio_runtime_initialize()
}
memset(mpiio_runtime, 0, sizeof(*mpiio_runtime));
/* check if DXT (Darshan extended tracing) should be enabled */
if (getenv("ENABLE_DXT_IO_TRACE")) {
enable_dxt_io_trace = 1;
}
return;
}
......
......@@ -157,11 +157,18 @@ static void posix_shutdown(
MPI_Comm mod_comm, darshan_record_id *shared_recs,
int shared_rec_count, void **posix_buf, int *posix_buf_sz);
/* extern DXT function defs */
extern void dxt_posix_write(darshan_record_id rec_id, int64_t offset,
int64_t length, double start_time, double end_time);
extern void dxt_posix_read(darshan_record_id rec_id, int64_t offset,
int64_t length, double start_time, double end_time);
static struct posix_runtime *posix_runtime = NULL;
static pthread_mutex_t posix_runtime_mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
static int instrumentation_disabled = 0;
static int my_rank = -1;
static int darshan_mem_alignment = 1;
static int enable_dxt_io_trace = 0;
#define POSIX_LOCK() pthread_mutex_lock(&posix_runtime_mutex)
#define POSIX_UNLOCK() pthread_mutex_unlock(&posix_runtime_mutex)
......@@ -169,7 +176,9 @@ static int darshan_mem_alignment = 1;
#define POSIX_PRE_RECORD() do { \
POSIX_LOCK(); \
if(!instrumentation_disabled) { \
if(!posix_runtime) posix_runtime_initialize(); \
if(!posix_runtime) { \
posix_runtime_initialize(); \
} \
if(posix_runtime) break; \
} \
POSIX_UNLOCK(); \
......@@ -228,6 +237,10 @@ static int darshan_mem_alignment = 1;
this_offset = __pread_offset; \
else \
this_offset = rec_ref->offset; \
/* DXT to record detailed read tracing information */ \
if(enable_dxt_io_trace) { \
dxt_posix_read(rec_ref->file_rec->base_rec.id, this_offset, __ret, __tm1, __tm2); \
} \
if(this_offset > rec_ref->last_byte_read) \
rec_ref->file_rec->counters[POSIX_SEQ_READS] += 1; \
if(this_offset == (rec_ref->last_byte_read + 1)) \
......@@ -282,6 +295,10 @@ static int darshan_mem_alignment = 1;
this_offset = __pwrite_offset; \
else \
this_offset = rec_ref->offset; \
/* DXT to record detailed write tracing information */ \
if(enable_dxt_io_trace) { \
dxt_posix_write(rec_ref->file_rec->base_rec.id, this_offset, __ret, __tm1, __tm2); \
} \
if(this_offset > rec_ref->last_byte_written) \
rec_ref->file_rec->counters[POSIX_SEQ_WRITES] += 1; \
if(this_offset == (rec_ref->last_byte_written + 1)) \
......@@ -1257,6 +1274,11 @@ static void posix_runtime_initialize()
}
memset(posix_runtime, 0, sizeof(*posix_runtime));
/* check if DXT (Darshan extended tracing) should be enabled */
if (getenv("ENABLE_DXT_IO_TRACE")) {
enable_dxt_io_trace = 1;
}
return;
}
......
all: libdarshan-util.a darshan-null-logutils.o darshan-analyzer darshan-convert darshan-diff darshan-parser darshan-merge jenkins-hash-gen
all: libdarshan-util.a darshan-null-logutils.o darshan-analyzer darshan-convert darshan-diff darshan-parser darshan-dxt-parser darshan-merge jenkins-hash-gen
DESTDIR =
srcdir = @srcdir@
......@@ -13,10 +13,10 @@ libdir = $(DESTDIR)@libdir@
pkgconfigdir = $(DESTDIR)$(libdir)/pkgconfig
DARSHAN_LOG_FORMAT = $(srcdir)/../darshan-log-format.h
DARSHAN_MOD_LOG_FORMATS = $(srcdir)/../darshan-posix-log-format.h $(srcdir)/../darshan-mpiio-log-format.h $(srcdir)/../darshan-hdf5-log-format.h $(srcdir)/../darshan-pnetcdf-log-format.h $(srcdir)/../darshan-bgq-log-format.h $(srcdir)/../darshan-lustre-log-format.h $(srcdir)/../darshan-stdio-log-format.h
DARSHAN_MOD_LOGUTIL_HEADERS = darshan-posix-logutils.h darshan-mpiio-logutils.h darshan-hdf5-logutils.h darshan-pnetcdf-logutils.h darshan-bgq-logutils.h darshan-lustre-logutils.h darshan-stdio-logutils.h
DARSHAN_STATIC_MOD_OBJS = darshan-posix-logutils.o darshan-mpiio-logutils.o darshan-hdf5-logutils.o darshan-pnetcdf-logutils.o darshan-bgq-logutils.o darshan-lustre-logutils.o darshan-stdio-logutils.o
DARSHAN_DYNAMIC_MOD_OBJS = darshan-posix-logutils.po darshan-mpiio-logutils.po darshan-hdf5-logutils.po darshan-pnetcdf-logutils.po darshan-bgq-logutils.po darshan-lustre-logutils.po darshan-stdio-logutils.po
DARSHAN_MOD_LOG_FORMATS = $(srcdir)/../darshan-posix-log-format.h $(srcdir)/../darshan-mpiio-log-format.h $(srcdir)/../darshan-hdf5-log-format.h $(srcdir)/../darshan-pnetcdf-log-format.h $(srcdir)/../darshan-bgq-log-format.h $(srcdir)/../darshan-lustre-log-format.h $(srcdir)/../darshan-stdio-log-format.h $(srcdir)/../darshan-dxt-log-format.h
DARSHAN_MOD_LOGUTIL_HEADERS = darshan-posix-logutils.h darshan-mpiio-logutils.h darshan-hdf5-logutils.h darshan-pnetcdf-logutils.h darshan-bgq-logutils.h darshan-lustre-logutils.h darshan-stdio-logutils.h darshan-dxt-logutils.h
DARSHAN_STATIC_MOD_OBJS = darshan-posix-logutils.o darshan-mpiio-logutils.o darshan-hdf5-logutils.o darshan-pnetcdf-logutils.o darshan-bgq-logutils.o darshan-lustre-logutils.o darshan-stdio-logutils.o darshan-dxt-logutils.o
DARSHAN_DYNAMIC_MOD_OBJS = darshan-posix-logutils.po darshan-mpiio-logutils.po darshan-hdf5-logutils.po darshan-pnetcdf-logutils.po darshan-bgq-logutils.po darshan-lustre-logutils.po darshan-stdio-logutils.po darshan-dxt-logutils.po
DARSHAN_ENABLE_SHARED=@DARSHAN_ENABLE_SHARED@
......@@ -91,6 +91,11 @@ darshan-stdio-logutils.o: darshan-stdio-logutils.c darshan-logutils.h darshan-st
darshan-stdio-logutils.po: darshan-stdio-logutils.c darshan-logutils.h darshan-stdio-logutils.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-stdio-log-format.h | uthash-1.9.2
$(CC) $(CFLAGS_SHARED) -c $< -o $@
darshan-dxt-logutils.o: darshan-dxt-logutils.c darshan-logutils.h darshan-dxt-logutils.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-dxt-log-format.h | uthash-1.9.2
$(CC) $(CFLAGS) -c $< -o $@
darshan-dxt-logutils.po: darshan-dxt-logutils.c darshan-logutils.h darshan-dxt-logutils.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-dxt-log-format.h | uthash-1.9.2
$(CC) $(CFLAGS_SHARED) -c $< -o $@
libdarshan-util.a: darshan-logutils.o $(DARSHAN_STATIC_MOD_OBJS)
ar rcs libdarshan-util.a $^
......@@ -115,6 +120,9 @@ darshan-diff: darshan-diff.c darshan-logutils.h $(DARSHAN_LOG_FORMAT) $(DARSHAN_
darshan-parser: darshan-parser.c darshan-logutils.h $(DARSHAN_LOG_FORMAT) $(DARSHAN_MOD_LOGUTIL_HEADERS) $(DARSHAN_MOD_LOG_FORMATS) libdarshan-util.a | uthash-1.9.2
$(CC) $(CFLAGS) $(LDFLAGS) $< libdarshan-util.a -o $@ $(LIBS)
darshan-dxt-parser: darshan-dxt-parser.c darshan-logutils.h $(DARSHAN_LOG_FORMAT) $(DARSHAN_MOD_LOGUTIL_HEADERS) $(DARSHAN_MOD_LOG_FORMATS) libdarshan-util.a | uthash-1.9.2
$(CC) $(CFLAGS) $(LDFLAGS) $< libdarshan-util.a -o $@ $(LIBS)
darshan-merge: darshan-merge.c darshan-logutils.h $(DARSHAN_LOG_FORMAT) $(DARSHAN_MOD_LOGUTIL_HEADERS) $(DARSHAN_MOD_LOG_FORMATS) libdarshan-util.a | uthash-1.9.2
$(CC) $(CFLAGS) $(LDFLAGS) $< libdarshan-util.a -o $@ $(LIBS)
......@@ -133,6 +141,7 @@ install:: all
install -m 755 darshan-convert $(bindir)
install -m 755 darshan-diff $(bindir)
install -m 755 darshan-parser $(bindir)
install -m 755 darshan-dxt-parser $(bindir)
install -m 755 darshan-merge $(bindir)
install -m 755 $(srcdir)/darshan-summary-per-file.sh $(bindir)
install -m 755 libdarshan-util.a $(libdir)
......@@ -148,6 +157,7 @@ endif
install -m 644 $(srcdir)/darshan-null-logutils.h $(includedir)
install -m 644 $(srcdir)/darshan-lustre-logutils.h $(includedir)
install -m 644 $(srcdir)/darshan-stdio-logutils.h $(includedir)
install -m 644 $(srcdir)/darshan-dxt-logutils.h $(includedir)
install -m 644 $(srcdir)/../darshan-null-log-format.h $(includedir)
install -m 644 $(srcdir)/../darshan-posix-log-format.h $(includedir)
install -m 644 $(srcdir)/../darshan-mpiio-log-format.h $(includedir)
......@@ -156,6 +166,7 @@ endif
install -m 644 $(srcdir)/../darshan-bgq-log-format.h $(includedir)
install -m 644 $(srcdir)/../darshan-lustre-log-format.h $(includedir)
install -m 644 $(srcdir)/../darshan-stdio-log-format.h $(includedir)
install -m 644 $(srcdir)/../darshan-dxt-log-format.h $(includedir)
install -d $(includedir)/uthash-1.9.2
install -d $(includedir)/uthash-1.9.2/src
install -m 644 uthash-1.9.2/src/uthash.h $(includedir)/uthash-1.9.2/src/
......@@ -172,7 +183,7 @@ endif
clean::
rm -f *.o *.po *.a *.so darshan-analyzer darshan-convert darshan-diff darshan-parser darshan-merge jenkins-hash-gen
rm -f *.o *.po *.a *.so darshan-analyzer darshan-convert darshan-diff darshan-parser darshan-dxt-parser darshan-merge jenkins-hash-gen
distclean:: clean
rm -f darshan-util-config.h aclocal.m4 autom4te.cache/* config.status config.log Makefile darshan-job-summary/bin/darshan-job-summary.pl maint/darshan-util.pc
......
/*
* Copyright (C) 2016 Intel Corporation.
* See COPYRIGHT notice in top-level directory.
*
*/
#define _GNU_SOURCE
#include "darshan-util-config.h"
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <stdlib.h>
#include <unistd.h>
#include <inttypes.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include "darshan-logutils.h"
static int dxt_log_get_posix_file(darshan_fd fd, void** dxt_posix_buf_p);
static int dxt_log_put_posix_file(darshan_fd fd, void* dxt_posix_buf);
static int dxt_log_get_mpiio_file(darshan_fd fd, void** dxt_mpiio_buf_p);
static int dxt_log_put_mpiio_file(darshan_fd fd, void* dxt_mpiio_buf);
static void dxt_swap_file_record(struct dxt_file_record *file_rec);
static void dxt_swap_file_record(struct dxt_file_record *file_rec);
struct darshan_mod_logutil_funcs dxt_posix_logutils =
{
.log_get_record = &dxt_log_get_posix_file,
.log_put_record = &dxt_log_put_posix_file,
.log_print_record = NULL,
.log_print_description = NULL,
.log_print_diff = NULL,
.log_agg_records = NULL,
};
struct darshan_mod_logutil_funcs dxt_mpiio_logutils =
{
.log_get_record = &dxt_log_get_mpiio_file,
.log_put_record = &dxt_log_put_mpiio_file,
.log_print_record = NULL,
.log_print_description = NULL,
.log_print_diff = NULL,
.log_agg_records = NULL,
};
static void dxt_swap_file_record(struct dxt_file_record *file_rec)
{
DARSHAN_BSWAP64(&file_rec->base_rec.id);
DARSHAN_BSWAP64(&file_rec->base_rec.rank);
DARSHAN_BSWAP64(&file_rec->shared_record);
DARSHAN_BSWAP64(&file_rec->write_count);
DARSHAN_BSWAP64(&file_rec->read_count);
}
static void dxt_swap_segments(struct dxt_file_record *file_rec)
{
int i;
segment_info *tmp_seg;
tmp_seg = (segment_info *)((void *)file_rec + sizeof(struct dxt_file_record));
for(i = 0; i < (file_rec->write_count + file_rec->read_count); i++)
{
DARSHAN_BSWAP64(&tmp_seg->offset);
DARSHAN_BSWAP64(&tmp_seg->length);
DARSHAN_BSWAP64(&tmp_seg->start_time);
DARSHAN_BSWAP64(&tmp_seg->end_time);
tmp_seg++;
}
}
static int dxt_log_get_posix_file(darshan_fd fd, void** dxt_posix_buf_p)
{
struct dxt_file_record *rec = *((struct dxt_file_record **)dxt_posix_buf_p);
struct dxt_file_record tmp_rec;
int ret;
int64_t io_trace_size;
if(fd->mod_map[DXT_POSIX_MOD].len == 0)
return(0);
ret = darshan_log_get_mod(fd, DXT_POSIX_MOD, &tmp_rec,
sizeof(struct dxt_file_record));
if(ret < 0)
return (-1);
else if(ret < sizeof(struct dxt_file_record))
return (0);
if (fd->swap_flag)
{
/* swap bytes if necessary */
dxt_swap_file_record(&tmp_rec);
}
io_trace_size = (tmp_rec.write_count + tmp_rec.read_count) *
sizeof(segment_info);
if (*dxt_posix_buf_p == NULL)
{
rec = malloc(sizeof(struct dxt_file_record) + io_trace_size);
if (!rec)
return(-1);
}
memcpy(rec, &tmp_rec, sizeof(struct dxt_file_record));
if (io_trace_size > 0)
{
void *tmp_p = (void *)rec + sizeof(struct dxt_file_record);
ret = darshan_log_get_mod(fd, DXT_POSIX_MOD, tmp_p,
io_trace_size);
if (ret < io_trace_size)
ret = -1;
else
{
ret = 1;
if(fd->swap_flag)
{
/* byte swap trace data if necessary */
dxt_swap_segments(rec);
}
}
}
else
{
ret = 1;
}
if(*dxt_posix_buf_p == NULL)
{
if(ret == 1)
*dxt_posix_buf_p = rec;
else
free(rec);
}
return(ret);
}
static int dxt_log_get_mpiio_file(darshan_fd fd, void** dxt_mpiio_buf_p)
{
struct dxt_file_record *rec = *((struct dxt_file_record **)dxt_mpiio_buf_p);
struct dxt_file_record tmp_rec;
int ret;
int64_t io_trace_size;
if(fd->mod_map[DXT_MPIIO_MOD].len == 0)
return(0);
ret = darshan_log_get_mod(fd, DXT_MPIIO_MOD, &tmp_rec,
sizeof(struct dxt_file_record));
if(ret < 0)
return (-1);
else if(ret < sizeof(struct dxt_file_record))
return (0);
if (fd->swap_flag)
{
/* swap bytes if necessary */
dxt_swap_file_record(&tmp_rec);
}
io_trace_size = (tmp_rec.write_count + tmp_rec.read_count) *
sizeof(segment_info);
if (*dxt_mpiio_buf_p == NULL)
{
rec = malloc(sizeof(struct dxt_file_record) + io_trace_size);
if (!rec)
return(-1);
}
memcpy(rec, &tmp_rec, sizeof(struct dxt_file_record));
if (io_trace_size > 0)
{
void *tmp_p = (void *)rec + sizeof(struct dxt_file_record);
ret = darshan_log_get_mod(fd, DXT_MPIIO_MOD, tmp_p,
io_trace_size);
if (ret < io_trace_size)
ret = -1;
else
{
ret = 1;
if(fd->swap_flag)
{
/* byte swap trace data if necessary */
dxt_swap_segments(rec);
}
}
}
else
{
ret = 1;
}
if(*dxt_mpiio_buf_p == NULL)
{
if(ret == 1)
*dxt_mpiio_buf_p = rec;
else
free(rec);
}
return(ret);
}
static int dxt_log_put_posix_file(darshan_fd fd, void* dxt_posix_buf)
{
struct dxt_file_record *file_rec =
(struct dxt_file_record *)dxt_posix_buf;
int rec_size = sizeof(struct dxt_file_record) + (sizeof(segment_info) *
(file_rec->write_count + file_rec->read_count));
int ret;
ret = darshan_log_put_mod(fd, DXT_POSIX_MOD, file_rec,
rec_size, DXT_POSIX_VER);
if(ret < 0)
return(-1);
return(0);
}
static int dxt_log_put_mpiio_file(darshan_fd fd, void* dxt_mpiio_buf)
{
struct dxt_file_record *file_rec =
(struct dxt_file_record *)dxt_mpiio_buf;
int rec_size = sizeof(struct dxt_file_record) + (sizeof(segment_info) *
(file_rec->write_count + file_rec->read_count));
int ret;
ret = darshan_log_put_mod(fd, DXT_MPIIO_MOD, file_rec,
rec_size, DXT_MPIIO_VER);
if(ret < 0)
return(-1);
return(0);
}
void dxt_log_print_posix_file(void *posix_file_rec, char *file_name,
char *mnt_pt, char *fs_type, struct lustre_record_ref *lustre_rec_ref)
{
struct dxt_file_record *file_rec =
(struct dxt_file_record *)posix_file_rec;
int64_t offset;
int64_t length;
double start_time;
double end_time;
int i;
darshan_record_id f_id = file_rec->base_rec.id;
int64_t rank = file_rec->base_rec.rank;
char *hostname = file_rec->hostname;
int64_t write_count = file_rec->write_count;
int64_t read_count = file_rec->read_count;
segment_info *io_trace = (segment_info *)
((void *)file_rec + sizeof(struct dxt_file_record));
/* Lustre File System */
struct darshan_lustre_record *rec;
int lustreFS = !strcmp(fs_type, "lustre");
int32_t stripe_size;
int32_t stripe_count;
int64_t cur_offset;
int print_count;
int ost_idx;
if (!lustre_rec_ref) {
lustreFS = 0;
}
printf("\n# DXT, file_id: %" PRIu64 ", file_name: %s\n", f_id, file_name);
printf("# DXT, rank: %d, hostname: %s\n", rank, hostname);
printf("# DXT, write_count: %d, read_count: %d\n",
write_count, read_count);
printf("# DXT, mnt_pt: %s, fs_type: %s\n", mnt_pt, fs_type);
if (lustreFS) {
rec = lustre_rec_ref->rec;
stripe_size = rec->counters[LUSTRE_STRIPE_SIZE];
stripe_count = rec->counters[LUSTRE_STRIPE_WIDTH];
printf("# DXT, Lustre stripe_size: %d, Lustre stripe_count: %d\n", stripe_size, stripe_count);
for (i = 0; i < stripe_count; i++) {
printf("# DXT, Lustre OSTs: %d\n", (rec->ost_ids)[i]);
}
}
/* Print header */
printf("# Module Rank Wt/Rd Segment Offset Length Start(s) End(s)");
if (lustreFS) {
printf(" [OST]");
}
printf("\n");
/* Print IO Traces information */
for (i = 0; i < write_count; i++) {
offset = io_trace[i].offset;
length = io_trace[i].length;
start_time = io_trace[i].start_time;
end_time = io_trace[i].end_time;
printf("%8s%8d%7s%9lld%16lld%13lld%12.4f%12.4f", "X_POSIX", rank, "write", i, offset, length, start_time, end_time);
if (lustreFS) {
cur_offset = offset;
ost_idx = (offset / stripe_size) % stripe_count;