darshan-log-format.h 3.35 KB
Newer Older
1
/*
2 3 4
 * Copyright (C) 2015 University of Chicago.
 * See COPYRIGHT notice in top-level directory.
 *
5 6
 */

7 8 9 10 11 12
#ifndef __DARSHAN_LOG_FORMAT_H
#define __DARSHAN_LOG_FORMAT_H

#include <unistd.h>
#include <sys/types.h>
#include <stdint.h>
13
#include <inttypes.h>
14

15 16
#if !defined PRId64
#error failed to detect PRId64
17
#endif
18 19
#if !defined PRIu64
#error failed to detect PRIu64
Philip Carns's avatar
Philip Carns committed
20
#endif
21

22
/* update this on file format changes */
23
#define DARSHAN_LOG_VERSION "3.00"
24

25
/* magic number for validating output files and checking byte order */
26
#define DARSHAN_MAGIC_NR 6567223
27

28
/* size (in bytes) of job record */
29
#define DARSHAN_JOB_RECORD_SIZE 4096
30 31

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

34
#define DARSHAN_MAX_MODS 16
35 36 37 38 39 40

/* X-macro for keeping module ordering consistent */
/* NOTE: first val used to define module enum values, 
 * second val used to define module name strings, and
 * third val is used to provide the name of a 
 * corresponding logutils structure for parsing module
Shane Snyder's avatar
Shane Snyder committed
41 42 43
 * data out of the log file (only used in darshan-util
 * component -- NULL can be passed if there are no
 * logutil definitions)
44
 */
45
#define DARSHAN_MODULE_IDS \
46
    X(DARSHAN_NULL_MOD, "NULL", NULL) \
Shane Snyder's avatar
Shane Snyder committed
47 48 49 50 51
    X(DARSHAN_POSIX_MOD, "POSIX", &posix_logutils) \
    X(DARSHAN_MPIIO_MOD, "MPI-IO", &mpiio_logutils) \
    X(DARSHAN_HDF5_MOD, "HDF5", &hdf5_logutils) \
    X(DARSHAN_PNETCDF_MOD, "PNETCDF", &pnetcdf_logutils) \
    X(DARSHAN_BGQ_MOD, "BG/Q", &bgq_logutils)
52

53 54 55 56
/* unique identifiers to distinguish between available darshan modules */
/* NOTES: - valid ids range from [0...DARSHAN_MAX_MODS-1]
 *        - order of ids control module shutdown order (and consequently, order in log file)
 */
57
#define X(a, b, c) a,
58 59
typedef enum
{
60
    DARSHAN_MODULE_IDS
61
} darshan_module_id;
62
#undef X
63

64
/* module name strings */
65
#define X(a, b, c) b,
Shane Snyder's avatar
Shane Snyder committed
66
static char * const darshan_module_names[] =
67
{
68
    DARSHAN_MODULE_IDS
69
};
70
#undef X
71

72 73 74 75 76 77 78
/* compression method used on darshan log file */
enum darshan_comp_type
{
    DARSHAN_ZLIB_COMP,
    DARSHAN_BZIP2_COMP,
};

79
typedef uint64_t darshan_record_id;
80

81 82 83 84 85 86 87
/* the darshan_log_map structure is used to indicate the location of
 * specific module data in a Darshan log. Note that 'off' and 'len' are
 * the respective offset and length of the data in the file, in *uncompressed*
 * terms -- this is nonintuitive since the data is compressed, but this is
 * done so we can utilize the gzread interface for all Darshan log reading
 * utilities. 
 */
88
struct darshan_log_map
89
{
90 91
    uint64_t off;
    uint64_t len;
92 93
};

94 95 96
/* the darshan header stores critical metadata needed for correctly
 * reading the contents of the corresponding Darshan log
 */
97
struct darshan_header
98
{
99 100
    char version_string[8];
    int64_t magic_nr;
Shane Snyder's avatar
Shane Snyder committed
101
    unsigned char comp_type;
102
    unsigned char partial_flag;
103 104
    struct darshan_log_map rec_map;
    struct darshan_log_map mod_map[DARSHAN_MAX_MODS];
105 106
};

107
/* job-level metadata stored for this application */
108
#define DARSHAN_JOB_METADATA_LEN 1024 /* including null terminator! */
109 110
struct darshan_job
{
111 112 113 114
    int64_t uid;
    int64_t start_time;
    int64_t end_time;
    int64_t nprocs;
115
    int64_t jobid;
116
    char metadata[DARSHAN_JOB_METADATA_LEN];
117 118
};

119
/* minimal record stored for each file/object accessed by Darshan */
120 121 122 123 124 125
struct darshan_record
{
    char* name;
    darshan_record_id id;
};

126
#endif /* __DARSHAN_LOG_FORMAT_H */