diff --git a/docs/source/build.rst b/docs/source/build.rst index bf9199b..5de7685 100644 --- a/docs/source/build.rst +++ b/docs/source/build.rst @@ -10,6 +10,7 @@ Building Recorder with CMake - HDF5 (required) - NetCDF (optional) - Needed for NetCDF tracing - PnetCDF (optional) - Needed for PnetCDF tracing +- DAOS (optional) - Needed for DAOS (DFS and native DAOS API) tracing - Arrow (optional) > 5.0.0 - Needed for building Parquet convertor. - CUDA (optional) - Needed for CUDA kernels interception. @@ -46,6 +47,13 @@ need to use ``-DCMAKE_PREFIX_PATH`` to indicate their locations: Recorder can also be built with PnetCDF to trace PnetCDF calls, use `-DRECORDER_WITH_PNETCDF=/path/to/pnetcdf/install` to build Recorder with the specified PnetCDF. +Recorder can also be built with DAOS to trace the DAOS File System (DFS) API and the +native DAOS API. Use `-DRECORDER_WITH_DAOS=/path/to/daos/install` to build Recorder with +the specified DAOS installation. The given path must contain ``include/daos.h`` and +``include/daos_fs.h`` as well as ``lib`` (or ``lib64``) with ``libdaos.so`` and ``libdfs.so``. +When DAOS is not found, Recorder is built without DAOS tracing and all other layers are +unaffected. + (2) Intercepting ``fcntl()`` call: Since v2.1.7, ``fcntl(int fd, int cmd, ...)`` is intercepted. The diff --git a/docs/source/usage.rst b/docs/source/usage.rst index 4dde9ed..099341f 100644 --- a/docs/source/usage.rst +++ b/docs/source/usage.rst @@ -32,7 +32,10 @@ library (use ldd to check).* Configure tracing layers ------------------------ -Currently, Recorder is capable of tracing POSIX, MPI, MPI-IO, HDF5, NetCDF and PnetCDF calls. +Currently, Recorder is capable of tracing POSIX, MPI, MPI-IO, HDF5, NetCDF, PnetCDF and +DAOS calls. DAOS tracing covers both the DAOS File System (DFS) API and the native DAOS +API (container, object, array and key-value), and is only available when Recorder was +built with DAOS (see the build instructions). By default, all supported I/O layers are enabled. At runtime (generally before running your application), you can set the following environment variables to dynamically enable/disable @@ -50,6 +53,8 @@ the tracing of certain layers. * export RECORDER_PNETCDF_TRACING=[1|0] (default: 1) +* export RECORDER_DAOS_TRACING=[1|0] (default: 1) + * export RECORDER_MPI_TRACING=[1|0] (default: 0) diff --git a/include/recorder-gotcha.h b/include/recorder-gotcha.h index 0ae08e2..e812ad9 100644 --- a/include/recorder-gotcha.h +++ b/include/recorder-gotcha.h @@ -21,6 +21,11 @@ #include "netcdf_meta.h" #endif +#ifdef RECORDER_WITH_DAOS +#include "daos.h" +#include "daos_fs.h" +#endif + #include "gotcha/gotcha.h" #include "recorder-logger.h" @@ -107,6 +112,7 @@ bool gotcha_mpiio_tracing(); bool gotcha_hdf5_tracing(); bool gotcha_pnetcdf_tracing(); bool gotcha_netcdf_tracing(); +bool gotcha_daos_tracing(); /** @@ -171,6 +177,8 @@ bool gotcha_netcdf_tracing(); intercept = gotcha_pnetcdf_tracing(); \ if (func_type == RECORDER_NETCDF) \ intercept = gotcha_netcdf_tracing(); \ + if (func_type == RECORDER_DAOS) \ + intercept = gotcha_daos_tracing(); \ if (intercept) { \ void* funcptr = gotcha_get_wrappee(WRAPPEE_HANDLE(func)); \ GOTCHA_REAL_CALL(func) = (WRAPPER_TYPE(func)) (funcptr); \ @@ -2355,4 +2363,63 @@ GOTCHA_WRAP(nc_def_opaque, int, (int ncid, size_t size, const char *name, nc_typ GOTCHA_WRAP(nc_inq_opaque, int, (int ncid, nc_type xtype, char *name, size_t *sizep)); #endif /* RECORDER_WITH_NETCDF */ + +/* DAOS Function Calls */ +#ifdef RECORDER_WITH_DAOS +/* DFS API */ +GOTCHA_WRAP(dfs_mount, int, (daos_handle_t poh, daos_handle_t coh, int flags, dfs_t **dfs)); +GOTCHA_WRAP(dfs_umount, int, (dfs_t *dfs)); +GOTCHA_WRAP(dfs_global2local, int, (daos_handle_t poh, daos_handle_t coh, int flags, d_iov_t glob, dfs_t **dfs)); +GOTCHA_WRAP(dfs_lookup, int, (dfs_t *dfs, const char *path, int flags, dfs_obj_t **obj, mode_t *mode, struct stat *stbuf)); +GOTCHA_WRAP(dfs_lookup_rel, int, (dfs_t *dfs, dfs_obj_t *parent, const char *name, int flags, dfs_obj_t **obj, mode_t *mode, struct stat *stbuf)); +GOTCHA_WRAP(dfs_open, int, (dfs_t *dfs, dfs_obj_t *parent, const char *name, mode_t mode, int flags, daos_oclass_id_t cid, daos_size_t chunk_size, const char *value, dfs_obj_t **obj)); +GOTCHA_WRAP(dfs_dup, int, (dfs_t *dfs, dfs_obj_t *obj, int flags, dfs_obj_t **new_obj)); +GOTCHA_WRAP(dfs_obj_global2local, int, (dfs_t *dfs, int flags, d_iov_t glob, dfs_obj_t **obj)); +GOTCHA_WRAP(dfs_release, int, (dfs_obj_t *obj)); +GOTCHA_WRAP(dfs_read, int, (dfs_t *dfs, dfs_obj_t *obj, d_sg_list_t *sgl, daos_off_t off, daos_size_t *read_size, daos_event_t *ev)); +GOTCHA_WRAP(dfs_readx, int, (dfs_t *dfs, dfs_obj_t *obj, dfs_iod_t *iod, d_sg_list_t *sgl, daos_size_t *read_size, daos_event_t *ev)); +GOTCHA_WRAP(dfs_write, int, (dfs_t *dfs, dfs_obj_t *obj, d_sg_list_t *sgl, daos_off_t off, daos_event_t *ev)); +GOTCHA_WRAP(dfs_writex, int, (dfs_t *dfs, dfs_obj_t *obj, dfs_iod_t *iod, d_sg_list_t *sgl, daos_event_t *ev)); +GOTCHA_WRAP(dfs_get_size, int, (dfs_t *dfs, dfs_obj_t *obj, daos_size_t *size)); +GOTCHA_WRAP(dfs_punch, int, (dfs_t *dfs, dfs_obj_t *obj, daos_off_t offset, daos_size_t len)); +GOTCHA_WRAP(dfs_remove, int, (dfs_t *dfs, dfs_obj_t *parent, const char *name, bool force, daos_obj_id_t *oid)); +GOTCHA_WRAP(dfs_ostat, int, (dfs_t *dfs, dfs_obj_t *obj, struct stat *stbuf)); +GOTCHA_WRAP(dfs_osetattr, int, (dfs_t *dfs, dfs_obj_t *obj, struct stat *stbuf, int flags)); +/* Native DAOS API - Container */ +GOTCHA_WRAP(daos_cont_open2, int, (daos_handle_t poh, const char *cont, unsigned int flags, daos_handle_t *coh, daos_cont_info_t *info, daos_event_t *ev)); +GOTCHA_WRAP(daos_cont_global2local, int, (daos_handle_t poh, d_iov_t glob, daos_handle_t *coh)); +GOTCHA_WRAP(daos_cont_close, int, (daos_handle_t coh, daos_event_t *ev)); +/* Native DAOS API - Object */ +GOTCHA_WRAP(daos_obj_open, int, (daos_handle_t coh, daos_obj_id_t oid, unsigned int mode, daos_handle_t *oh, daos_event_t *ev)); +GOTCHA_WRAP(daos_obj_fetch, int, (daos_handle_t oh, daos_handle_t th, uint64_t flags, daos_key_t *dkey, unsigned int nr, daos_iod_t *iods, d_sg_list_t *sgls, daos_iom_t *ioms, daos_event_t *ev)); +GOTCHA_WRAP(daos_obj_update, int, (daos_handle_t oh, daos_handle_t th, uint64_t flags, daos_key_t *dkey, unsigned int nr, daos_iod_t *iods, d_sg_list_t *sgls, daos_event_t *ev)); +GOTCHA_WRAP(daos_obj_punch, int, (daos_handle_t oh, daos_handle_t th, uint64_t flags, daos_event_t *ev)); +GOTCHA_WRAP(daos_obj_punch_dkeys, int, (daos_handle_t oh, daos_handle_t th, uint64_t flags, unsigned int nr, daos_key_t *dkeys, daos_event_t *ev)); +GOTCHA_WRAP(daos_obj_punch_akeys, int, (daos_handle_t oh, daos_handle_t th, uint64_t flags, daos_key_t *dkey, unsigned int nr, daos_key_t *akeys, daos_event_t *ev)); +GOTCHA_WRAP(daos_obj_list_dkey, int, (daos_handle_t oh, daos_handle_t th, uint32_t *nr, daos_key_desc_t *kds, d_sg_list_t *sgl, daos_anchor_t *anchor, daos_event_t *ev)); +GOTCHA_WRAP(daos_obj_list_akey, int, (daos_handle_t oh, daos_handle_t th, daos_key_t *dkey, uint32_t *nr, daos_key_desc_t *kds, d_sg_list_t *sgl, daos_anchor_t *anchor, daos_event_t *ev)); +GOTCHA_WRAP(daos_obj_list_recx, int, (daos_handle_t oh, daos_handle_t th, daos_key_t *dkey, daos_key_t *akey, daos_size_t *size, uint32_t *nr, daos_recx_t *recxs, daos_epoch_range_t *eprs, daos_anchor_t *anchor, bool incr_order, daos_event_t *ev)); +GOTCHA_WRAP(daos_obj_close, int, (daos_handle_t oh, daos_event_t *ev)); +/* Native DAOS API - Array */ +GOTCHA_WRAP(daos_array_create, int, (daos_handle_t coh, daos_obj_id_t oid, daos_handle_t th, daos_size_t cell_size, daos_size_t chunk_size, daos_handle_t *oh, daos_event_t *ev)); +GOTCHA_WRAP(daos_array_open, int, (daos_handle_t coh, daos_obj_id_t oid, daos_handle_t th, unsigned int mode, daos_size_t *cell_size, daos_size_t *chunk_size, daos_handle_t *oh, daos_event_t *ev)); +GOTCHA_WRAP(daos_array_open_with_attr, int, (daos_handle_t coh, daos_obj_id_t oid, daos_handle_t th, unsigned int mode, daos_size_t cell_size, daos_size_t chunk_size, daos_handle_t *oh, daos_event_t *ev)); +GOTCHA_WRAP(daos_array_read, int, (daos_handle_t oh, daos_handle_t th, daos_array_iod_t *iod, d_sg_list_t *sgl, daos_event_t *ev)); +GOTCHA_WRAP(daos_array_write, int, (daos_handle_t oh, daos_handle_t th, daos_array_iod_t *iod, d_sg_list_t *sgl, daos_event_t *ev)); +GOTCHA_WRAP(daos_array_get_size, int, (daos_handle_t oh, daos_handle_t th, daos_size_t *size, daos_event_t *ev)); +GOTCHA_WRAP(daos_array_set_size, int, (daos_handle_t oh, daos_handle_t th, daos_size_t size, daos_event_t *ev)); +GOTCHA_WRAP(daos_array_stat, int, (daos_handle_t oh, daos_handle_t th, daos_array_stbuf_t *stbuf, daos_event_t *ev)); +GOTCHA_WRAP(daos_array_punch, int, (daos_handle_t oh, daos_handle_t th, daos_array_iod_t *iod, daos_event_t *ev)); +GOTCHA_WRAP(daos_array_destroy, int, (daos_handle_t oh, daos_handle_t th, daos_event_t *ev)); +GOTCHA_WRAP(daos_array_close, int, (daos_handle_t oh, daos_event_t *ev)); +/* Native DAOS API - Key-Value */ +GOTCHA_WRAP(daos_kv_open, int, (daos_handle_t coh, daos_obj_id_t oid, unsigned int mode, daos_handle_t *oh, daos_event_t *ev)); +GOTCHA_WRAP(daos_kv_get, int, (daos_handle_t oh, daos_handle_t th, uint64_t flags, const char *key, daos_size_t *size, void *buf, daos_event_t *ev)); +GOTCHA_WRAP(daos_kv_put, int, (daos_handle_t oh, daos_handle_t th, uint64_t flags, const char *key, daos_size_t size, const void *buf, daos_event_t *ev)); +GOTCHA_WRAP(daos_kv_remove, int, (daos_handle_t oh, daos_handle_t th, uint64_t flags, const char *key, daos_event_t *ev)); +GOTCHA_WRAP(daos_kv_list, int, (daos_handle_t oh, daos_handle_t th, uint32_t *nr, daos_key_desc_t *kds, d_sg_list_t *sgl, daos_anchor_t *anchor, daos_event_t *ev)); +GOTCHA_WRAP(daos_kv_destroy, int, (daos_handle_t oh, daos_handle_t th, daos_event_t *ev)); +GOTCHA_WRAP(daos_kv_close, int, (daos_handle_t oh, daos_event_t *ev)); +#endif /* RECORDER_WITH_DAOS */ + #endif /* __RECORDER_GOTCHA_H */ diff --git a/include/recorder-logger.h b/include/recorder-logger.h index 19a21b8..2f02f4c 100644 --- a/include/recorder-logger.h +++ b/include/recorder-logger.h @@ -29,6 +29,7 @@ #define RECORDER_FTRACE 4 #define RECORDER_PNETCDF 5 #define RECORDER_NETCDF 6 +#define RECORDER_DAOS 7 #define RECORDER_USER_FUNCTION 255 @@ -111,6 +112,7 @@ typedef struct RecorderMetadata_t { bool hdf5_tracing; bool pnetcdf_tracing; bool netcdf_tracing; + bool daos_tracing; bool store_tid; // Wether to store thread id bool store_call_depth; // Wether to store the call depth double start_ts; @@ -928,6 +930,25 @@ static const char* func_list[] = { "nc_inq_enum", "nc_inq_enum_member", "nc_inq_enum_ident", "nc_free_vlen", "nc_free_vlens", "nc_def_vlen", "nc_inq_vlen", "nc_def_opaque", "nc_inq_opaque", + + // DAOS - DFS API and native DAOS API + "dfs_mount", "dfs_umount", "dfs_global2local", + "dfs_lookup", "dfs_lookup_rel", "dfs_open", + "dfs_dup", "dfs_obj_global2local", "dfs_release", + "dfs_read", "dfs_readx", "dfs_write", + "dfs_writex", "dfs_get_size", "dfs_punch", + "dfs_remove", "dfs_ostat", "dfs_osetattr", + "daos_cont_open2", "daos_cont_global2local", "daos_cont_close", + "daos_obj_open", "daos_obj_fetch", "daos_obj_update", + "daos_obj_punch", "daos_obj_punch_dkeys", "daos_obj_punch_akeys", + "daos_obj_list_dkey", "daos_obj_list_akey", "daos_obj_list_recx", + "daos_obj_close", "daos_array_create", "daos_array_open", + "daos_array_open_with_attr", "daos_array_read", "daos_array_write", + "daos_array_get_size", "daos_array_set_size", "daos_array_stat", + "daos_array_punch", "daos_array_destroy", "daos_array_close", + "daos_kv_open", "daos_kv_get", "daos_kv_put", + "daos_kv_remove", "daos_kv_list", "daos_kv_destroy", + "daos_kv_close", }; #endif /* __RECORDER_LOGGER_H */ diff --git a/include/recorder.h b/include/recorder.h index fdd8106..39e4e9d 100644 --- a/include/recorder.h +++ b/include/recorder.h @@ -34,6 +34,7 @@ #define RECORDER_HDF5_TRACING "RECORDER_HDF5_TRACING" #define RECORDER_PNETCDF_TRACING "RECORDER_PNETCDF_TRACING" #define RECORDER_NETCDF_TRACING "RECORDER_NETCDF_TRACING" +#define RECORDER_DAOS_TRACING "RECORDER_DAOS_TRACING" /** diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index b56b3ed..d625bdc 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -100,6 +100,29 @@ else() message("-- " "NetCDF not found. Will build Recorder without it. To use a local installation, set -DRECORDER_WITH_NETCDF=/path/to/netcdf") endif() +# Look for DAOS (DFS + native DAOS API) +# DAOS is not a CMAKE project, we use find_path() to locate it +# this requires users to set -DRECORDER_WITH_DAOS=/xx/xx/ +find_path(DAOS_INCLUDE_DIRS daos.h ${RECORDER_WITH_DAOS}/include) +find_path(DAOS_FS_INCLUDE_DIRS daos_fs.h ${RECORDER_WITH_DAOS}/include) +find_path(DAOS_LIBRARY_FOUND libdaos.so ${RECORDER_WITH_DAOS}/lib ${RECORDER_WITH_DAOS}/lib64) +find_path(DFS_LIBRARY_FOUND libdfs.so ${RECORDER_WITH_DAOS}/lib ${RECORDER_WITH_DAOS}/lib64) +if(DAOS_INCLUDE_DIRS AND DAOS_FS_INCLUDE_DIRS AND DAOS_LIBRARY_FOUND AND DFS_LIBRARY_FOUND) + message("-- " "Found DAOS:" ${RECORDER_WITH_DAOS}) + set(RECORDER_SRCS + ${CMAKE_CURRENT_SOURCE_DIR}/recorder-daos.c + ${RECORDER_SRCS} + ) + include_directories(${DAOS_INCLUDE_DIRS}) + set(DAOS_LIBRARIES ${DAOS_LIBRARY_FOUND}/libdaos.so ${DFS_LIBRARY_FOUND}/libdfs.so) + set(RECORDER_EXT_INCLUDE_DEPENDENCIES ${DAOS_INCLUDE_DIRS} + ${RECORDER_EXT_INCLUDE_DEPENDENCIES}) + set(RECORDER_EXT_LIB_DEPENDENCIES + ${DAOS_LIBRARIES} ${RECORDER_EXT_LIB_DEPENDENCIES}) +else() + message("-- " "DAOS not found. Will build Recorder without it.") +endif() + find_package(MPI REQUIRED) if(MPI_FOUND) @@ -188,6 +211,7 @@ target_compile_definitions(recorder PRIVATE $<$:RECORDER_WITH_HDF5> PRIVATE $<$,$>:RECORDER_WITH_PNETCDF> PRIVATE $<$,$>:RECORDER_WITH_NETCDF> + PRIVATE $<$,$,$,$>:RECORDER_WITH_DAOS> PRIVATE $<$:RECORDER_ENABLE_FCNTL_TRACE> PRIVATE $<$:RECORDER_ENABLE_CUDA_TRACE> ) diff --git a/lib/recorder-daos.c b/lib/recorder-daos.c new file mode 100644 index 0000000..3f19f00 --- /dev/null +++ b/lib/recorder-daos.c @@ -0,0 +1,390 @@ +#define _XOPEN_SOURCE 500 +#define _GNU_SOURCE // Need to be on top to use RTLD_NEXT + +#include +#include +#include +#include +#include +#include "recorder.h" + +#ifdef RECORDER_WITH_DAOS + +#include +#include + +/* + * Wrappers of the DAOS File System (DFS) API and the native DAOS API. + * + * Following the same convention as the other layers (e.g., recorder-hdf5.c), + * every wrapper. + * + * Identifiers are recorded HDF5-style, i.e., as raw handle/pointer values: + * - daos_handle_t (by value) -> itoa(handle.cookie) + * - daos_handle_t* (output) -> itoa((p==NULL)?-1:p->cookie) + * - daos_obj_id_t (by value) -> itoa(oid.hi), itoa(oid.lo) (two fields) + * - d_iov_t (by value) -> ptoa(iov.iov_buf), itoa(iov.iov_len) + * - pointers (dfs_t*, etc.) -> ptoa(ptr) + * - scalars (offsets, sizes, + * flags, modes, counts) -> itoa(value); output scalars are guarded + * with the (p==NULL)?-1:*p idiom used elsewhere in Recorder. + * - strings (paths/names/keys) -> strtoa(str) + * + * No object->name resolution is performed; identifiers are stored as-is, + * exactly like the HDF5 layer stores hid_t handles. + */ + + +/* ------------------------------------------------------------------ * + * DFS API (libdfs) + * ------------------------------------------------------------------ */ + +int WRAPPER_NAME(dfs_mount)(daos_handle_t poh, daos_handle_t coh, int flags, dfs_t **dfs) { + RECORDER_INTERCEPTOR_PROLOGUE(int, dfs_mount, (poh, coh, flags, dfs)); + char **args = assemble_args_list(4, itoa(poh.cookie), itoa(coh.cookie), itoa(flags), + ptoa((dfs==NULL)?NULL:*dfs)); + RECORDER_INTERCEPTOR_EPILOGUE(4, args); +} + +int WRAPPER_NAME(dfs_umount)(dfs_t *dfs) { + RECORDER_INTERCEPTOR_PROLOGUE(int, dfs_umount, (dfs)); + char **args = assemble_args_list(1, ptoa(dfs)); + RECORDER_INTERCEPTOR_EPILOGUE(1, args); +} + +int WRAPPER_NAME(dfs_global2local)(daos_handle_t poh, daos_handle_t coh, int flags, d_iov_t glob, dfs_t **dfs) { + RECORDER_INTERCEPTOR_PROLOGUE(int, dfs_global2local, (poh, coh, flags, glob, dfs)); + char **args = assemble_args_list(6, itoa(poh.cookie), itoa(coh.cookie), itoa(flags), + ptoa(glob.iov_buf), itoa(glob.iov_len), ptoa((dfs==NULL)?NULL:*dfs)); + RECORDER_INTERCEPTOR_EPILOGUE(6, args); +} + +int WRAPPER_NAME(dfs_lookup)(dfs_t *dfs, const char *path, int flags, dfs_obj_t **obj, mode_t *mode, struct stat *stbuf) { + RECORDER_INTERCEPTOR_PROLOGUE(int, dfs_lookup, (dfs, path, flags, obj, mode, stbuf)); + char **args = assemble_args_list(6, ptoa(dfs), strtoa(path), itoa(flags), + ptoa((obj==NULL)?NULL:*obj), itoa((mode==NULL)?-1:*mode), ptoa(stbuf)); + RECORDER_INTERCEPTOR_EPILOGUE(6, args); +} + +int WRAPPER_NAME(dfs_lookup_rel)(dfs_t *dfs, dfs_obj_t *parent, const char *name, int flags, dfs_obj_t **obj, mode_t *mode, struct stat *stbuf) { + RECORDER_INTERCEPTOR_PROLOGUE(int, dfs_lookup_rel, (dfs, parent, name, flags, obj, mode, stbuf)); + char **args = assemble_args_list(7, ptoa(dfs), ptoa(parent), strtoa(name), itoa(flags), + ptoa((obj==NULL)?NULL:*obj), itoa((mode==NULL)?-1:*mode), ptoa(stbuf)); + RECORDER_INTERCEPTOR_EPILOGUE(7, args); +} + +int WRAPPER_NAME(dfs_open)(dfs_t *dfs, dfs_obj_t *parent, const char *name, mode_t mode, int flags, daos_oclass_id_t cid, daos_size_t chunk_size, const char *value, dfs_obj_t **obj) { + RECORDER_INTERCEPTOR_PROLOGUE(int, dfs_open, (dfs, parent, name, mode, flags, cid, chunk_size, value, obj)); + char **args = assemble_args_list(9, ptoa(dfs), ptoa(parent), strtoa(name), itoa(mode), itoa(flags), + itoa(cid), itoa(chunk_size), strtoa(value), ptoa((obj==NULL)?NULL:*obj)); + RECORDER_INTERCEPTOR_EPILOGUE(9, args); +} + +int WRAPPER_NAME(dfs_dup)(dfs_t *dfs, dfs_obj_t *obj, int flags, dfs_obj_t **new_obj) { + RECORDER_INTERCEPTOR_PROLOGUE(int, dfs_dup, (dfs, obj, flags, new_obj)); + char **args = assemble_args_list(4, ptoa(dfs), ptoa(obj), itoa(flags), ptoa((new_obj==NULL)?NULL:*new_obj)); + RECORDER_INTERCEPTOR_EPILOGUE(4, args); +} + +int WRAPPER_NAME(dfs_obj_global2local)(dfs_t *dfs, int flags, d_iov_t glob, dfs_obj_t **obj) { + RECORDER_INTERCEPTOR_PROLOGUE(int, dfs_obj_global2local, (dfs, flags, glob, obj)); + char **args = assemble_args_list(5, ptoa(dfs), itoa(flags), ptoa(glob.iov_buf), itoa(glob.iov_len), + ptoa((obj==NULL)?NULL:*obj)); + RECORDER_INTERCEPTOR_EPILOGUE(5, args); +} + +int WRAPPER_NAME(dfs_release)(dfs_obj_t *obj) { + RECORDER_INTERCEPTOR_PROLOGUE(int, dfs_release, (obj)); + char **args = assemble_args_list(1, ptoa(obj)); + RECORDER_INTERCEPTOR_EPILOGUE(1, args); +} + +int WRAPPER_NAME(dfs_read)(dfs_t *dfs, dfs_obj_t *obj, d_sg_list_t *sgl, daos_off_t off, daos_size_t *read_size, daos_event_t *ev) { + RECORDER_INTERCEPTOR_PROLOGUE(int, dfs_read, (dfs, obj, sgl, off, read_size, ev)); + char **args = assemble_args_list(6, ptoa(dfs), ptoa(obj), ptoa(sgl), itoa(off), + itoa((read_size==NULL)?-1:*read_size), ptoa(ev)); + RECORDER_INTERCEPTOR_EPILOGUE(6, args); +} + +int WRAPPER_NAME(dfs_readx)(dfs_t *dfs, dfs_obj_t *obj, dfs_iod_t *iod, d_sg_list_t *sgl, daos_size_t *read_size, daos_event_t *ev) { + RECORDER_INTERCEPTOR_PROLOGUE(int, dfs_readx, (dfs, obj, iod, sgl, read_size, ev)); + char **args = assemble_args_list(6, ptoa(dfs), ptoa(obj), ptoa(iod), ptoa(sgl), + itoa((read_size==NULL)?-1:*read_size), ptoa(ev)); + RECORDER_INTERCEPTOR_EPILOGUE(6, args); +} + +int WRAPPER_NAME(dfs_write)(dfs_t *dfs, dfs_obj_t *obj, d_sg_list_t *sgl, daos_off_t off, daos_event_t *ev) { + RECORDER_INTERCEPTOR_PROLOGUE(int, dfs_write, (dfs, obj, sgl, off, ev)); + char **args = assemble_args_list(5, ptoa(dfs), ptoa(obj), ptoa(sgl), itoa(off), ptoa(ev)); + RECORDER_INTERCEPTOR_EPILOGUE(5, args); +} + +int WRAPPER_NAME(dfs_writex)(dfs_t *dfs, dfs_obj_t *obj, dfs_iod_t *iod, d_sg_list_t *sgl, daos_event_t *ev) { + RECORDER_INTERCEPTOR_PROLOGUE(int, dfs_writex, (dfs, obj, iod, sgl, ev)); + char **args = assemble_args_list(5, ptoa(dfs), ptoa(obj), ptoa(iod), ptoa(sgl), ptoa(ev)); + RECORDER_INTERCEPTOR_EPILOGUE(5, args); +} + +int WRAPPER_NAME(dfs_get_size)(dfs_t *dfs, dfs_obj_t *obj, daos_size_t *size) { + RECORDER_INTERCEPTOR_PROLOGUE(int, dfs_get_size, (dfs, obj, size)); + char **args = assemble_args_list(3, ptoa(dfs), ptoa(obj), itoa((size==NULL)?-1:*size)); + RECORDER_INTERCEPTOR_EPILOGUE(3, args); +} + +int WRAPPER_NAME(dfs_punch)(dfs_t *dfs, dfs_obj_t *obj, daos_off_t offset, daos_size_t len) { + RECORDER_INTERCEPTOR_PROLOGUE(int, dfs_punch, (dfs, obj, offset, len)); + char **args = assemble_args_list(4, ptoa(dfs), ptoa(obj), itoa(offset), itoa(len)); + RECORDER_INTERCEPTOR_EPILOGUE(4, args); +} + +int WRAPPER_NAME(dfs_remove)(dfs_t *dfs, dfs_obj_t *parent, const char *name, bool force, daos_obj_id_t *oid) { + RECORDER_INTERCEPTOR_PROLOGUE(int, dfs_remove, (dfs, parent, name, force, oid)); + char **args = assemble_args_list(6, ptoa(dfs), ptoa(parent), strtoa(name), itoa(force), + itoa((oid==NULL)?-1:oid->hi), itoa((oid==NULL)?-1:oid->lo)); + RECORDER_INTERCEPTOR_EPILOGUE(6, args); +} + +int WRAPPER_NAME(dfs_ostat)(dfs_t *dfs, dfs_obj_t *obj, struct stat *stbuf) { + RECORDER_INTERCEPTOR_PROLOGUE(int, dfs_ostat, (dfs, obj, stbuf)); + char **args = assemble_args_list(3, ptoa(dfs), ptoa(obj), ptoa(stbuf)); + RECORDER_INTERCEPTOR_EPILOGUE(3, args); +} + +int WRAPPER_NAME(dfs_osetattr)(dfs_t *dfs, dfs_obj_t *obj, struct stat *stbuf, int flags) { + RECORDER_INTERCEPTOR_PROLOGUE(int, dfs_osetattr, (dfs, obj, stbuf, flags)); + char **args = assemble_args_list(4, ptoa(dfs), ptoa(obj), ptoa(stbuf), itoa(flags)); + RECORDER_INTERCEPTOR_EPILOGUE(4, args); +} + + +/* ------------------------------------------------------------------ * + * Native DAOS API - Container + * ------------------------------------------------------------------ */ + +/* DAOS aliases daos_cont_open to the versioned symbol daos_cont_open2 via + * `#define daos_cont_open daos_cont_open2` in daos.h. We must name the wrapper + * after the real symbol explicitly: WRAPPER_NAME() uses ## (token paste), which + * suppresses macro expansion, so WRAPPER_NAME(daos_cont_open) would produce + * wrapper_daos_cont_open while the GOTCHA_WRAP/GOTCHA_WRAP_ACTION machinery + * (which expands the argument first) expects wrapper_daos_cont_open2. */ +int WRAPPER_NAME(daos_cont_open2)(daos_handle_t poh, const char *cont, unsigned int flags, daos_handle_t *coh, daos_cont_info_t *info, daos_event_t *ev) { + RECORDER_INTERCEPTOR_PROLOGUE(int, daos_cont_open2, (poh, cont, flags, coh, info, ev)); + char **args = assemble_args_list(6, itoa(poh.cookie), strtoa(cont), itoa(flags), + itoa((coh==NULL)?-1:coh->cookie), ptoa(info), ptoa(ev)); + RECORDER_INTERCEPTOR_EPILOGUE(6, args); +} + +int WRAPPER_NAME(daos_cont_global2local)(daos_handle_t poh, d_iov_t glob, daos_handle_t *coh) { + RECORDER_INTERCEPTOR_PROLOGUE(int, daos_cont_global2local, (poh, glob, coh)); + char **args = assemble_args_list(4, itoa(poh.cookie), ptoa(glob.iov_buf), itoa(glob.iov_len), + itoa((coh==NULL)?-1:coh->cookie)); + RECORDER_INTERCEPTOR_EPILOGUE(4, args); +} + +int WRAPPER_NAME(daos_cont_close)(daos_handle_t coh, daos_event_t *ev) { + RECORDER_INTERCEPTOR_PROLOGUE(int, daos_cont_close, (coh, ev)); + char **args = assemble_args_list(2, itoa(coh.cookie), ptoa(ev)); + RECORDER_INTERCEPTOR_EPILOGUE(2, args); +} + + +/* ------------------------------------------------------------------ * + * Native DAOS API - Object (Multi-Level Key-Array) + * ------------------------------------------------------------------ */ + +int WRAPPER_NAME(daos_obj_open)(daos_handle_t coh, daos_obj_id_t oid, unsigned int mode, daos_handle_t *oh, daos_event_t *ev) { + RECORDER_INTERCEPTOR_PROLOGUE(int, daos_obj_open, (coh, oid, mode, oh, ev)); + char **args = assemble_args_list(6, itoa(coh.cookie), itoa(oid.hi), itoa(oid.lo), itoa(mode), + itoa((oh==NULL)?-1:oh->cookie), ptoa(ev)); + RECORDER_INTERCEPTOR_EPILOGUE(6, args); +} + +int WRAPPER_NAME(daos_obj_fetch)(daos_handle_t oh, daos_handle_t th, uint64_t flags, daos_key_t *dkey, unsigned int nr, daos_iod_t *iods, d_sg_list_t *sgls, daos_iom_t *ioms, daos_event_t *ev) { + RECORDER_INTERCEPTOR_PROLOGUE(int, daos_obj_fetch, (oh, th, flags, dkey, nr, iods, sgls, ioms, ev)); + char **args = assemble_args_list(9, itoa(oh.cookie), itoa(th.cookie), itoa(flags), ptoa(dkey), + itoa(nr), ptoa(iods), ptoa(sgls), ptoa(ioms), ptoa(ev)); + RECORDER_INTERCEPTOR_EPILOGUE(9, args); +} + +int WRAPPER_NAME(daos_obj_update)(daos_handle_t oh, daos_handle_t th, uint64_t flags, daos_key_t *dkey, unsigned int nr, daos_iod_t *iods, d_sg_list_t *sgls, daos_event_t *ev) { + RECORDER_INTERCEPTOR_PROLOGUE(int, daos_obj_update, (oh, th, flags, dkey, nr, iods, sgls, ev)); + char **args = assemble_args_list(8, itoa(oh.cookie), itoa(th.cookie), itoa(flags), ptoa(dkey), + itoa(nr), ptoa(iods), ptoa(sgls), ptoa(ev)); + RECORDER_INTERCEPTOR_EPILOGUE(8, args); +} + +int WRAPPER_NAME(daos_obj_punch)(daos_handle_t oh, daos_handle_t th, uint64_t flags, daos_event_t *ev) { + RECORDER_INTERCEPTOR_PROLOGUE(int, daos_obj_punch, (oh, th, flags, ev)); + char **args = assemble_args_list(4, itoa(oh.cookie), itoa(th.cookie), itoa(flags), ptoa(ev)); + RECORDER_INTERCEPTOR_EPILOGUE(4, args); +} + +int WRAPPER_NAME(daos_obj_punch_dkeys)(daos_handle_t oh, daos_handle_t th, uint64_t flags, unsigned int nr, daos_key_t *dkeys, daos_event_t *ev) { + RECORDER_INTERCEPTOR_PROLOGUE(int, daos_obj_punch_dkeys, (oh, th, flags, nr, dkeys, ev)); + char **args = assemble_args_list(6, itoa(oh.cookie), itoa(th.cookie), itoa(flags), itoa(nr), + ptoa(dkeys), ptoa(ev)); + RECORDER_INTERCEPTOR_EPILOGUE(6, args); +} + +int WRAPPER_NAME(daos_obj_punch_akeys)(daos_handle_t oh, daos_handle_t th, uint64_t flags, daos_key_t *dkey, unsigned int nr, daos_key_t *akeys, daos_event_t *ev) { + RECORDER_INTERCEPTOR_PROLOGUE(int, daos_obj_punch_akeys, (oh, th, flags, dkey, nr, akeys, ev)); + char **args = assemble_args_list(7, itoa(oh.cookie), itoa(th.cookie), itoa(flags), ptoa(dkey), + itoa(nr), ptoa(akeys), ptoa(ev)); + RECORDER_INTERCEPTOR_EPILOGUE(7, args); +} + +int WRAPPER_NAME(daos_obj_list_dkey)(daos_handle_t oh, daos_handle_t th, uint32_t *nr, daos_key_desc_t *kds, d_sg_list_t *sgl, daos_anchor_t *anchor, daos_event_t *ev) { + RECORDER_INTERCEPTOR_PROLOGUE(int, daos_obj_list_dkey, (oh, th, nr, kds, sgl, anchor, ev)); + char **args = assemble_args_list(7, itoa(oh.cookie), itoa(th.cookie), itoa((nr==NULL)?-1:*nr), + ptoa(kds), ptoa(sgl), ptoa(anchor), ptoa(ev)); + RECORDER_INTERCEPTOR_EPILOGUE(7, args); +} + +int WRAPPER_NAME(daos_obj_list_akey)(daos_handle_t oh, daos_handle_t th, daos_key_t *dkey, uint32_t *nr, daos_key_desc_t *kds, d_sg_list_t *sgl, daos_anchor_t *anchor, daos_event_t *ev) { + RECORDER_INTERCEPTOR_PROLOGUE(int, daos_obj_list_akey, (oh, th, dkey, nr, kds, sgl, anchor, ev)); + char **args = assemble_args_list(8, itoa(oh.cookie), itoa(th.cookie), ptoa(dkey), + itoa((nr==NULL)?-1:*nr), ptoa(kds), ptoa(sgl), ptoa(anchor), ptoa(ev)); + RECORDER_INTERCEPTOR_EPILOGUE(8, args); +} + +int WRAPPER_NAME(daos_obj_list_recx)(daos_handle_t oh, daos_handle_t th, daos_key_t *dkey, daos_key_t *akey, daos_size_t *size, uint32_t *nr, daos_recx_t *recxs, daos_epoch_range_t *eprs, daos_anchor_t *anchor, bool incr_order, daos_event_t *ev) { + RECORDER_INTERCEPTOR_PROLOGUE(int, daos_obj_list_recx, (oh, th, dkey, akey, size, nr, recxs, eprs, anchor, incr_order, ev)); + char **args = assemble_args_list(11, itoa(oh.cookie), itoa(th.cookie), ptoa(dkey), ptoa(akey), + itoa((size==NULL)?-1:*size), itoa((nr==NULL)?-1:*nr), ptoa(recxs), + ptoa(eprs), ptoa(anchor), itoa(incr_order), ptoa(ev)); + RECORDER_INTERCEPTOR_EPILOGUE(11, args); +} + +int WRAPPER_NAME(daos_obj_close)(daos_handle_t oh, daos_event_t *ev) { + RECORDER_INTERCEPTOR_PROLOGUE(int, daos_obj_close, (oh, ev)); + char **args = assemble_args_list(2, itoa(oh.cookie), ptoa(ev)); + RECORDER_INTERCEPTOR_EPILOGUE(2, args); +} + + +/* ------------------------------------------------------------------ * + * Native DAOS API - Array + * ------------------------------------------------------------------ */ + +int WRAPPER_NAME(daos_array_create)(daos_handle_t coh, daos_obj_id_t oid, daos_handle_t th, daos_size_t cell_size, daos_size_t chunk_size, daos_handle_t *oh, daos_event_t *ev) { + RECORDER_INTERCEPTOR_PROLOGUE(int, daos_array_create, (coh, oid, th, cell_size, chunk_size, oh, ev)); + char **args = assemble_args_list(8, itoa(coh.cookie), itoa(oid.hi), itoa(oid.lo), itoa(th.cookie), + itoa(cell_size), itoa(chunk_size), itoa((oh==NULL)?-1:oh->cookie), ptoa(ev)); + RECORDER_INTERCEPTOR_EPILOGUE(8, args); +} + +int WRAPPER_NAME(daos_array_open)(daos_handle_t coh, daos_obj_id_t oid, daos_handle_t th, unsigned int mode, daos_size_t *cell_size, daos_size_t *chunk_size, daos_handle_t *oh, daos_event_t *ev) { + RECORDER_INTERCEPTOR_PROLOGUE(int, daos_array_open, (coh, oid, th, mode, cell_size, chunk_size, oh, ev)); + char **args = assemble_args_list(9, itoa(coh.cookie), itoa(oid.hi), itoa(oid.lo), itoa(th.cookie), itoa(mode), + itoa((cell_size==NULL)?-1:*cell_size), itoa((chunk_size==NULL)?-1:*chunk_size), + itoa((oh==NULL)?-1:oh->cookie), ptoa(ev)); + RECORDER_INTERCEPTOR_EPILOGUE(9, args); +} + +int WRAPPER_NAME(daos_array_open_with_attr)(daos_handle_t coh, daos_obj_id_t oid, daos_handle_t th, unsigned int mode, daos_size_t cell_size, daos_size_t chunk_size, daos_handle_t *oh, daos_event_t *ev) { + RECORDER_INTERCEPTOR_PROLOGUE(int, daos_array_open_with_attr, (coh, oid, th, mode, cell_size, chunk_size, oh, ev)); + char **args = assemble_args_list(9, itoa(coh.cookie), itoa(oid.hi), itoa(oid.lo), itoa(th.cookie), itoa(mode), + itoa(cell_size), itoa(chunk_size), itoa((oh==NULL)?-1:oh->cookie), ptoa(ev)); + RECORDER_INTERCEPTOR_EPILOGUE(9, args); +} + +int WRAPPER_NAME(daos_array_read)(daos_handle_t oh, daos_handle_t th, daos_array_iod_t *iod, d_sg_list_t *sgl, daos_event_t *ev) { + RECORDER_INTERCEPTOR_PROLOGUE(int, daos_array_read, (oh, th, iod, sgl, ev)); + char **args = assemble_args_list(5, itoa(oh.cookie), itoa(th.cookie), ptoa(iod), ptoa(sgl), ptoa(ev)); + RECORDER_INTERCEPTOR_EPILOGUE(5, args); +} + +int WRAPPER_NAME(daos_array_write)(daos_handle_t oh, daos_handle_t th, daos_array_iod_t *iod, d_sg_list_t *sgl, daos_event_t *ev) { + RECORDER_INTERCEPTOR_PROLOGUE(int, daos_array_write, (oh, th, iod, sgl, ev)); + char **args = assemble_args_list(5, itoa(oh.cookie), itoa(th.cookie), ptoa(iod), ptoa(sgl), ptoa(ev)); + RECORDER_INTERCEPTOR_EPILOGUE(5, args); +} + +int WRAPPER_NAME(daos_array_get_size)(daos_handle_t oh, daos_handle_t th, daos_size_t *size, daos_event_t *ev) { + RECORDER_INTERCEPTOR_PROLOGUE(int, daos_array_get_size, (oh, th, size, ev)); + char **args = assemble_args_list(4, itoa(oh.cookie), itoa(th.cookie), itoa((size==NULL)?-1:*size), ptoa(ev)); + RECORDER_INTERCEPTOR_EPILOGUE(4, args); +} + +int WRAPPER_NAME(daos_array_set_size)(daos_handle_t oh, daos_handle_t th, daos_size_t size, daos_event_t *ev) { + RECORDER_INTERCEPTOR_PROLOGUE(int, daos_array_set_size, (oh, th, size, ev)); + char **args = assemble_args_list(4, itoa(oh.cookie), itoa(th.cookie), itoa(size), ptoa(ev)); + RECORDER_INTERCEPTOR_EPILOGUE(4, args); +} + +int WRAPPER_NAME(daos_array_stat)(daos_handle_t oh, daos_handle_t th, daos_array_stbuf_t *stbuf, daos_event_t *ev) { + RECORDER_INTERCEPTOR_PROLOGUE(int, daos_array_stat, (oh, th, stbuf, ev)); + char **args = assemble_args_list(4, itoa(oh.cookie), itoa(th.cookie), ptoa(stbuf), ptoa(ev)); + RECORDER_INTERCEPTOR_EPILOGUE(4, args); +} + +int WRAPPER_NAME(daos_array_punch)(daos_handle_t oh, daos_handle_t th, daos_array_iod_t *iod, daos_event_t *ev) { + RECORDER_INTERCEPTOR_PROLOGUE(int, daos_array_punch, (oh, th, iod, ev)); + char **args = assemble_args_list(4, itoa(oh.cookie), itoa(th.cookie), ptoa(iod), ptoa(ev)); + RECORDER_INTERCEPTOR_EPILOGUE(4, args); +} + +int WRAPPER_NAME(daos_array_destroy)(daos_handle_t oh, daos_handle_t th, daos_event_t *ev) { + RECORDER_INTERCEPTOR_PROLOGUE(int, daos_array_destroy, (oh, th, ev)); + char **args = assemble_args_list(3, itoa(oh.cookie), itoa(th.cookie), ptoa(ev)); + RECORDER_INTERCEPTOR_EPILOGUE(3, args); +} + +int WRAPPER_NAME(daos_array_close)(daos_handle_t oh, daos_event_t *ev) { + RECORDER_INTERCEPTOR_PROLOGUE(int, daos_array_close, (oh, ev)); + char **args = assemble_args_list(2, itoa(oh.cookie), ptoa(ev)); + RECORDER_INTERCEPTOR_EPILOGUE(2, args); +} + + +/* ------------------------------------------------------------------ * + * Native DAOS API - Key-Value + * ------------------------------------------------------------------ */ + +int WRAPPER_NAME(daos_kv_open)(daos_handle_t coh, daos_obj_id_t oid, unsigned int mode, daos_handle_t *oh, daos_event_t *ev) { + RECORDER_INTERCEPTOR_PROLOGUE(int, daos_kv_open, (coh, oid, mode, oh, ev)); + char **args = assemble_args_list(6, itoa(coh.cookie), itoa(oid.hi), itoa(oid.lo), itoa(mode), + itoa((oh==NULL)?-1:oh->cookie), ptoa(ev)); + RECORDER_INTERCEPTOR_EPILOGUE(6, args); +} + +int WRAPPER_NAME(daos_kv_get)(daos_handle_t oh, daos_handle_t th, uint64_t flags, const char *key, daos_size_t *size, void *buf, daos_event_t *ev) { + RECORDER_INTERCEPTOR_PROLOGUE(int, daos_kv_get, (oh, th, flags, key, size, buf, ev)); + char **args = assemble_args_list(7, itoa(oh.cookie), itoa(th.cookie), itoa(flags), strtoa(key), + itoa((size==NULL)?-1:*size), ptoa(buf), ptoa(ev)); + RECORDER_INTERCEPTOR_EPILOGUE(7, args); +} + +int WRAPPER_NAME(daos_kv_put)(daos_handle_t oh, daos_handle_t th, uint64_t flags, const char *key, daos_size_t size, const void *buf, daos_event_t *ev) { + RECORDER_INTERCEPTOR_PROLOGUE(int, daos_kv_put, (oh, th, flags, key, size, buf, ev)); + char **args = assemble_args_list(7, itoa(oh.cookie), itoa(th.cookie), itoa(flags), strtoa(key), + itoa(size), ptoa(buf), ptoa(ev)); + RECORDER_INTERCEPTOR_EPILOGUE(7, args); +} + +int WRAPPER_NAME(daos_kv_remove)(daos_handle_t oh, daos_handle_t th, uint64_t flags, const char *key, daos_event_t *ev) { + RECORDER_INTERCEPTOR_PROLOGUE(int, daos_kv_remove, (oh, th, flags, key, ev)); + char **args = assemble_args_list(5, itoa(oh.cookie), itoa(th.cookie), itoa(flags), strtoa(key), ptoa(ev)); + RECORDER_INTERCEPTOR_EPILOGUE(5, args); +} + +int WRAPPER_NAME(daos_kv_list)(daos_handle_t oh, daos_handle_t th, uint32_t *nr, daos_key_desc_t *kds, d_sg_list_t *sgl, daos_anchor_t *anchor, daos_event_t *ev) { + RECORDER_INTERCEPTOR_PROLOGUE(int, daos_kv_list, (oh, th, nr, kds, sgl, anchor, ev)); + char **args = assemble_args_list(7, itoa(oh.cookie), itoa(th.cookie), itoa((nr==NULL)?-1:*nr), + ptoa(kds), ptoa(sgl), ptoa(anchor), ptoa(ev)); + RECORDER_INTERCEPTOR_EPILOGUE(7, args); +} + +int WRAPPER_NAME(daos_kv_destroy)(daos_handle_t oh, daos_handle_t th, daos_event_t *ev) { + RECORDER_INTERCEPTOR_PROLOGUE(int, daos_kv_destroy, (oh, th, ev)); + char **args = assemble_args_list(3, itoa(oh.cookie), itoa(th.cookie), ptoa(ev)); + RECORDER_INTERCEPTOR_EPILOGUE(3, args); +} + +int WRAPPER_NAME(daos_kv_close)(daos_handle_t oh, daos_event_t *ev) { + RECORDER_INTERCEPTOR_PROLOGUE(int, daos_kv_close, (oh, ev)); + char **args = assemble_args_list(2, itoa(oh.cookie), ptoa(ev)); + RECORDER_INTERCEPTOR_EPILOGUE(2, args); +} + +#endif /* RECORDER_WITH_DAOS */ diff --git a/lib/recorder-gotcha.c b/lib/recorder-gotcha.c index a9c65d1..1f30b7a 100644 --- a/lib/recorder-gotcha.c +++ b/lib/recorder-gotcha.c @@ -11,6 +11,11 @@ static bool hdf5_tracing = false; #endif static bool pnetcdf_tracing = true; static bool netcdf_tracing = true; +#ifdef RECORDER_WITH_DAOS +static bool daos_tracing = true; +#else +static bool daos_tracing = false; +#endif struct gotcha_binding_t posix_wrap_actions [] = { GOTCHA_WRAP_ACTION(creat), @@ -2173,17 +2178,78 @@ struct gotcha_binding_t netcdf_wrap_actions [] = { #endif /* RECORDER_WITH_NETCDF */ }; +#ifdef RECORDER_WITH_DAOS +struct gotcha_binding_t daos_wrap_actions [] = { + /* DFS API */ + GOTCHA_WRAP_ACTION(dfs_mount), + GOTCHA_WRAP_ACTION(dfs_umount), + GOTCHA_WRAP_ACTION(dfs_global2local), + GOTCHA_WRAP_ACTION(dfs_lookup), + GOTCHA_WRAP_ACTION(dfs_lookup_rel), + GOTCHA_WRAP_ACTION(dfs_open), + GOTCHA_WRAP_ACTION(dfs_dup), + GOTCHA_WRAP_ACTION(dfs_obj_global2local), + GOTCHA_WRAP_ACTION(dfs_release), + GOTCHA_WRAP_ACTION(dfs_read), + GOTCHA_WRAP_ACTION(dfs_readx), + GOTCHA_WRAP_ACTION(dfs_write), + GOTCHA_WRAP_ACTION(dfs_writex), + GOTCHA_WRAP_ACTION(dfs_get_size), + GOTCHA_WRAP_ACTION(dfs_punch), + GOTCHA_WRAP_ACTION(dfs_remove), + GOTCHA_WRAP_ACTION(dfs_ostat), + GOTCHA_WRAP_ACTION(dfs_osetattr), + /* Native DAOS API - Container */ + GOTCHA_WRAP_ACTION(daos_cont_open2), + GOTCHA_WRAP_ACTION(daos_cont_global2local), + GOTCHA_WRAP_ACTION(daos_cont_close), + /* Native DAOS API - Object */ + GOTCHA_WRAP_ACTION(daos_obj_open), + GOTCHA_WRAP_ACTION(daos_obj_fetch), + GOTCHA_WRAP_ACTION(daos_obj_update), + GOTCHA_WRAP_ACTION(daos_obj_punch), + GOTCHA_WRAP_ACTION(daos_obj_punch_dkeys), + GOTCHA_WRAP_ACTION(daos_obj_punch_akeys), + GOTCHA_WRAP_ACTION(daos_obj_list_dkey), + GOTCHA_WRAP_ACTION(daos_obj_list_akey), + GOTCHA_WRAP_ACTION(daos_obj_list_recx), + GOTCHA_WRAP_ACTION(daos_obj_close), + /* Native DAOS API - Array */ + GOTCHA_WRAP_ACTION(daos_array_create), + GOTCHA_WRAP_ACTION(daos_array_open), + GOTCHA_WRAP_ACTION(daos_array_open_with_attr), + GOTCHA_WRAP_ACTION(daos_array_read), + GOTCHA_WRAP_ACTION(daos_array_write), + GOTCHA_WRAP_ACTION(daos_array_get_size), + GOTCHA_WRAP_ACTION(daos_array_set_size), + GOTCHA_WRAP_ACTION(daos_array_stat), + GOTCHA_WRAP_ACTION(daos_array_punch), + GOTCHA_WRAP_ACTION(daos_array_destroy), + GOTCHA_WRAP_ACTION(daos_array_close), + /* Native DAOS API - Key-Value */ + GOTCHA_WRAP_ACTION(daos_kv_open), + GOTCHA_WRAP_ACTION(daos_kv_get), + GOTCHA_WRAP_ACTION(daos_kv_put), + GOTCHA_WRAP_ACTION(daos_kv_remove), + GOTCHA_WRAP_ACTION(daos_kv_list), + GOTCHA_WRAP_ACTION(daos_kv_destroy), + GOTCHA_WRAP_ACTION(daos_kv_close), +}; +#endif /* RECORDER_WITH_DAOS */ + void gotcha_register_functions() { char* posix_tracing_env = getenv(RECORDER_POSIX_TRACING); char* mpi_tracing_env = getenv(RECORDER_MPI_TRACING); char* mpiio_tracing_env = getenv(RECORDER_MPIIO_TRACING); char* pnetcdf_tracing_env = getenv(RECORDER_PNETCDF_TRACING); char* netcdf_tracing_env = getenv(RECORDER_NETCDF_TRACING); + char* daos_tracing_env = getenv(RECORDER_DAOS_TRACING); if (posix_tracing_env) posix_tracing = atoi(posix_tracing_env); if (mpi_tracing_env) mpi_tracing = atoi(mpi_tracing_env); if (mpiio_tracing_env) mpiio_tracing = atoi(mpiio_tracing_env); if (pnetcdf_tracing_env) pnetcdf_tracing = atoi(pnetcdf_tracing_env); if (netcdf_tracing_env) netcdf_tracing = atoi(netcdf_tracing_env); + if (daos_tracing_env) daos_tracing = atoi(daos_tracing_env); if (posix_tracing) gotcha_wrap(posix_wrap_actions, @@ -2213,6 +2279,12 @@ void gotcha_register_functions() { gotcha_wrap(netcdf_wrap_actions, sizeof(netcdf_wrap_actions)/sizeof(struct gotcha_binding_t), "recorder_netcdf_actions"); +#ifdef RECORDER_WITH_DAOS + if (daos_tracing) + gotcha_wrap(daos_wrap_actions, + sizeof(daos_wrap_actions)/sizeof(struct gotcha_binding_t), + "recorder_daos_actions"); +#endif } bool gotcha_posix_tracing() { @@ -2233,6 +2305,9 @@ bool gotcha_pnetcdf_tracing() { bool gotcha_netcdf_tracing() { return netcdf_tracing; } +bool gotcha_daos_tracing() { + return daos_tracing; +} void gotcha_init() { gotcha_register_functions(); diff --git a/lib/recorder-logger.c b/lib/recorder-logger.c index a86ae2b..ade64a0 100644 --- a/lib/recorder-logger.c +++ b/lib/recorder-logger.c @@ -344,6 +344,7 @@ void save_global_metadata() { .hdf5_tracing = gotcha_hdf5_tracing(), .pnetcdf_tracing = gotcha_pnetcdf_tracing(), .netcdf_tracing = gotcha_netcdf_tracing(), + .daos_tracing = gotcha_daos_tracing(), .store_tid = logger.store_tid, .store_call_depth = logger.store_call_depth, .start_ts = logger.start_ts, diff --git a/tools/reader.c b/tools/reader.c index e19fd11..269f266 100644 --- a/tools/reader.c +++ b/tools/reader.c @@ -185,6 +185,9 @@ static void index_func_list(RecorderReader* reader) { reader->pnetcdf_start_idx = i; if (reader->netcdf_start_idx == -1 && strstr(reader->func_list[i], "nc_")) reader->netcdf_start_idx = i; + if (reader->daos_start_idx == -1 && + (strstr(reader->func_list[i], "dfs_") || strstr(reader->func_list[i], "daos_"))) + reader->daos_start_idx = i; } } @@ -220,6 +223,7 @@ void read_metadata(RecorderReader* reader) { reader->metadata.hdf5_tracing = 1; reader->metadata.pnetcdf_tracing = 0; reader->metadata.netcdf_tracing = 0; + reader->metadata.daos_tracing = 0; reader->metadata.store_tid = 1; reader->metadata.store_call_depth = 1; reader->metadata.start_ts = metadata_2_3.start_ts; @@ -339,6 +343,7 @@ void recorder_init_reader(const char* logs_dir, RecorderReader *reader) { reader->mpi_start_idx = -1; reader->hdf5_start_idx = -1; reader->pnetcdf_start_idx = -1; + reader->daos_start_idx = -1; reader->netcdf_start_idx = -1; reader->prev_tstart = 0.0; @@ -502,7 +507,9 @@ int recorder_get_func_type(RecorderReader* reader, Record* record) { return RECORDER_PNETCDF; if(record->func_id == RECORDER_USER_FUNCTION) return RECORDER_FTRACE; - return RECORDER_NETCDF; + if(record->func_id < reader->daos_start_idx) + return RECORDER_NETCDF; + return RECORDER_DAOS; } void recorder_free_record(Record* r) { diff --git a/tools/reader.h b/tools/reader.h index 9fd5f48..bf09cee 100644 --- a/tools/reader.h +++ b/tools/reader.h @@ -43,6 +43,7 @@ typedef struct RecorderReader_t { int hdf5_start_idx; int pnetcdf_start_idx; int netcdf_start_idx; + int daos_start_idx; double prev_tstart; @@ -130,6 +131,9 @@ const char* recorder_get_func_name(RecorderReader* reader, Record* record); * - RECORDER_MPIIO * - RECORDER_MPI * - RECORDER_HDF5 + * - RECORDER_PNETCDF + * - RECORDER_NETCDF + * - RECORDER_DAOS * - RECORDER_FTRACE */ int recorder_get_func_type(RecorderReader* reader, Record* record); diff --git a/tools/recorder-summary.c b/tools/recorder-summary.c index 390dcb7..9d940b5 100644 --- a/tools/recorder-summary.c +++ b/tools/recorder-summary.c @@ -41,7 +41,7 @@ void print_statistics(RecorderReader* reader, CST* cst) { memset(call_count, 0, sizeof(int)*reader->supported_funcs); int mpi_count = 0, mpiio_count = 0, netcdf_count = 0; - int pnetcdf_count = 0, hdf5_count = 0, posix_count = 0; + int pnetcdf_count = 0, hdf5_count = 0, posix_count = 0, daos_count = 0; for(int i = 0; i < cst->entries; i++) { Record* record = reader_cs_to_record(&cst->cs_list[i]); @@ -60,15 +60,17 @@ void print_statistics(RecorderReader* reader, CST* cst) { netcdf_count += cst->cs_list[i].count; if(type == RECORDER_POSIX) posix_count += cst->cs_list[i].count; + if(type == RECORDER_DAOS) + daos_count += cst->cs_list[i].count; unique_signature[record->func_id]++; call_count[record->func_id] += cst->cs_list[i].count; recorder_free_record(record); } - long int total = posix_count + mpi_count + mpiio_count + hdf5_count + pnetcdf_count; - printf("Total: %ld\nPOSIX: %d\nMPI: %d\nMPI-IO: %d\nHDF5: %d\nPnetCDF: %d\nNetCDF: %d\n", - total, posix_count, mpi_count, mpiio_count, hdf5_count, pnetcdf_count, netcdf_count); + long int total = posix_count + mpi_count + mpiio_count + hdf5_count + pnetcdf_count + netcdf_count + daos_count; + printf("Total: %ld\nPOSIX: %d\nMPI: %d\nMPI-IO: %d\nHDF5: %d\nPnetCDF: %d\nNetCDF: %d\nDAOS: %d\n", + total, posix_count, mpi_count, mpiio_count, hdf5_count, pnetcdf_count, netcdf_count, daos_count); printf("\n%-25s %18s %18s\n", "Func", "Unique Signature", "Total Call Count"); for(int i = 0; i < reader->supported_funcs; i++) { @@ -98,6 +100,7 @@ void print_metadata(RecorderReader* reader) { printf("HDF5 tracing: %s\n", meta->hdf5_tracing?"Enabled":"Disabled"); printf("PnetCDF tracing: %s\n", meta->pnetcdf_tracing?"Enabled":"Disabled"); printf("NetCDF tracing: %s\n", meta->netcdf_tracing?"Enabled":"Disabled"); + printf("DAOS tracing: %s\n", meta->daos_tracing?"Enabled":"Disabled"); printf("Store thread id: %s\n", meta->store_tid?"True":"False"); printf("Store call depth: %s\n", meta->store_call_depth?"True":"False"); printf("Timestamp compression: %s\n", meta->ts_compression?"True":"False"); diff --git a/tools/recorder2timeline.cpp b/tools/recorder2timeline.cpp index 0cc7757..02296d3 100644 --- a/tools/recorder2timeline.cpp +++ b/tools/recorder2timeline.cpp @@ -30,6 +30,12 @@ static const char* type_name(int type) { return "MPI"; case RECORDER_HDF5: return "HDF5"; + case RECORDER_PNETCDF: + return "PnetCDF"; + case RECORDER_NETCDF: + return "NetCDF"; + case RECORDER_DAOS: + return "DAOS"; case RECORDER_FTRACE: return "USER"; default: @@ -59,7 +65,8 @@ operator<<( std::ostream& out, void write_to_json(Record *record, void* arg) { int cat = recorder_get_func_type(&reader, record); - if (record->call_depth == 0 || (cat == 0 || cat == 1 || cat == 3)) { + // posix, mpiio, hdf5, pnetcdf, netcdf, daos + if (record->call_depth == 0 || (cat == 0 || cat == 1 || cat == 3 || cat == 5 || cat == 6 || cat == 7)) { Writer *writer = (Writer *) arg; bool user_func = (record->func_id == RECORDER_USER_FUNCTION); const char *func_name = recorder_get_func_name(&reader, record);