darshan-log-format.h 10.5 KB
Newer Older
1 2 3 4 5
/*
 *  (C) 2009 by Argonne National Laboratory.
 *      See COPYRIGHT in top-level directory.
 */

6 7 8
#ifndef __DARSHAN_LOG_FORMAT_H
#define __DARSHAN_LOG_FORMAT_H

9 10 11 12 13
#ifndef DARSHAN_CONFIG_H
    #error Must define DARSHAN_CONFIG_H
#endif

#include DARSHAN_CONFIG_H
14 15 16
#include <unistd.h>
#include <sys/types.h>
#include <stdint.h>
17 18 19
#ifdef HAVE_INTTYPES_H
	#include <inttypes.h>
#endif
20

21 22 23 24
#if !defined PRId64 || defined(PRI_MACROS_BROKEN)
#ifndef __WORDSIZE
#error failed to detect PRId64 or word size
#endif
25
# undef PRId64
26 27 28 29 30 31 32 33 34
#if __WORDSIZE == 64
# define PRId64 "ld"
#else
# define PRId64 "lld"
#endif
#endif
#if !defined PRIu64 || defined(PRI_MACROS_BROKEN)
#ifndef __WORDSIZE
#error failed to detect PRId64 or word size
35
#endif
Philip Carns's avatar
Philip Carns committed
36
# undef PRIu64
37 38 39 40 41
#if __WORDSIZE == 64
# define PRIu64 "lu"
#else
# define PRIu64 "llu"
#endif
Philip Carns's avatar
Philip Carns committed
42
#endif
43

44
/* update this on file format changes */
Philip Carns's avatar
Philip Carns committed
45
#define CP_VERSION "2.02"
46

47 48 49
/* magic number for validating output files and checking byte order */
#define CP_MAGIC_NR 6567223

50 51 52 53 54 55 56 57 58 59
/* size (in bytes) of job record */
#define CP_JOB_RECORD_SIZE 1024

/* max length of exe string within job record (not counting '\0') */
#define CP_EXE_LEN (CP_JOB_RECORD_SIZE - sizeof(struct darshan_job) - 1)

/* size (in bytes) of each file record */
#define CP_FILE_RECORD_SIZE (sizeof(struct darshan_file))

/* max length of name suffix string within file record (not counting '\0') */
60
#define CP_NAME_SUFFIX_LEN 15
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87

/* per file statistics */
enum darshan_indices
{
    CP_INDEP_OPENS = 0,          /* count of MPI independent opens */
    CP_COLL_OPENS,               /* count of MPI collective opens */
    CP_INDEP_READS,              /* count of independent MPI reads */
    CP_INDEP_WRITES,             /* count of independent MPI writes */
    CP_COLL_READS,               /* count of collective MPI reads */
    CP_COLL_WRITES,              /* count of collective MPI writes */
    CP_SPLIT_READS,              /* count of split collective MPI reads */
    CP_SPLIT_WRITES,             /* count of split collective MPI writes */
    CP_NB_READS,                 /* count of nonblocking MPI reads */
    CP_NB_WRITES,                /* count of nonblocking MPI writes */
    CP_SYNCS,
    CP_POSIX_READS,              /* count of posix reads */
    CP_POSIX_WRITES,             /* count of posix writes */
    CP_POSIX_OPENS,              /* count of posix opens */
    CP_POSIX_SEEKS,              /* count of posix seeks */
    CP_POSIX_STATS,              /* count of posix stat/lstat/fstats */
    CP_POSIX_MMAPS,              /* count of posix mmaps */
    CP_POSIX_FREADS,
    CP_POSIX_FWRITES,
    CP_POSIX_FOPENS,
    CP_POSIX_FSEEKS,
    CP_POSIX_FSYNCS,
    CP_POSIX_FDSYNCS,
88 89 90
    /* pnetcdf stuff */
    CP_INDEP_NC_OPENS,
    CP_COLL_NC_OPENS,
91 92
    /* HDF5 stuff */
    CP_HDF5_OPENS,
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
    /* type categories */
    CP_COMBINER_NAMED,           /* count of each MPI datatype category */
    CP_COMBINER_DUP,
    CP_COMBINER_CONTIGUOUS,
    CP_COMBINER_VECTOR,
    CP_COMBINER_HVECTOR_INTEGER,
    CP_COMBINER_HVECTOR,
    CP_COMBINER_INDEXED,
    CP_COMBINER_HINDEXED_INTEGER,
    CP_COMBINER_HINDEXED,
    CP_COMBINER_INDEXED_BLOCK,
    CP_COMBINER_STRUCT_INTEGER,
    CP_COMBINER_STRUCT,
    CP_COMBINER_SUBARRAY,
    CP_COMBINER_DARRAY,
    CP_COMBINER_F90_REAL,
    CP_COMBINER_F90_COMPLEX,
    CP_COMBINER_F90_INTEGER,
    CP_COMBINER_RESIZED,
    CP_HINTS,                     /* count of MPI hints used */
    CP_VIEWS,                     /* count of MPI set view calls */
    CP_MODE,                      /* mode of file */
    CP_BYTES_READ,                /* total bytes read */
    CP_BYTES_WRITTEN,             /* total bytes written */
    CP_MAX_BYTE_READ,             /* highest offset byte read */
    CP_MAX_BYTE_WRITTEN,          /* highest offset byte written */
    CP_CONSEC_READS,              /* count of consecutive reads */
    CP_CONSEC_WRITES,             /* count of consecutive writes */
    CP_SEQ_READS,                 /* count of sequential reads */
    CP_SEQ_WRITES,                /* count of sequential writes */
    CP_RW_SWITCHES,               /* number of times switched between read and write */
    CP_MEM_NOT_ALIGNED,           /* count of accesses not mem aligned */
    CP_MEM_ALIGNMENT,             /* mem alignment in bytes */
    CP_FILE_NOT_ALIGNED,          /* count of accesses not file aligned */
    CP_FILE_ALIGNMENT,            /* file alignment in bytes */
128 129
    CP_MAX_READ_TIME_SIZE,
    CP_MAX_WRITE_TIME_SIZE,
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212
    /* buckets */
    CP_SIZE_READ_0_100,           /* count of posix read size ranges */
    CP_SIZE_READ_100_1K,
    CP_SIZE_READ_1K_10K,
    CP_SIZE_READ_10K_100K,
    CP_SIZE_READ_100K_1M,
    CP_SIZE_READ_1M_4M,
    CP_SIZE_READ_4M_10M,
    CP_SIZE_READ_10M_100M,
    CP_SIZE_READ_100M_1G,
    CP_SIZE_READ_1G_PLUS,
    /* buckets */
    CP_SIZE_WRITE_0_100,          /* count of posix write size ranges */
    CP_SIZE_WRITE_100_1K,
    CP_SIZE_WRITE_1K_10K,
    CP_SIZE_WRITE_10K_100K,
    CP_SIZE_WRITE_100K_1M,
    CP_SIZE_WRITE_1M_4M,
    CP_SIZE_WRITE_4M_10M,
    CP_SIZE_WRITE_10M_100M,
    CP_SIZE_WRITE_100M_1G,
    CP_SIZE_WRITE_1G_PLUS,
    /* buckets */
    CP_SIZE_READ_AGG_0_100,       /* count of MPI read size ranges */
    CP_SIZE_READ_AGG_100_1K,
    CP_SIZE_READ_AGG_1K_10K,
    CP_SIZE_READ_AGG_10K_100K,
    CP_SIZE_READ_AGG_100K_1M,
    CP_SIZE_READ_AGG_1M_4M,
    CP_SIZE_READ_AGG_4M_10M,
    CP_SIZE_READ_AGG_10M_100M,
    CP_SIZE_READ_AGG_100M_1G,
    CP_SIZE_READ_AGG_1G_PLUS,
    /* buckets */
    CP_SIZE_WRITE_AGG_0_100,      /* count of MPI write size ranges */
    CP_SIZE_WRITE_AGG_100_1K,
    CP_SIZE_WRITE_AGG_1K_10K,
    CP_SIZE_WRITE_AGG_10K_100K,
    CP_SIZE_WRITE_AGG_100K_1M,
    CP_SIZE_WRITE_AGG_1M_4M,
    CP_SIZE_WRITE_AGG_4M_10M,
    CP_SIZE_WRITE_AGG_10M_100M,
    CP_SIZE_WRITE_AGG_100M_1G,
    CP_SIZE_WRITE_AGG_1G_PLUS,
    /* buckets */
    CP_EXTENT_READ_0_100,          /* count of MPI read extent ranges */
    CP_EXTENT_READ_100_1K,
    CP_EXTENT_READ_1K_10K,
    CP_EXTENT_READ_10K_100K,
    CP_EXTENT_READ_100K_1M,
    CP_EXTENT_READ_1M_4M,
    CP_EXTENT_READ_4M_10M,
    CP_EXTENT_READ_10M_100M,
    CP_EXTENT_READ_100M_1G,
    CP_EXTENT_READ_1G_PLUS,
    /* buckets */
    CP_EXTENT_WRITE_0_100,         /* count of MPI write extent ranges */
    CP_EXTENT_WRITE_100_1K,
    CP_EXTENT_WRITE_1K_10K,
    CP_EXTENT_WRITE_10K_100K,
    CP_EXTENT_WRITE_100K_1M,
    CP_EXTENT_WRITE_1M_4M,
    CP_EXTENT_WRITE_4M_10M,
    CP_EXTENT_WRITE_10M_100M,
    CP_EXTENT_WRITE_100M_1G,
    CP_EXTENT_WRITE_1G_PLUS,
    /* counters */
    CP_STRIDE1_STRIDE,             /* the four most frequently appearing strides */
    CP_STRIDE2_STRIDE,
    CP_STRIDE3_STRIDE,
    CP_STRIDE4_STRIDE,
    CP_STRIDE1_COUNT,              /* count of each of the most frequent strides */
    CP_STRIDE2_COUNT,
    CP_STRIDE3_COUNT,
    CP_STRIDE4_COUNT,
    CP_ACCESS1_ACCESS,             /* the four most frequently appearing access sizes */
    CP_ACCESS2_ACCESS,
    CP_ACCESS3_ACCESS,
    CP_ACCESS4_ACCESS,
    CP_ACCESS1_COUNT,              /* count of each of the most frequent access sizes */
    CP_ACCESS2_COUNT,
    CP_ACCESS3_COUNT,
    CP_ACCESS4_COUNT,
213
    CP_DEVICE,                     /* device id reported by stat */
214
    CP_SIZE_AT_OPEN,
215 216 217 218
    CP_FASTEST_RANK,
    CP_FASTEST_RANK_BYTES,
    CP_SLOWEST_RANK,
    CP_SLOWEST_RANK_BYTES,
219

220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276
    CP_MPI_SENDS,
    CP_MPI_RECVS,
    CP_MPI_ISENDS,
    CP_MPI_IRECVS,
    CP_MPI_WAITS,
    CP_MPI_TESTS,
    CP_MPI_WAITANYS,
    CP_MPI_TESTANYS,
    CP_MPI_WAITALLS,
    CP_MPI_TESTALLS,
    CP_MPI_BARRIERS,
    CP_MPI_BCASTS,
    CP_MPI_GATHERS,
    CP_MPI_GATHERVS,
    CP_MPI_SCATHERS,
    CP_MPI_SCATHERVS,
    CP_MPI_ALLGATHERS,
    CP_MPI_ALLGATHERVS,
    CP_MPI_ALLTOALLS,
    CP_MPI_ALLTOALLVS,
    CP_MPI_REDUCES,
    CP_MPI_ALLREDUCES,

    CP_BYTES_MPI_SEND,		
    CP_BYTES_MPI_RECV,
    CP_BYTES_MPI_ISEND,		
    CP_BYTES_MPI_IRECV,
    CP_BYTES_MPI_BCAST,
    CP_BYTES_MPI_GATHER,
    CP_BYTES_MPI_GATHERV,
    CP_BYTES_MPI_SCATHER,
    CP_BYTES_MPI_SCATHERV,
    CP_BYTES_MPI_ALLGATHER,
    CP_BYTES_MPI_ALLGATHERV,
    CP_BYTES_MPI_ALLTOALL,
    CP_BYTES_MPI_ALLTOALLV,
    CP_BYTES_MPI_REDUCE,
    CP_BYTES_MPI_ALLREDUCE,

    CP_AVG_MEM_DTYPE_SIZE,
    CP_AVG_MEM_DTYPE_EXTENT, 
    CP_AVG_MEM_DTYPE_BLOCKS,
    CP_AVG_FILE_DTYPE_EXTENT, 
    CP_AVG_FILE_DTYPE_BLOCKS,
    CP_MAX_MEM_DTYPE_SIZE,
    CP_MAX_MEM_DTYPE_EXTENT, 
    CP_MAX_MEM_DTYPE_BLOCKS,
    CP_MAX_FILE_OFFSET,
    CP_MAX_FILE_DTYPE_EXTENT, 
    CP_MAX_FILE_DTYPE_BLOCKS,
    CP_MIN_MEM_DTYPE_SIZE,
    CP_MIN_MEM_DTYPE_EXTENT, 
    CP_MIN_MEM_DTYPE_BLOCKS,
    CP_MIN_FILE_OFFSET,
    CP_MIN_FILE_DTYPE_EXTENT, 
    CP_MIN_FILE_DTYPE_BLOCKS,

277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294
    CP_NUM_INDICES,
};

/* floating point statistics */
enum f_darshan_indices
{
    CP_F_OPEN_TIMESTAMP = 0,    /* timestamp of first open */
    CP_F_READ_START_TIMESTAMP,  /* timestamp of first read */
    CP_F_WRITE_START_TIMESTAMP, /* timestamp of first write */
    CP_F_CLOSE_TIMESTAMP,       /* timestamp of last close */
    CP_F_READ_END_TIMESTAMP,    /* timestamp of last read */
    CP_F_WRITE_END_TIMESTAMP,   /* timestamp of last write */
    CP_F_POSIX_READ_TIME,       /* cumulative posix read time */
    CP_F_POSIX_WRITE_TIME,      /* cumulative posix write time */
    CP_F_POSIX_META_TIME,       /* cumulative posix meta time */
    CP_F_MPI_META_TIME,         /* cumulative mpi-io meta time */
    CP_F_MPI_READ_TIME,         /* cumulative mpi-io read time */
    CP_F_MPI_WRITE_TIME,        /* cumulative mpi-io write time */
295 296
    CP_F_MAX_READ_TIME,
    CP_F_MAX_WRITE_TIME,
297 298 299 300 301
    CP_F_FASTEST_RANK_TIME,
    CP_F_SLOWEST_RANK_TIME,
    CP_F_VARIANCE_RANK_TIME,
    CP_F_VARIANCE_RANK_BYTES,

302 303 304 305 306 307 308
    CP_F_NUM_INDICES,
};

/* statistics for any kind of file */
struct darshan_file
{
    uint64_t hash;
309 310
    int64_t rank;
    char name_suffix[CP_NAME_SUFFIX_LEN+1];
311 312 313 314 315
    int64_t counters[CP_NUM_INDICES];
    double fcounters[CP_F_NUM_INDICES];
};

/* statistics for the job as a whole */
316
#define DARSHAN_JOB_METADATA_LEN 64 /* including null terminator! */
317 318
struct darshan_job
{
319
    char version_string[8];
320
    int64_t magic_nr;
321 322 323 324
    int64_t uid;
    int64_t start_time;
    int64_t end_time;
    int64_t nprocs;
325
    int64_t jobid;
326
    char metadata[DARSHAN_JOB_METADATA_LEN];
327 328
};

329 330 331 332 333 334 335
/* This macro can be used to identify files that have been opened using
 * pnetcdf, hdf5, or mpi-io, but were never opened at the posix level.  As a
 * result the record will not necessarily have all of the expected fields
 * populated.
 */
#define CP_FILE_PARTIAL(__file)((((__file)->counters[CP_POSIX_OPENS] || (__file)->counters[CP_POSIX_FOPENS] || (__file)->counters[CP_POSIX_STATS]) ? 0 : 1))

336
#endif /* __DARSHAN_LOG_FORMAT_H */