darshan-core.h 2.27 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
 */

#ifndef __DARSHAN_CORE_H
#define __DARSHAN_CORE_H

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

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

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

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

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

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

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

33 34 35
/* 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)
36
#else
37
#define DARSHAN_MOD_MEM_MAX (2 * 1024 * 1024) /* 2 MiB default */
38
#endif
39

40 41
#define DARSHAN_RECORD_BUF_SIZE (1024 * 100) /* store 1024 records, each of at most 100 bytes */

42 43
/* Default runtime compression buffer size */
#define DARSHAN_COMP_BUF_SIZE DARSHAN_MOD_MEM_MAX
44

45
/* in memory structure to keep up with job level data */
46
struct darshan_core_runtime
47
{
48 49 50
    struct darshan_header *log_hdr_p;
    struct darshan_job *log_job_p;
    char *log_exemnt_p;
51 52
    void *log_rec_p;
    void *log_mod_p;
53

54
    char mmap_log_name[PATH_MAX];
55
    struct darshan_core_record_ref *rec_hash;
56
    int rec_hash_cnt;
57
    struct darshan_core_module* mod_array[DARSHAN_MAX_MODS];
58 59
    int mod_mem_used;
    char comp_buf[DARSHAN_COMP_BUF_SIZE];
60
    double wtime_offset;
61 62
};

Shane Snyder's avatar
Shane Snyder committed
63 64 65
struct darshan_core_module
{
    struct darshan_module_funcs mod_funcs;
66
    int mem_avail;
Shane Snyder's avatar
Shane Snyder committed
67 68
};

69 70
struct darshan_core_record_ref
{
71 72
    char *name;
    darshan_record_id id;
73 74
    uint64_t mod_flags;
    uint64_t global_mod_flags;
75
    UT_hash_handle hlink;
76
};
77

Shane Snyder's avatar
Shane Snyder committed
78 79 80
void darshan_core_initialize(int argc, char **argv);
void darshan_core_shutdown(void);

81 82 83
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);

84
#endif /* __DARSHAN_CORE_H */