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

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

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

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

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

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

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

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

33 34
typedef uint64_t darshan_record_id;

35 36 37 38 39 40 41
/* 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)
 */
#define DARSHAN_MAX_MODS 16
typedef enum
{
42
    DARSHAN_POSIX_MOD = 0,
43 44 45 46 47
    DARSHAN_MPIIO_MOD,
    DARSHAN_HDF5_MOD,
    DARSHAN_PNETCDF_MOD,
} darshan_module_id;

Shane Snyder's avatar
Shane Snyder committed
48
static char * const darshan_module_names[] =
49 50 51 52 53 54 55
{
    "POSIX",
    "MPI-IO",
    "HDF5",
    "PNETCDF"
};

56 57 58 59 60 61 62
/* 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. 
 */
63
struct darshan_log_map
64
{
65 66
    uint64_t off;
    uint64_t len;
67 68
};

69 70 71
/* the darshan header stores critical metadata needed for correctly
 * reading the contents of the corresponding Darshan log
 */
72
struct darshan_header
73
{
74 75 76 77
    char version_string[8];
    int64_t magic_nr;
    struct darshan_log_map rec_map;
    struct darshan_log_map mod_map[DARSHAN_MAX_MODS];
78 79
};

80
/* job-level metadata stored for this application */
81
#define DARSHAN_JOB_METADATA_LEN 1024 /* including null terminator! */
82 83
struct darshan_job
{
84 85 86 87
    int64_t uid;
    int64_t start_time;
    int64_t end_time;
    int64_t nprocs;
88
    int64_t jobid;
89
    char metadata[DARSHAN_JOB_METADATA_LEN];
90 91
};

92
/* minimal record stored for each file/object accessed by Darshan */
93 94 95 96 97 98
struct darshan_record
{
    char* name;
    darshan_record_id id;
};

99
#endif /* __DARSHAN_LOG_FORMAT_H */