darshan-core.h 2.06 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>

14 15
#include "uthash.h"
#include "darshan-log-format.h"
16

17 18
/* Environment variable to override __DARSHAN_JOBID */
#define DARSHAN_JOBID_OVERRIDE "DARSHAN_JOBID"
19

20 21
/* Environment variable to override __DARSHAN_LOG_PATH */
#define DARSHAN_LOG_PATH_OVERRIDE "DARSHAN_LOGPATH"
22

23 24
/* Environment variable to override __DARSHAN_LOG_HINTS */
#define DARSHAN_LOG_HINTS_OVERRIDE "DARSHAN_LOGHINTS"
25

26 27
/* Environment variable to override __DARSHAN_MEM_ALIGNMENT */
#define DARSHAN_MEM_ALIGNMENT_OVERRIDE "DARSHAN_MEMALIGN"
28

29 30 31 32 33 34
/* Environment variable to override memory per module */
#define DARSHAN_MOD_MEM_OVERRIDE "DARSHAN_MODMEM"

/* Maximum amount of memory per instrumentation module in MiB */
#ifdef __DARSHAN_MOD_MEM_MAX
#define DARSHAN_MOD_MEM_MAX (__DARSHAN_MOD_MEM_MAX * 1024 * 1024)
35
#else
36
#define DARSHAN_MOD_MEM_MAX (2 * 1024 * 1024) /* 2 MiB default */
37
#endif
38

39 40
/* Default runtime compression buffer size */
#define DARSHAN_COMP_BUF_SIZE DARSHAN_MOD_MEM_MAX
41

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

Shane Snyder's avatar
Shane Snyder committed
56 57 58 59 60 61
struct darshan_core_module
{
    darshan_module_id id;
    struct darshan_module_funcs mod_funcs;
};

62 63
struct darshan_core_record_ref
{
64
    struct darshan_record rec;
65 66
    uint64_t mod_flags;
    uint64_t global_mod_flags;
67
    UT_hash_handle hlink;
68
};
69

70 71 72
void darshan_core_initialize(int argc, char **argv);
void darshan_core_shutdown(void);

73 74 75
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);

76
#endif /* __DARSHAN_CORE_H */