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 diff is collapsed.
......@@ -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
......
This diff is collapsed.
This diff is collapsed.
......@@ -3,3 +3,4 @@
@@darshan_share_path@/ld-opts/darshan-posix-ld-opts
@@darshan_share_path@/ld-opts/darshan-hdf5-ld-opts
@@darshan_share_path@/ld-opts/darshan-pnetcdf-ld-opts
@@darshan_share_path@/ld-opts/darshan-stdio-ld-opts
......@@ -2,8 +2,6 @@
--wrap=open64
--wrap=creat
--wrap=creat64
--wrap=fopen
--wrap=fopen64
--wrap=mkstemp
--wrap=mkostemp
--wrap=mkstemps
......@@ -16,11 +14,8 @@
--wrap=pwrite64
--wrap=readv
--wrap=writev
--wrap=fread
--wrap=fwrite
--wrap=lseek
--wrap=lseek64
--wrap=fseek
--wrap=__xstat
--wrap=__xstat64
--wrap=__lxstat
......@@ -32,7 +27,6 @@
--wrap=fsync
--wrap=fdatasync
--wrap=close
--wrap=fclose
--wrap=aio_read
--wrap=aio_write
--wrap=aio_read64
......
--undefined=__wrap_fopen
--wrap=fopen
--wrap=fopen64
--wrap=fdopen
--wrap=freopen
--wrap=freopen64
--wrap=fflush
--wrap=fclose
--wrap=fwrite
--wrap=fread
--wrap=fgetc
--wrap=fscanf
--wrap=vfscanf
--wrap=_IO_getc
--wrap=_IO_putc
--wrap=getw
--wrap=fgets
--wrap=fseek
--wrap=fseeko
--wrap=fseeko64
--wrap=fprintf
--wrap=vfprintf
--wrap=fputc
--wrap=fputs
--wrap=putw
--wrap=fsetpos
--wrap=fsetpos64
--wrap=rewind
--wrap=__isoc99_fscanf
/*
* Copyright (C) 2015 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*
*/
#ifndef __DARSHAN_STDIO_LOG_FORMAT_H
#define __DARSHAN_STDIO_LOG_FORMAT_H
/* current log format version, to support backwards compatibility */
#define DARSHAN_STDIO_VER 1
#define STDIO_COUNTERS \
/* count of fopens */\
X(STDIO_OPENS) \
/* number of reads */ \
X(STDIO_READS) \
/* number of writes */ \
X(STDIO_WRITES) \
/* count of seeks */\
X(STDIO_SEEKS) \
/* count of flushes */\
X(STDIO_FLUSHES) \
/* total bytes written */ \
X(STDIO_BYTES_WRITTEN) \
/* total bytes read */ \
X(STDIO_BYTES_READ) \
/* maximum byte (offset) read */\
X(STDIO_MAX_BYTE_READ) \
/* maximum byte (offset) written */\
X(STDIO_MAX_BYTE_WRITTEN) \
/* end of counters */\
X(STDIO_NUM_INDICES)
#define STDIO_F_COUNTERS \
/* cumulative meta time */\
X(STDIO_F_META_TIME) \
/* cumulative write time */\
X(STDIO_F_WRITE_TIME) \
/* cumulative read time */\
X(STDIO_F_READ_TIME) \
/* timestamp of first open */\
X(STDIO_F_OPEN_START_TIMESTAMP) \
/* timestamp of first close */\
X(STDIO_F_CLOSE_START_TIMESTAMP) \
/* timestamp of first write */\
X(STDIO_F_WRITE_START_TIMESTAMP) \
/* timestamp of first read */\
X(STDIO_F_READ_START_TIMESTAMP) \
/* timestamp of last open completion */\
X(STDIO_F_OPEN_END_TIMESTAMP) \
/* timestamp of last close completion */\
X(STDIO_F_CLOSE_END_TIMESTAMP) \
/* timestamp of last write completion */\
X(STDIO_F_WRITE_END_TIMESTAMP) \
/* timestamp of last read completion */\
X(STDIO_F_READ_END_TIMESTAMP) \
/* end of counters */\
X(STDIO_F_NUM_INDICES)
#define X(a) a,
/* integer counters for the "STDIO" module */
enum darshan_stdio_indices
{
STDIO_COUNTERS
};
/* floating point counters for the "STDIO" module */
enum darshan_stdio_f_indices
{
STDIO_F_COUNTERS
};
#undef X
/* the darshan_stdio_record structure encompasses the high-level data/counters
* which would actually be logged to file by Darshan for the "STDIO"
* module. This logs the following data for each record:
* - a corresponding Darshan record identifier
* - the rank of the process responsible for the record
* - integer I/O counters (operation counts, I/O sizes, etc.)
* - floating point I/O counters (timestamps, cumulative timers, etc.)
*/
struct darshan_stdio_file
{
struct darshan_base_record base_rec;
int64_t counters[STDIO_NUM_INDICES];
double fcounters[STDIO_F_NUM_INDICES];
};
#endif /* __DARSHAN_STDIO_LOG_FORMAT_H */
#!/bin/bash
PROG=fprintf-fscanf-test
# set log file path; remove previous log if present
export DARSHAN_LOGFILE=$DARSHAN_TMP/${PROG}.darshan
rm -f ${DARSHAN_LOGFILE}
# compile
$DARSHAN_CC $DARSHAN_TESTDIR/test-cases/src/${PROG}.c -o $DARSHAN_TMP/${PROG}
if [ $? -ne 0 ]; then
echo "Error: failed to compile ${PROG}" 1>&2
exit 1
fi
# execute
$DARSHAN_RUNJOB $DARSHAN_TMP/${PROG} -f $DARSHAN_TMP/${PROG}.tmp.dat
if [ $? -ne 0 ]; then
echo "Error: failed to execute ${PROG}" 1>&2
exit 1
fi
# parse log
$DARSHAN_PATH/bin/darshan-parser $DARSHAN_LOGFILE > $DARSHAN_TMP/${PROG}.darshan.txt
if [ $? -ne 0 ]; then
echo "Error: failed to parse ${DARSHAN_LOGFILE}" 1>&2
exit 1
fi
# check results
STDIO_OPENS=`grep STDIO_OPENS $DARSHAN_TMP/${PROG}.darshan.txt | cut -f 5`
if [ ! "$STDIO_OPENS" -eq 4 ]; then
echo "Error: STDIO open count of $STDIO_OPENS is incorrect" 1>&2
exit 1
fi
# this will check fprintf counting
STDIO_BYTES_WRITTEN=`grep STDIO_BYTES_WRITTEN $DARSHAN_TMP/${PROG}.darshan.txt | cut -f 5`
if [ ! "$STDIO_BYTES_WRITTEN" -eq 15 ]; then
echo "Error: STDIO bytes written count of $STDIO_BYTES_WRITTEN is incorrect" 1>&2
exit 1
fi
# this will check fscanf counting
STDIO_BYTES_READ=`grep STDIO_BYTES_READ $DARSHAN_TMP/${PROG}.darshan.txt | cut -f 5`
if [ ! "$STDIO_BYTES_READ" -eq 15 ]; then
echo "Error: STDIO bytes read count of $STDIO_BYTES_READ is incorrect" 1>&2
exit 1
fi
exit 0
/*
* (C) 1995-2001 Clemson University and Argonne National Laboratory.
*
* See COPYING in top-level directory.
*/
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <sys/time.h>
#include <mpi.h>
#include <errno.h>
#include <getopt.h>
/* DEFAULT VALUES FOR OPTIONS */
static char opt_file[256] = "test-fprintf-fscanf.out";
/* function prototypes */
static int parse_args(int argc, char **argv);
static void usage(void);
/* global vars */
static int mynod = 0;
static int nprocs = 1;
int main(int argc, char **argv)
{
int namelen;
char processor_name[MPI_MAX_PROCESSOR_NAME];
FILE *file;
char buffer[128] = {0};
int number = 0;
/* startup MPI and determine the rank of this process */
MPI_Init(&argc,&argv);
MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
MPI_Comm_rank(MPI_COMM_WORLD, &mynod);
MPI_Get_processor_name(processor_name, &namelen);
/* parse the command line arguments */
parse_args(argc, argv);
if (mynod == 0) printf("# Using stdio calls.\n");
file = fopen(opt_file, "w+");
if(!file)
{
perror("fopen");
return(-1);
}
if(mynod == 0)
{
fprintf(file, "a number: %d", 12345);
fseek(file, 0, SEEK_SET);
fscanf(file, "a number: %d", &number);
}
fclose(file);
MPI_Finalize();
return(0);
}
static int parse_args(int argc, char **argv)
{
int c;
while ((c = getopt(argc, argv, "f:")) != EOF) {
switch (c) {
case 'f': /* filename */
strncpy(opt_file, optarg, 255);
break;
case '?': /* unknown */
if (mynod == 0)
usage();
exit(1);
default:
break;
}
}
return(0);
}
static void usage(void)
{
printf("Usage: stdio-test [<OPTIONS>...]\n");
printf("\n<OPTIONS> is one of\n");
printf(" -f filename [default: /foo/test.out]\n");
printf(" -h print this help\n");
}
/*
* Local variables:
* c-indent-level: 3
* c-basic-offset: 3
* tab-width: 3
*
* vim: ts=3
* End:
*/
/*
* (C) 1995-2001 Clemson University and Argonne National Laboratory.
*
* See COPYING in top-level directory.
*/
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <sys/time.h>
#include <mpi.h>
#include <errno.h>
#include <getopt.h>
/* DEFAULT VALUES FOR OPTIONS */
static char opt_file[256] = "test.out";
/* function prototypes */
static int parse_args(int argc, char **argv);
static void usage(void);
/* global vars */
static int mynod = 0;
static int nprocs = 1;
int main(int argc, char **argv)
{
int namelen;
char processor_name[MPI_MAX_PROCESSOR_NAME];
FILE *file;
char buffer[128] = {0};
/* startup MPI and determine the rank of this process */
MPI_Init(&argc,&argv);
MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
MPI_Comm_rank(MPI_COMM_WORLD, &mynod);
MPI_Get_processor_name(processor_name, &namelen);
/* parse the command line arguments */
parse_args(argc, argv);
if (mynod == 0) printf("# Using stdio calls.\n");
file = fopen(opt_file, "w+");
if(!file)
{
perror("fopen");
return(-1);
}
if(mynod == 0)
{
fwrite("hello", 1, 6, file);
fseek(file, 0, SEEK_SET);
fread(buffer, 1, 1024, file);
}
fclose(file);
MPI_Finalize();
return(0);
}
static int parse_args(int argc, char **argv)
{
int c;
while ((c = getopt(argc, argv, "f:")) != EOF) {
switch (c) {
case 'f': /* filename */
strncpy(opt_file, optarg, 255);
break;
case '?': /* unknown */
if (mynod == 0)
usage();
exit(1);
default:
break;
}
}
return(0);
}
static void usage(void)
{
printf("Usage: stdio-test [<OPTIONS>...]\n");
printf("\n<OPTIONS> is one of\n");
printf(" -f filename [default: /foo/test.out]\n");
printf(" -h print this help\n");
}
/*
* Local variables:
* c-indent-level: 3
* c-basic-offset: 3
* tab-width: 3
*
* vim: ts=3
* End:
*/
#!/bin/bash
PROG=stdio-test
# set log file path; remove previous log if present
export DARSHAN_LOGFILE=$DARSHAN_TMP/${PROG}.darshan
rm -f ${DARSHAN_LOGFILE}
# compile
$DARSHAN_CC $DARSHAN_TESTDIR/test-cases/src/${PROG}.c -o $DARSHAN_TMP/${PROG}
if [ $? -ne 0 ]; then
echo "Error: failed to compile ${PROG}" 1>&2
exit 1
fi
# execute
$DARSHAN_RUNJOB $DARSHAN_TMP/${PROG} -f $DARSHAN_TMP/${PROG}.tmp.dat
if [ $? -ne 0 ]; then
echo "Error: failed to execute ${PROG}" 1>&2
exit 1
fi
# parse log
$DARSHAN_PATH/bin/darshan-parser $DARSHAN_LOGFILE > $DARSHAN_TMP/${PROG}.darshan.txt
if [ $? -ne 0 ]; then
echo "Error: failed to parse ${DARSHAN_LOGFILE}" 1>&2
exit 1
fi
# check results
# check at least one counter from each general open/read/write/seek category
STDIO_OPENS=`grep STDIO_OPENS $DARSHAN_TMP/${PROG}.darshan.txt | cut -f 5`
if [ ! "$STDIO_OPENS" -gt 0 ]; then
echo "Error: STDIO open count of $STDIO_OPENS is incorrect" 1>&2
exit 1
fi
STDIO_SEEKS=`grep STDIO_SEEKS $DARSHAN_TMP/${PROG}.darshan.txt | cut -f 5`
if [ ! "$STDIO_SEEKS" -gt 0 ]; then
echo "Error: STDIO open count of $STDIO_SEEKS is incorrect" 1>&2
exit 1
fi
STDIO_BYTES_WRITTEN=`grep STDIO_BYTES_WRITTEN $DARSHAN_TMP/${PROG}.darshan.txt | cut -f 5`
if [ ! "$STDIO_BYTES_WRITTEN" -eq 6 ]; then
echo "Error: STDIO open count of $STDIO_BYTES_WRITTEN is incorrect" 1>&2
exit 1
fi
STDIO_BYTES_READ=`grep STDIO_BYTES_READ $DARSHAN_TMP/${PROG}.darshan.txt | cut -f 5`
if [ ! "$STDIO_BYTES_READ" -eq 6 ]; then
echo "Error: STDIO open count of $STDIO_BYTES_READ is incorrect" 1>&2
exit 1
fi
# make sure that some of the floating point counters are valid
# use bc for floating point comparison
STDIO_F_OPEN_START_TIMESTAMP=`grep STDIO_F_OPEN_START_TIMESTAMP $DARSHAN_TMP/${PROG}.darshan.txt | cut -f 5`
if [ ! $(echo "$STDIO_F_OPEN_START_TIMESTAMP > 0" | bc -l) ]; then
echo "Error: counter is incorrect" 1>&2
exit 1
fi
STDIO_F_OPEN_END_TIMESTAMP=`grep STDIO_F_OPEN_END_TIMESTAMP $DARSHAN_TMP/${PROG}.darshan.txt | cut -f 5`
if [ ! $(echo "$STDIO_F_OPEN_END_TIMESTAMP > 0" | bc -l) ]; then
echo "Error: counter is incorrect" 1>&2
exit 1
fi
STDIO_F_META_TIME=`grep STDIO_F_META_TIME $DARSHAN_TMP/${PROG}.darshan.txt | cut -f 5`
if [ ! $(echo "$STDIO_F_META_TIME > 0" | bc -l) ]; then
echo "Error: counter is incorrect" 1>&2
exit 1
fi
STDIO_F_WRITE_TIME=`grep STDIO_F_WRITE_TIME $DARSHAN_TMP/${PROG}.darshan.txt | cut -f 5`
if [ ! $(echo "$STDIO_F_WRITE_TIME > 0" | bc -l) ]; then
echo "Error: counter is incorrect" 1>&2
exit 1
fi
STDIO_F_CLOSE_START_TIMESTAMP=`grep STDIO_F_CLOSE_START_TIMESTAMP $DARSHAN_TMP/${PROG}.darshan.txt | cut -f 5`
if [ ! $(echo "$STDIO_F_CLOSE_START_TIMESTAMP > 0" | bc -l) ]; then
echo "Error: counter is incorrect" 1>&2
exit 1
fi
STDIO_F_CLOSE_END_TIMESTAMP=`grep STDIO_F_CLOSE_END_TIMESTAMP $DARSHAN_TMP/${PROG}.darshan.txt | cut -f 5`
if [ ! $(echo "$STDIO_F_CLOSE_END_TIMESTAMP > 0" | bc -l) ]; then
echo "Error: counter is incorrect" 1>&2
exit 1
fi
exit 0
......@@ -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-lustre-log-format.h
DARSHAN_MOD_LOGUTIL_HEADERS = darshan-posix-logutils.h darshan-mpiio-logutils.h darshan-hdf5-logutils.h darshan-pnetcdf-logutils.h darshan-lustre-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_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_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_ENABLE_SHARED=@DARSHAN_ENABLE_SHARED@
......@@ -86,6 +86,11 @@ darshan-lustre-logutils.o: darshan-lustre-logutils.c darshan-logutils.h darshan-
darshan-lustre-logutils.po: darshan-lustre-logutils.c darshan-logutils.h darshan-lustre-logutils.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-lustre-log-format.h | uthash-1.9.2
$(CC) $(CFLAGS_SHARED) -c $< -o $@
darshan-stdio-logutils.o: 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) -c $< -o $@
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 $@
libdarshan-util.a: darshan-logutils.o $(DARSHAN_STATIC_MOD_OBJS)
ar rcs libdarshan-util.a $^
......@@ -141,12 +146,14 @@ endif
install -m 644 $(srcdir)/darshan-pnetcdf-logutils.h $(includedir)
install -m 644 $(srcdir)/darshan-bgq-logutils.h $(includedir)
install -m 644 $(srcdir)/darshan-null-logutils.h $(includedir)
install -m 644 $(srcdir)/darshan-stdio-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)
install -m 644 $(srcdir)/../darshan-hdf5-log-format.h $(includedir)
install -m 644 $(srcdir)/../darshan-pnetcdf-log-format.h $(includedir)
install -m 644 $(srcdir)/../darshan-bgq-log-format.h $(includedir)
install -m 644 $(srcdir)/../darshan-stdio-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/
......
This diff is collapsed.
......@@ -126,6 +126,7 @@ extern struct darshan_mod_logutil_funcs *mod_logutils[];
#include "darshan-pnetcdf-logutils.h"
#include "darshan-bgq-logutils.h"
#include "darshan-lustre-logutils.h"
#include "darshan-stdio-logutils.h"
darshan_fd darshan_log_open(const char *name);
darshan_fd darshan_log_create(const char *name, enum darshan_comp_type comp_type,
......
/*
* Copyright (C) 2015 University of Chicago.
* 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"
/* integer counter name strings for the STDIO module */
#define X(a) #a,
char *stdio_counter_names[] = {
STDIO_COUNTERS
};
/* floating point counter name strings for the STDIO module */
char *stdio_f_counter_names[] = {
STDIO_F_COUNTERS
};
#undef X
/* prototypes for each of the STDIO module's logutil functions */
static int darshan_log_get_stdio_record(darshan_fd fd, void* stdio_buf);
static int darshan_log_put_stdio_record(darshan_fd fd, void* stdio_buf, int ver);
static void darshan_log_print_stdio_record(void *file_rec,
char *file_name, char *mnt_pt, char *fs_type, int ver);
static void darshan_log_print_stdio_description(void);
static void darshan_log_print_stdio_record_diff(void *file_rec1, char *file_name1,
void *file_rec2, char *file_name2);
/* structure storing each function needed for implementing the darshan
* logutil interface. these functions are used for reading, writing, and
* printing module data in a consistent manner.
*/
struct darshan_mod_logutil_funcs stdio_logutils =
{
.log_get_record = &darshan_log_get_stdio_record,
.log_put_record = &darshan_log_put_stdio_record,
.log_print_record = &darshan_log_print_stdio_record,
.log_print_description = &darshan_log_print_stdio_description,
.log_print_diff = &darshan_log_print_stdio_record_diff
};
/* retrieve a STDIO record from log file descriptor 'fd', storing the
* buffer in 'stdio_buf'. Return 1 on successful record read, 0 on no
* more data, and -1 on error.
*/
static int darshan_log_get_stdio_record(darshan_fd fd, void* stdio_buf)
{
struct darshan_stdio_file *file;
int i;
int ret;
/* read a STDIO module record from the darshan log file */
ret = darshan_log_get_mod(fd, DARSHAN_STDIO_MOD, stdio_buf,
sizeof(struct darshan_stdio_file));
if(ret < 0)
return(-1);
else if(ret < sizeof(struct darshan_stdio_file))
return(0);
else
{
/* if the read was successful, do any necessary byte-swapping */
file = (struct darshan_stdio_file *)stdio_buf;
if(fd->swap_flag)
{
/* swap bytes if necessary */
DARSHAN_BSWAP64(&file->base_rec.id);
DARSHAN_BSWAP64(&file->base_rec.rank);
for(i=0; i<STDIO_NUM_INDICES; i++)
DARSHAN_BSWAP64(&file->counters[i]);
for(i=0; i<STDIO_F_NUM_INDICES; i++)
DARSHAN_BSWAP64(&file->fcounters[i]);
}
return(1);
}
}