darshan-core.h 1.99 KB
Newer Older
1
/*
Shane Snyder's avatar
Shane Snyder committed
2 3 4
 * Copyright (C) 2015 University of Chicago.
 * See COPYRIGHT notice in top-level directory.
 *
5 6 7 8 9 10 11 12 13
 */

#ifndef __DARSHAN_CORE_H
#define __DARSHAN_CORE_H

#include <unistd.h>
#include <sys/types.h>
#include <stdint.h>

Shane Snyder's avatar
Shane Snyder committed
14 15
#include "uthash.h"
#include "darshan-log-format.h"
16

17 18 19 20 21 22 23 24 25 26 27 28 29
/* TODO: drop CP_ and use DARSHAN_ */
/* Environment variable to override CP_JOBID */
#define CP_JOBID_OVERRIDE "DARSHAN_JOBID"

/* Environment variable to override __CP_LOG_PATH */
#define CP_LOG_PATH_OVERRIDE "DARSHAN_LOGPATH"

/* Environment variable to override __CP_LOG_PATH */
#define CP_LOG_HINTS_OVERRIDE "DARSHAN_LOGHINTS"

/* Environment variable to override __CP_MEM_ALIGNMENT */
#define CP_MEM_ALIGNMENT_OVERRIDE "DARSHAN_MEMALIGN"

30 31
#define DARSHAN_CORE_MAX_RECORDS 1024

32
/* TODO: revisit this default size if we change memory per module */
Shane Snyder's avatar
Shane Snyder committed
33
#define DARSHAN_CORE_COMP_BUF_SIZE (2 * 1024 * 1024)
34

Shane Snyder's avatar
Shane Snyder committed
35 36 37
#define DARSHAN_CORE_MOD_SET(flags, id) (flags | (1 << id))
#define DARSHAN_CORE_MOD_UNSET(flags, id) (flags & ~(1 << id))
#define DARSHAN_CORE_MOD_ISSET(flags, id) (flags & (1 << id))
38

39
/* in memory structure to keep up with job level data */
40
struct darshan_core_runtime
41
{
42
    struct darshan_header log_header;
43
    struct darshan_job log_job;
44
    char exe[DARSHAN_EXE_LEN+1];
45
    struct darshan_core_record_ref *rec_hash;
Shane Snyder's avatar
Shane Snyder committed
46
    int rec_count;
47
    struct darshan_core_module* mod_array[DARSHAN_MAX_MODS];
Shane Snyder's avatar
Shane Snyder committed
48
    char comp_buf[DARSHAN_CORE_COMP_BUF_SIZE];
49 50
    double wtime_offset;
    char *trailing_data;
51 52
};

Shane Snyder's avatar
Shane Snyder committed
53 54 55 56 57 58
struct darshan_core_module
{
    darshan_module_id id;
    struct darshan_module_funcs mod_funcs;
};

59 60
struct darshan_core_record_ref
{
61
    struct darshan_record rec;
62 63
    uint64_t mod_flags;
    uint64_t global_mod_flags;
64
    UT_hash_handle hlink;
65
};
66

Shane Snyder's avatar
Shane Snyder committed
67 68 69
void darshan_core_initialize(int argc, char **argv);
void darshan_core_shutdown(void);

70 71 72
uint32_t darshan_hashlittle(const void *key, size_t length, uint32_t initval);
uint64_t darshan_hash(const register unsigned char *k, register uint64_t length, register uint64_t level);

73
#endif /* __DARSHAN_CORE_H */