darshan.h 2.18 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 12
#ifndef __DARSHAN_H
#define __DARSHAN_H

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

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

16 17 18 19 20 21 22 23 24 25 26 27
/* 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"

28
/* TODO where do each of the following macros make most sense ? */
29 30
#define DARSHAN_MPI_CALL(func) func

31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
/* max length of module name string (not counting \0) */
#define DARSHAN_MOD_NAME_LEN 31

/* 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 (first module shuts down first)
 */
#define DARSHAN_MAX_MODS 16
typedef enum
{
    DARSHAN_POSIX_MOD,
    DARSHAN_MPIIO_MOD,
    DARSHAN_HDF5_MOD,
    DARSHAN_PNETCDF_MOD,
} darshan_module_id;

47
struct darshan_module_funcs
48
{
49 50 51 52 53 54
    void (*get_output_data)(
        MPI_Comm mod_comm, /* communicator to use for module shutdown */
        void** buf, /* output parameter to save module buffer address */
        int* size /* output parameter to save module buffer size */
    );
    void (*shutdown)(void);
55 56
};

57 58 59
/*****************************************************
* darshan-core functions exported to darshan modules *
*****************************************************/
60

61
void darshan_core_register_module(
62
    darshan_module_id id,
63 64 65
    char *name,
    struct darshan_module_funcs *funcs,
    int *runtime_mem_limit);
66

67
void darshan_core_lookup_record_id(
68 69 70
    void *name,
    int len,
    int printable_flag,
71
    darshan_record_id *id);
72

73
double darshan_core_wtime(void);
74

75 76 77 78 79 80
/***********************************************
* darshan-common functions for darshan modules *
***********************************************/

char* darshan_clean_file_path(const char* path);

81
#endif /* __DARSHAN_H */