Commit 5c5f5334 authored by Shane Snyder's avatar Shane Snyder

Merge branch 'dev-stdio'

Conflicts:
	darshan-log-format.h
	darshan-runtime/Makefile.in
	darshan-util/Makefile.in
	darshan-util/darshan-logutils.h
parents 2770f997 06b84605
......@@ -112,6 +112,7 @@ struct darshan_base_record
#include "darshan-pnetcdf-log-format.h"
#include "darshan-bgq-log-format.h"
#include "darshan-lustre-log-format.h"
#include "darshan-stdio-log-format.h"
/* X-macro for keeping module ordering consistent */
/* NOTE: first val used to define module enum values,
......@@ -130,7 +131,8 @@ struct darshan_base_record
X(DARSHAN_HDF5_MOD, "HDF5", DARSHAN_HDF5_VER, &hdf5_logutils) \
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_LUSTRE_MOD, "LUSTRE", DARSHAN_LUSTRE_VER, &lustre_logutils) \
X(DARSHAN_STDIO_MOD, "STDIO", DARSHAN_STDIO_VER, &stdio_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
DARSHAN_DYNAMIC_MOD_OBJS = lib/darshan-posix.po lib/darshan-mpiio.po lib/darshan-hdf5.po lib/darshan-pnetcdf.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
DARSHAN_DYNAMIC_MOD_OBJS = lib/darshan-posix.po lib/darshan-mpiio.po lib/darshan-hdf5.po lib/darshan-pnetcdf.po lib/darshan-stdio.po
ifdef DARSHAN_USE_BGQ
DARSHAN_STATIC_MOD_OBJS += lib/darshan-bgq.o
......@@ -121,6 +121,12 @@ lib/darshan-lustre.o: lib/darshan-lustre.c darshan-lustre.h darshan.h darshan-co
lib/darshan-lustre.po: lib/darshan-lustre.c darshan-lustre.h darshan.h darshan-dynamic.h darshan-common.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-lustre-log-format.h | lib
$(CC) $(CFLAGS_SHARED) -c $< -o $@
lib/darshan-stdio.o: lib/darshan-stdio.c darshan.h darshan-common.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-stdio-log-format.h | lib
$(CC) $(CFLAGS) -c $< -o $@
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/lookup3.o: lib/lookup3.c
$(CC) $(CFLAGS) -c $< -o $@
......@@ -172,6 +178,7 @@ endif
install -m 644 $(srcdir)/share/ld-opts/darshan-posix-ld-opts $(datarootdir)/ld-opts/darshan-posix-ld-opts
install -m 644 $(srcdir)/share/ld-opts/darshan-hdf5-ld-opts $(datarootdir)/ld-opts/darshan-hdf5-ld-opts
install -m 644 $(srcdir)/share/ld-opts/darshan-pnetcdf-ld-opts $(datarootdir)/ld-opts/darshan-pnetcdf-ld-opts
install -m 644 $(srcdir)/share/ld-opts/darshan-stdio-ld-opts $(datarootdir)/ld-opts/darshan-stdio-ld-opts
ifdef ENABLE_MMAP_LOGS
install -m 755 share/darshan-mmap-epilog.sh $(datarootdir)/darshan-mmap-epilog.sh
endif
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -60,6 +60,9 @@
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
......
......@@ -45,8 +45,6 @@ DARSHAN_FORWARD_DECL(open, int, (const char *path, int flags, ...));
DARSHAN_FORWARD_DECL(open64, int, (const char *path, int flags, ...));
DARSHAN_FORWARD_DECL(creat, int, (const char* path, mode_t mode));
DARSHAN_FORWARD_DECL(creat64, int, (const char* path, mode_t mode));
DARSHAN_FORWARD_DECL(fopen, FILE*, (const char *path, const char *mode));
DARSHAN_FORWARD_DECL(fopen64, FILE*, (const char *path, const char *mode));
DARSHAN_FORWARD_DECL(mkstemp, int, (char *template));
DARSHAN_FORWARD_DECL(mkostemp, int, (char *template, int flags));
DARSHAN_FORWARD_DECL(mkstemps, int, (char *template, int suffixlen));
......@@ -59,11 +57,8 @@ DARSHAN_FORWARD_DECL(pread64, ssize_t, (int fd, void *buf, size_t count, off64_t
DARSHAN_FORWARD_DECL(pwrite64, ssize_t, (int fd, const void *buf, size_t count, off64_t offset));
DARSHAN_FORWARD_DECL(readv, ssize_t, (int fd, const struct iovec *iov, int iovcnt));
DARSHAN_FORWARD_DECL(writev, ssize_t, (int fd, const struct iovec *iov, int iovcnt));
DARSHAN_FORWARD_DECL(fread, size_t, (void *ptr, size_t size, size_t nmemb, FILE *stream));
DARSHAN_FORWARD_DECL(fwrite, size_t, (const void *ptr, size_t size, size_t nmemb, FILE *stream));
DARSHAN_FORWARD_DECL(lseek, off_t, (int fd, off_t offset, int whence));
DARSHAN_FORWARD_DECL(lseek64, off64_t, (int fd, off64_t offset, int whence));
DARSHAN_FORWARD_DECL(fseek, int, (FILE *stream, long offset, int whence));
DARSHAN_FORWARD_DECL(__xstat, int, (int vers, const char* path, struct stat *buf));
DARSHAN_FORWARD_DECL(__xstat64, int, (int vers, const char* path, struct stat64 *buf));
DARSHAN_FORWARD_DECL(__lxstat, int, (int vers, const char* path, struct stat *buf));
......@@ -75,7 +70,6 @@ DARSHAN_FORWARD_DECL(mmap64, void*, (void *addr, size_t length, int prot, int fl
DARSHAN_FORWARD_DECL(fsync, int, (int fd));
DARSHAN_FORWARD_DECL(fdatasync, int, (int fd));
DARSHAN_FORWARD_DECL(close, int, (int fd));
DARSHAN_FORWARD_DECL(fclose, int, (FILE *fp));
DARSHAN_FORWARD_DECL(aio_read, int, (struct aiocb *aiocbp));
DARSHAN_FORWARD_DECL(aio_write, int, (struct aiocb *aiocbp));
DARSHAN_FORWARD_DECL(aio_read64, int, (struct aiocb64 *aiocbp));
......@@ -197,7 +191,7 @@ static int darshan_mem_alignment = 1;
POSIX_UNLOCK(); \
} while(0)
#define POSIX_RECORD_OPEN(__ret, __path, __mode, __stream_flag, __tm1, __tm2) do { \
#define POSIX_RECORD_OPEN(__ret, __path, __mode, __tm1, __tm2) do { \
darshan_record_id rec_id; \
struct posix_file_record_ref *rec_ref; \
char *newpath; \
......@@ -220,9 +214,6 @@ static int darshan_mem_alignment = 1;
rec_ref->offset = 0; \
rec_ref->last_byte_written = 0; \
rec_ref->last_byte_read = 0; \
if(__stream_flag)\
rec_ref->file_rec->counters[POSIX_FOPENS] += 1; \
else \
rec_ref->file_rec->counters[POSIX_OPENS] += 1; \
if(rec_ref->file_rec->fcounters[POSIX_F_OPEN_TIMESTAMP] == 0 || \
rec_ref->file_rec->fcounters[POSIX_F_OPEN_TIMESTAMP] > __tm1) \
......@@ -234,7 +225,7 @@ static int darshan_mem_alignment = 1;
if(newpath != __path) free(newpath); \
} while(0)
#define POSIX_RECORD_READ(__ret, __fd, __pread_flag, __pread_offset, __aligned, __stream_flag, __tm1, __tm2) do { \
#define POSIX_RECORD_READ(__ret, __fd, __pread_flag, __pread_offset, __aligned, __tm1, __tm2) do { \
struct posix_file_record_ref* rec_ref; \
size_t stride; \
int64_t this_offset; \
......@@ -261,9 +252,6 @@ static int darshan_mem_alignment = 1;
if(rec_ref->file_rec->counters[POSIX_MAX_BYTE_READ] < (this_offset + __ret - 1)) \
rec_ref->file_rec->counters[POSIX_MAX_BYTE_READ] = (this_offset + __ret - 1); \
rec_ref->file_rec->counters[POSIX_BYTES_READ] += __ret; \
if(__stream_flag) \
rec_ref->file_rec->counters[POSIX_FREADS] += 1; \
else \
rec_ref->file_rec->counters[POSIX_READS] += 1; \
DARSHAN_BUCKET_INC(&(rec_ref->file_rec->counters[POSIX_SIZE_READ_0_100]), __ret); \
darshan_common_val_counter(&rec_ref->access_root, &rec_ref->access_count, __ret, \
......@@ -291,7 +279,7 @@ static int darshan_mem_alignment = 1;
__tm1, __tm2, rec_ref->last_read_end); \
} while(0)
#define POSIX_RECORD_WRITE(__ret, __fd, __pwrite_flag, __pwrite_offset, __aligned, __stream_flag, __tm1, __tm2) do { \
#define POSIX_RECORD_WRITE(__ret, __fd, __pwrite_flag, __pwrite_offset, __aligned, __tm1, __tm2) do { \
struct posix_file_record_ref* rec_ref; \
size_t stride; \
int64_t this_offset; \
......@@ -318,9 +306,6 @@ static int darshan_mem_alignment = 1;
if(rec_ref->file_rec->counters[POSIX_MAX_BYTE_WRITTEN] < (this_offset + __ret - 1)) \
rec_ref->file_rec->counters[POSIX_MAX_BYTE_WRITTEN] = (this_offset + __ret - 1); \
rec_ref->file_rec->counters[POSIX_BYTES_WRITTEN] += __ret; \
if(__stream_flag) \
rec_ref->file_rec->counters[POSIX_FWRITES] += 1; \
else \
rec_ref->file_rec->counters[POSIX_WRITES] += 1; \
DARSHAN_BUCKET_INC(&(rec_ref->file_rec->counters[POSIX_SIZE_WRITE_0_100]), __ret); \
darshan_common_val_counter(&rec_ref->access_root, &rec_ref->access_count, __ret, \
......@@ -404,7 +389,7 @@ int DARSHAN_DECL(open)(const char *path, int flags, ...)
}
POSIX_PRE_RECORD();
POSIX_RECORD_OPEN(ret, path, mode, 0, tm1, tm2);
POSIX_RECORD_OPEN(ret, path, mode, tm1, tm2);
POSIX_POST_RECORD();
return(ret);
......@@ -437,7 +422,7 @@ int DARSHAN_DECL(open64)(const char *path, int flags, ...)
}
POSIX_PRE_RECORD();
POSIX_RECORD_OPEN(ret, path, mode, 0, tm1, tm2);
POSIX_RECORD_OPEN(ret, path, mode, tm1, tm2);
POSIX_POST_RECORD();
return(ret);
......@@ -455,7 +440,7 @@ int DARSHAN_DECL(creat)(const char* path, mode_t mode)
tm2 = darshan_core_wtime();
POSIX_PRE_RECORD();
POSIX_RECORD_OPEN(ret, path, mode, 0, tm1, tm2);
POSIX_RECORD_OPEN(ret, path, mode, tm1, tm2);
POSIX_POST_RECORD();
return(ret);
......@@ -473,55 +458,7 @@ int DARSHAN_DECL(creat64)(const char* path, mode_t mode)
tm2 = darshan_core_wtime();
POSIX_PRE_RECORD();
POSIX_RECORD_OPEN(ret, path, mode, 0, tm1, tm2);
POSIX_POST_RECORD();
return(ret);
}
FILE* DARSHAN_DECL(fopen)(const char *path, const char *mode)
{
FILE* ret;
int fd;
double tm1, tm2;
MAP_OR_FAIL(fopen);
tm1 = darshan_core_wtime();
ret = __real_fopen(path, mode);
tm2 = darshan_core_wtime();
if(ret == NULL)
fd = -1;
else
fd = fileno(ret);
POSIX_PRE_RECORD();
POSIX_RECORD_OPEN(fd, path, 0, 1, tm1, tm2);
POSIX_POST_RECORD();
return(ret);
}
FILE* DARSHAN_DECL(fopen64)(const char *path, const char *mode)
{
FILE* ret;
int fd;
double tm1, tm2;
MAP_OR_FAIL(fopen64);
tm1 = darshan_core_wtime();
ret = __real_fopen64(path, mode);
tm2 = darshan_core_wtime();
if(ret == NULL)
fd = -1;
else
fd = fileno(ret);
POSIX_PRE_RECORD();
POSIX_RECORD_OPEN(fd, path, 0, 1, tm1, tm2);
POSIX_RECORD_OPEN(ret, path, mode, tm1, tm2);
POSIX_POST_RECORD();
return(ret);
......@@ -539,7 +476,7 @@ int DARSHAN_DECL(mkstemp)(char* template)
tm2 = darshan_core_wtime();
POSIX_PRE_RECORD();
POSIX_RECORD_OPEN(ret, template, 0, 0, tm1, tm2);
POSIX_RECORD_OPEN(ret, template, 0, tm1, tm2);
POSIX_POST_RECORD();
return(ret);
......@@ -557,7 +494,7 @@ int DARSHAN_DECL(mkostemp)(char* template, int flags)
tm2 = darshan_core_wtime();
POSIX_PRE_RECORD();
POSIX_RECORD_OPEN(ret, template, 0, 0, tm1, tm2);
POSIX_RECORD_OPEN(ret, template, 0, tm1, tm2);
POSIX_POST_RECORD();
return(ret);
......@@ -575,7 +512,7 @@ int DARSHAN_DECL(mkstemps)(char* template, int suffixlen)
tm2 = darshan_core_wtime();
POSIX_PRE_RECORD();
POSIX_RECORD_OPEN(ret, template, 0, 0, tm1, tm2);
POSIX_RECORD_OPEN(ret, template, 0, tm1, tm2);
POSIX_POST_RECORD();
return(ret);
......@@ -593,7 +530,7 @@ int DARSHAN_DECL(mkostemps)(char* template, int suffixlen, int flags)
tm2 = darshan_core_wtime();
POSIX_PRE_RECORD();
POSIX_RECORD_OPEN(ret, template, 0, 0, tm1, tm2);
POSIX_RECORD_OPEN(ret, template, 0, tm1, tm2);
POSIX_POST_RECORD();
return(ret);
......@@ -614,7 +551,7 @@ ssize_t DARSHAN_DECL(read)(int fd, void *buf, size_t count)
tm2 = darshan_core_wtime();
POSIX_PRE_RECORD();
POSIX_RECORD_READ(ret, fd, 0, 0, aligned_flag, 0, tm1, tm2);
POSIX_RECORD_READ(ret, fd, 0, 0, aligned_flag, tm1, tm2);
POSIX_POST_RECORD();
return(ret);
......@@ -635,7 +572,7 @@ ssize_t DARSHAN_DECL(write)(int fd, const void *buf, size_t count)
tm2 = darshan_core_wtime();
POSIX_PRE_RECORD();
POSIX_RECORD_WRITE(ret, fd, 0, 0, aligned_flag, 0, tm1, tm2);
POSIX_RECORD_WRITE(ret, fd, 0, 0, aligned_flag, tm1, tm2);
POSIX_POST_RECORD();
return(ret);
......@@ -656,7 +593,7 @@ ssize_t DARSHAN_DECL(pread)(int fd, void *buf, size_t count, off_t offset)
tm2 = darshan_core_wtime();
POSIX_PRE_RECORD();
POSIX_RECORD_READ(ret, fd, 1, offset, aligned_flag, 0, tm1, tm2);
POSIX_RECORD_READ(ret, fd, 1, offset, aligned_flag, tm1, tm2);
POSIX_POST_RECORD();
return(ret);
......@@ -677,7 +614,7 @@ ssize_t DARSHAN_DECL(pwrite)(int fd, const void *buf, size_t count, off_t offset
tm2 = darshan_core_wtime();
POSIX_PRE_RECORD();
POSIX_RECORD_WRITE(ret, fd, 1, offset, aligned_flag, 0, tm1, tm2);
POSIX_RECORD_WRITE(ret, fd, 1, offset, aligned_flag, tm1, tm2);
POSIX_POST_RECORD();
return(ret);
......@@ -698,7 +635,7 @@ ssize_t DARSHAN_DECL(pread64)(int fd, void *buf, size_t count, off64_t offset)
tm2 = darshan_core_wtime();
POSIX_PRE_RECORD();
POSIX_RECORD_READ(ret, fd, 1, offset, aligned_flag, 0, tm1, tm2);
POSIX_RECORD_READ(ret, fd, 1, offset, aligned_flag, tm1, tm2);
POSIX_POST_RECORD();
return(ret);
......@@ -719,7 +656,7 @@ ssize_t DARSHAN_DECL(pwrite64)(int fd, const void *buf, size_t count, off64_t of
tm2 = darshan_core_wtime();
POSIX_PRE_RECORD();
POSIX_RECORD_WRITE(ret, fd, 1, offset, aligned_flag, 0, tm1, tm2);
POSIX_RECORD_WRITE(ret, fd, 1, offset, aligned_flag, tm1, tm2);
POSIX_POST_RECORD();
return(ret);
......@@ -745,7 +682,7 @@ ssize_t DARSHAN_DECL(readv)(int fd, const struct iovec *iov, int iovcnt)
tm2 = darshan_core_wtime();
POSIX_PRE_RECORD();
POSIX_RECORD_READ(ret, fd, 0, 0, aligned_flag, 0, tm1, tm2);
POSIX_RECORD_READ(ret, fd, 0, 0, aligned_flag, tm1, tm2);
POSIX_POST_RECORD();
return(ret);
......@@ -771,67 +708,7 @@ ssize_t DARSHAN_DECL(writev)(int fd, const struct iovec *iov, int iovcnt)
tm2 = darshan_core_wtime();
POSIX_PRE_RECORD();
POSIX_RECORD_WRITE(ret, fd, 0, 0, aligned_flag, 0, tm1, tm2);
POSIX_POST_RECORD();
return(ret);
}
size_t DARSHAN_DECL(fread)(void *ptr, size_t size, size_t nmemb, FILE *stream)
{
size_t ret;
int aligned_flag = 0;
int fd;
double tm1, tm2;
MAP_OR_FAIL(fread);
if((unsigned long)ptr % darshan_mem_alignment == 0) aligned_flag = 1;
tm1 = darshan_core_wtime();
ret = __real_fread(ptr, size, nmemb, stream);
tm2 = darshan_core_wtime();
fd = fileno(stream);
POSIX_PRE_RECORD();
if(ret > 0)
{
POSIX_RECORD_READ(size*ret, fd, 0, 0, aligned_flag, 1, tm1, tm2);
}
else
{
POSIX_RECORD_READ(ret, fd, 0, 0, aligned_flag, 1, tm1, tm2);
}
POSIX_POST_RECORD();
return(ret);
}
size_t DARSHAN_DECL(fwrite)(const void *ptr, size_t size, size_t nmemb, FILE *stream)
{
size_t ret;
int aligned_flag = 0;
int fd;
double tm1, tm2;
MAP_OR_FAIL(fwrite);
if((unsigned long)ptr % darshan_mem_alignment == 0) aligned_flag = 1;
tm1 = darshan_core_wtime();
ret = __real_fwrite(ptr, size, nmemb, stream);
tm2 = darshan_core_wtime();
fd = fileno(stream);
POSIX_PRE_RECORD();
if(ret > 0)
{
POSIX_RECORD_WRITE(size*ret, fd, 0, 0, aligned_flag, 1, tm1, tm2);
}
else
{
POSIX_RECORD_WRITE(ret, fd, 0, 0, aligned_flag, 1, tm1, tm2);
}
POSIX_RECORD_WRITE(ret, fd, 0, 0, aligned_flag, tm1, tm2);
POSIX_POST_RECORD();
return(ret);
......@@ -897,38 +774,6 @@ off_t DARSHAN_DECL(lseek64)(int fd, off_t offset, int whence)
return(ret);
}
int DARSHAN_DECL(fseek)(FILE *stream, long offset, int whence)
{
int ret;
struct posix_file_record_ref *rec_ref;
int fd;
double tm1, tm2;
MAP_OR_FAIL(fseek);
tm1 = darshan_core_wtime();
ret = __real_fseek(stream, offset, whence);
tm2 = darshan_core_wtime();
if(ret >= 0)
{
POSIX_PRE_RECORD();
fd = fileno(stream);
rec_ref = darshan_lookup_record_ref(posix_runtime->fd_hash, &fd, sizeof(int));
if(rec_ref)
{
rec_ref->offset = ftell(stream);
DARSHAN_TIMER_INC_NO_OVERLAP(
rec_ref->file_rec->fcounters[POSIX_F_META_TIME],
tm1, tm2, rec_ref->last_meta_end);
rec_ref->file_rec->counters[POSIX_FSEEKS] += 1;
}
POSIX_POST_RECORD();
}
return(ret);
}
int DARSHAN_DECL(__xstat)(int vers, const char *path, struct stat *buf)
{
int ret;
......@@ -1199,37 +1044,6 @@ int DARSHAN_DECL(close)(int fd)
return(ret);
}
int DARSHAN_DECL(fclose)(FILE *fp)
{
int ret;
struct posix_file_record_ref *rec_ref;
int fd = fileno(fp);
double tm1, tm2;
MAP_OR_FAIL(fclose);
tm1 = darshan_core_wtime();
ret = __real_fclose(fp);
tm2 = darshan_core_wtime();
POSIX_PRE_RECORD();
rec_ref = darshan_lookup_record_ref(posix_runtime->fd_hash, &fd, sizeof(int));
if(rec_ref)
{
rec_ref->last_byte_written = 0;
rec_ref->last_byte_read = 0;
rec_ref->file_rec->fcounters[POSIX_F_CLOSE_TIMESTAMP] =
darshan_core_wtime();
DARSHAN_TIMER_INC_NO_OVERLAP(
rec_ref->file_rec->fcounters[POSIX_F_META_TIME],
tm1, tm2, rec_ref->last_meta_end);
darshan_delete_record_ref(&(posix_runtime->fd_hash), &fd, sizeof(int));
}
POSIX_POST_RECORD();
return(ret);
}
int DARSHAN_DECL(aio_read)(struct aiocb *aiocbp)
{
int ret;
......@@ -1319,13 +1133,13 @@ ssize_t DARSHAN_DECL(aio_return)(struct aiocb *aiocbp)
if(aiocbp->aio_lio_opcode == LIO_WRITE)
{
POSIX_RECORD_WRITE(ret, aiocbp->aio_fildes,
1, aiocbp->aio_offset, aligned_flag, 0,
1, aiocbp->aio_offset, aligned_flag,
tmp->tm1, tm2);
}
else if(aiocbp->aio_lio_opcode == LIO_READ)
{
POSIX_RECORD_READ(ret, aiocbp->aio_fildes,
1, aiocbp->aio_offset, aligned_flag, 0,
1, aiocbp->aio_offset, aligned_flag,
tmp->tm1, tm2);
}
free(tmp);
......@@ -1356,13 +1170,13 @@ ssize_t DARSHAN_DECL(aio_return64)(struct aiocb64 *aiocbp)
if(aiocbp->aio_lio_opcode == LIO_WRITE)
{
POSIX_RECORD_WRITE(ret, aiocbp->aio_fildes,
1, aiocbp->aio_offset, aligned_flag, 0,
1, aiocbp->aio_offset, aligned_flag,
tmp->tm1, tm2);
}
else if(aiocbp->aio_lio_opcode == LIO_READ)
{
POSIX_RECORD_READ(ret, aiocbp->aio_fildes,
1, aiocbp->aio_offset, aligned_flag, 0,
1, aiocbp->aio_offset, aligned_flag,
tmp->tm1, tm2);
}
free(tmp);
......@@ -1927,15 +1741,15 @@ void darshan_posix_shutdown_bench_setup(int test_case)
case 1: /* single file-per-process */
snprintf(filepath, 256, "fpp-0_rank-%d", my_rank);
POSIX_RECORD_OPEN(fd_array[0], filepath, 777, 0, 0, 1);
POSIX_RECORD_WRITE(size_array[0], fd_array[0], 0, 0, 1, 0, 1, 2);
POSIX_RECORD_OPEN(fd_array[0], filepath, 777, 0, 1);
POSIX_RECORD_WRITE(size_array[0], fd_array[0], 0, 0, 1, 1, 2);
break;
case 2: /* single shared file */
snprintf(filepath, 256, "shared-0");
POSIX_RECORD_OPEN(fd_array[0], filepath, 777, 0, 0, 1);
POSIX_RECORD_WRITE(size_array[0], fd_array[0], 0, 0, 1, 0, 1, 2);
POSIX_RECORD_OPEN(fd_array[0], filepath, 777, 0, 1);
POSIX_RECORD_WRITE(size_array[0], fd_array[0], 0, 0, 1, 1, 2);
break;
case 3: /* 1024 unique files per proc */
......@@ -1943,9 +1757,9 @@ void darshan_posix_shutdown_bench_setup(int test_case)
{
snprintf(filepath, 256, "fpp-%d_rank-%d", i , my_rank);
POSIX_RECORD_OPEN(fd_array[i], filepath, 777, 0, 0, 1);
POSIX_RECORD_OPEN(fd_array[i], filepath, 777, 0, 1);
POSIX_RECORD_WRITE(size_array[i % DARSHAN_COMMON_VAL_MAX_RUNTIME_COUNT],
fd_array[i], 0, 0, 1, 0, 1, 2);
fd_array[i], 0, 0, 1, 1, 2);
}
break;
......@@ -1954,9 +1768,9 @@ void darshan_posix_shutdown_bench_setup(int test_case)
{
snprintf(filepath, 256, "shared-%d", i);
POSIX_RECORD_OPEN(fd_array[i], filepath, 777, 0, 0, 1);
POSIX_RECORD_OPEN(fd_array[i], filepath, 777, 0, 1);
POSIX_RECORD_WRITE(size_array[i % DARSHAN_COMMON_VAL_MAX_RUNTIME_COUNT],
fd_array[i], 0, 0, 1, 0, 1, 2);
fd_array[i], 0, 0, 1, 1, 2);
}
break;
......
/*
* Copyright (C) 2015 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*
*/
/* TODO list (general) for this module:
* - add stdio page to darshan-job-summary
* - update darshan-parser to include stdio information in any relevant
* performance estimate / summary modes
* - figure out what to do about posix module compatibility
* - remove stdio counters in POSIX or keep and set to -1?
* - affected counters in posix module:
* - POSIX_FOPENS
* - POSIX_FREADS
* - POSIX_FWRITES
* - POSIX_FSEEKS
*/
/* catalog of stdio functions instrumented by this module
*
* functions for opening streams
* --------------
* FILE *fdopen(int, const char *); DONE
* FILE *fopen(const char *, const char *); DONE
* FILE *fopen64(const char *, const char *); DONE
* FILE *freopen(const char *, const char *, FILE *); DONE
* FILE *freopen64(const char *, const char *, FILE *); DONE
*
* functions for closing streams
* --------------
* int fclose(FILE *); DONE
*
* functions for flushing streams
* --------------
* int fflush(FILE *); DONE
*
* functions for reading data
* --------------
* int fgetc(FILE *); DONE
* char *fgets(char *, int, FILE *); DONE
* size_t fread(void *, size_t, size_t, FILE *); DONE
* int fscanf(FILE *, const char *, ...); DONE
* int vfscanf(FILE *, const char *, va_list); DONE
* int getc(FILE *); DONE
* int getw(FILE *); DONE
*
* functions for writing data
* --------------
* int fprintf(FILE *, const char *, ...); DONE
* int vfprintf(FILE *, const char *, va_list); DONE
* int fputc(int, FILE *); DONE
* int fputs(const char *, FILE *); DONE
* size_t fwrite(const void *, size_t, size_t, FILE *); DONE
* int putc(int, FILE *); DONE
* int putw(int, FILE *); DONE
*
* functions for changing file position
* --------------
* int fseek(FILE *, long int, int); DONE
* int fseeko(FILE *, off_t, int); DONE
* int fseeko64(FILE *, off_t, int); DONE
* int fsetpos(FILE *, const fpos_t *); DONE
* int fsetpos64(FILE *, const fpos_t *); DONE
* void rewind(FILE *); DONE
*
* Omissions:
* - _unlocked() variants of the various flush, read, and write
* functions. There are many of these, but they are not available on all
* systems and the man page advises not to use them.
* - ungetc()
*/
#define _XOPEN_SOURCE 500
#define _GNU_SOURCE
#include "darshan-runtime-config.h"
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdarg.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/uio.h>
#include <sys/mman.h>
#include <search.h>
#include <assert.h>
#include <libgen.h>
#include <pthread.h>
#include "darshan.h"
#include "darshan-dynamic.h"
DARSHAN_FORWARD_DECL(fopen, FILE*, (const char *path, const char *mode));
DARSHAN_FORWARD_DECL(fopen64, FILE*, (const char *path, const char *mode));
DARSHAN_FORWARD_DECL(fdopen, FILE*, (int fd, const char *mode));
DARSHAN_FORWARD_DECL(freopen, FILE*, (const char *path, const char *mode, FILE *stream));
DARSHAN_FORWARD_DECL(freopen64, FILE*, (const char *path, const char *mode, FILE *stream));
DARSHAN_FORWARD_DECL(fclose, int, (FILE *fp));
DARSHAN_FORWARD_DECL(fflush, int, (FILE *fp));
DARSHAN_FORWARD_DECL(fwrite, size_t, (const void *ptr, size_t size, size_t nmemb, FILE *stream));
DARSHAN_FORWARD_DECL(fputc, int, (int c, FILE *stream));
DARSHAN_FORWARD_DECL(putw, int, (int w, FILE *stream));
DARSHAN_FORWARD_DECL(fputs, int, (const char *s, FILE *stream));
DARSHAN_FORWARD_DECL(fprintf, int, (FILE *stream, const char *format, ...));
DARSHAN_FORWARD_DECL(vfprintf, int, (FILE *stream, const char *format, va_list));
DARSHAN_FORWARD_DECL(fread, size_t, (void *ptr, size_t size, size_t nmemb, FILE *stream));
DARSHAN_FORWARD_DECL(fgetc, int, (FILE *stream));
DARSHAN_FORWARD_DECL(getw, int, (FILE *stream));
DARSHAN_FORWARD_DECL(_IO_getc, int, (FILE *stream));
DARSHAN_FORWARD_DECL(_IO_putc, int, (int, FILE *stream));
DARSHAN_FORWARD_DECL(fscanf, int, (FILE *stream, const char *format, ...));
DARSHAN_FORWARD_DECL(__isoc99_fscanf, int, (FILE *stream, const char *format, ...));
DARSHAN_FORWARD_DECL(vfscanf, int, (FILE *stream, const char *format, va_list ap));
DARSHAN_FORWARD_DECL(fgets, char*, (char *s, int size, FILE *stream));
DARSHAN_FORWARD_DECL(fseek, int, (FILE *stream, long offset, int whence));
DARSHAN_FORWARD_DECL(fseeko, int, (FILE *stream, off_t offset, int whence));
DARSHAN_FORWARD_DECL(fseeko64, int, (FILE *stream, off_t offset, int whence));
DARSHAN_FORWARD_DECL(fsetpos, int, (FILE *stream, const fpos_t *pos));
DARSHAN_FORWARD_DECL(fsetpos64, int, (FILE *stream, const fpos_t *pos));
DARSHAN_FORWARD_DECL(rewind, void, (FILE *stream));
/* structure to track stdio stats at runtime */
struct stdio_file_record_ref
{
struct darshan_stdio_file* file_rec;
int64_t offset;
double last_meta_end;
double last_read_end;
double last_write_end;
};
/* The stdio_runtime structure maintains necessary state for storing
* STDIO file records and for coordinating with darshan-core at
* shutdown time.
*/
struct stdio_runtime
{
void *rec_id_hash;
void *stream_hash;
int file_rec_count;
};
static struct stdio_runtime *stdio_runtime = NULL;
static pthread_mutex_t stdio_runtime_mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
static int instrumentation_disabled = 0;
static int darshan_mem_alignment = 1;
static int my_rank = -1;
static void stdio_runtime_initialize(void);
static void stdio_shutdown(
MPI_Comm mod_comm,
darshan_record_id *shared_recs,
int shared_rec_count,
void **stdio_buf,
int *stdio_buf_sz);
static void stdio_record_reduction_op(void* infile_v, void* inoutfile_v,
int *len, MPI_Datatype *datatype);
static struct stdio_file_record_ref *stdio_track_new_file_record(
darshan_record_id rec_id, const char *path);
static void stdio_cleanup_runtime();