darshan.h 2.64 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"

Shane Snyder's avatar
Shane Snyder committed
28
/* module developers provide the following functions to darshan-core */
29
struct darshan_module_funcs
30
{
31
    /* disable futher instrumentation within a module */
Shane Snyder's avatar
Shane Snyder committed
32
    void (*disable_instrumentation)(void);
Shane Snyder's avatar
Shane Snyder committed
33
    /* perform any necessary steps prior to reducing */
34
    void (*prepare_for_reduction)(
Shane Snyder's avatar
Shane Snyder committed
35
        darshan_record_id *shared_recs, /* input list of shared records */
36
        int *shared_rec_count, /* in/out shared record count */
Shane Snyder's avatar
Shane Snyder committed
37 38 39
        void **send_buf, /* send buffer for shared file reduction */
        void **recv_buf, /* recv buffer for shared file reduction (root only) */
        int *rec_size /* size of records being stored for this module */
40
    );
Shane Snyder's avatar
Shane Snyder committed
41 42
    /* reduce records which are shared globally across this module */
    void (*reduce_records)(
43 44 45 46 47 48
        void* infile_v,
        void* inoutfile_v,
        int *len,
        MPI_Datatype *datatype
    );
    /* retrieve module data to write to log file */
49 50 51 52
    void (*get_output_data)(
        void** buf, /* output parameter to save module buffer address */
        int* size /* output parameter to save module buffer size */
    );
53
    /* shutdown module data structures */
54
    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 mod_id,
63 64
    struct darshan_module_funcs *funcs,
    int *runtime_mem_limit);
65

66 67 68
void darshan_core_unregister_module(
    darshan_module_id mod_id);

Shane Snyder's avatar
Shane Snyder committed
69
void darshan_core_register_record(
70 71 72
    void *name,
    int len,
    int printable_flag,
73
    darshan_module_id mod_id,
74
    darshan_record_id *rec_id);
75

Shane Snyder's avatar
Shane Snyder committed
76 77 78 79
void darshan_core_unregister_record(
    darshan_record_id rec_id,
    darshan_module_id mod_id);

80
double darshan_core_wtime(void);
81

82 83 84 85 86 87
/***********************************************
* darshan-common functions for darshan modules *
***********************************************/

char* darshan_clean_file_path(const char* path);

88
#endif /* __DARSHAN_H */