darshan-stdio-log-format.h 3.91 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
/*
 * 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

13 14 15
/*
 * functions for opening streams
 * --------------
16
 * FILE    *fdopen(int, const char *);                      DONE
17 18 19 20 21
 * FILE    *fopen(const char *, const char *);
 * FILE    *freopen(const char *, const char *, FILE *);
 *
 * functions for closing streams
 * --------------
22
 * int      fclose(FILE *);                                 DONE
23 24 25 26 27 28 29 30 31
 *
 * functions for flushing streams
 * --------------
 * int      fflush(FILE *);
 *
 * functions for reading data
 * --------------
 * int      fgetc(FILE *);
 * char    *fgets(char *, int, FILE *);
32
 * size_t   fread(void *, size_t, size_t, FILE *);          DONE
33 34 35 36 37 38 39 40 41 42
 * int      fscanf(FILE *, const char *, ...);
 * int      getc(FILE *);
 * int      getc_unlocked(FILE *);
 * int      getw(FILE *);
 *
 * functions for writing data
 * --------------
 * int      fprintf(FILE *, const char *, ...);
 * int      fputc(int, FILE *);
 * int      fputs(const char *, FILE *);
43
 * size_t   fwrite(const void *, size_t, size_t, FILE *);   DONE
44 45 46 47 48 49 50
 * int      putc(int, FILE *);
 * int      putc_unlocked(int, FILE *);
 * int      putw(int, FILE *);
 * int      vfprintf(FILE *, const char *, va_list);
 *
 * functions for changing file position
 * --------------
51
 * int      fseek(FILE *, long int, int);                   DONE
52 53 54 55 56 57
 * int      fseeko(FILE *, off_t, int);
 * int      fsetpos(FILE *, const fpos_t *);
 * void     rewind(FILE *);
 * int      ungetc(int, FILE *);
 */

58
#define STDIO_COUNTERS \
59
    /* count of fopens */\
60 61 62 63 64 65 66
    X(STDIO_OPENS) \
    /* maximum byte (offset) written */\
    X(STDIO_MAX_BYTE_WRITTEN) \
    /* total bytes written */ \
    X(STDIO_BYTES_WRITTEN) \
    /* number of writes */ \
    X(STDIO_WRITES) \
67
    /* maximum byte (offset) read */\
68
    X(STDIO_MAX_BYTE_READ) \
69
    /* total bytes read */ \
70
    X(STDIO_BYTES_READ) \
71
    /* number of reads */ \
72
    X(STDIO_READS) \
73 74
    /* count of seeks */\
    X(STDIO_SEEKS) \
75 76 77 78
    /* end of counters */\
    X(STDIO_NUM_INDICES)

#define STDIO_F_COUNTERS \
79 80 81 82
    /* timestamp of first open */\
    X(STDIO_F_OPEN_START_TIMESTAMP) \
    /* timestamp of last open completion */\
    X(STDIO_F_OPEN_END_TIMESTAMP) \
83 84 85 86
    /* timestamp of first close */\
    X(STDIO_F_CLOSE_START_TIMESTAMP) \
    /* timestamp of last close completion */\
    X(STDIO_F_CLOSE_END_TIMESTAMP) \
87 88 89 90
    /* timestamp of first write */\
    X(STDIO_F_WRITE_START_TIMESTAMP) \
    /* timestamp of last write completion */\
    X(STDIO_F_WRITE_END_TIMESTAMP) \
91 92 93 94
    /* timestamp of first read */\
    X(STDIO_F_READ_START_TIMESTAMP) \
    /* timestamp of last read completion */\
    X(STDIO_F_READ_END_TIMESTAMP) \
95 96
    /* cumulative meta time */\
    X(STDIO_F_META_TIME) \
97 98
    /* cumulative write time */\
    X(STDIO_F_WRITE_TIME) \
99 100
    /* cumulative read time */\
    X(STDIO_F_READ_TIME) \
101 102 103 104
    /* end of counters */\
    X(STDIO_F_NUM_INDICES)

#define X(a) a,
105
/* integer counters for the "STDIO" module */
106 107 108 109 110
enum darshan_stdio_indices
{
    STDIO_COUNTERS
};

111
/* floating point counters for the "STDIO" module */
112 113 114 115 116 117 118 119 120 121 122 123 124 125
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.)
 */
126
struct darshan_stdio_record
127 128 129 130 131 132 133 134
{
    darshan_record_id f_id;
    int64_t rank;
    int64_t counters[STDIO_NUM_INDICES];
    double fcounters[STDIO_F_NUM_INDICES];
};

#endif /* __DARSHAN_STDIO_LOG_FORMAT_H */