1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 * Copyright by The HDF Group. * 3 * Copyright by the Board of Trustees of the University of Illinois. * 4 * All rights reserved. * 5 * * 6 * This file is part of HDF5. The full HDF5 copyright notice, including * 7 * terms governing use, modification, and redistribution, is contained in * 8 * the COPYING file, which can be found at the root of the source code * 9 * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * 10 * If you do not have access to either file, you may request a copy from * 11 * help@hdfgroup.org. * 12 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 13 14 #ifndef IO_TIMER__ 15 #define IO_TIMER__ 16 17 #include "hdf5.h" 18 19 #if defined(H5_TIME_WITH_SYS_TIME) 20 # include <sys/time.h> 21 # include <time.h> 22 #elif defined(H5_HAVE_SYS_TIME_H) 23 # include <sys/time.h> 24 #else 25 # include <time.h> 26 #endif 27 28 #ifdef H5_HAVE_WINSOCK2_H 29 # include <winsock2.h> 30 #endif /* H5_HAVE_WINSOCK2_H */ 31 /* The different types of timers we can have */ 32 typedef enum timer_type_ { 33 HDF5_FILE_OPENCLOSE, 34 HDF5_DATASET_CREATE, 35 HDF5_MPI_WRITE, 36 HDF5_MPI_READ, 37 HDF5_FILE_READ_OPEN, 38 HDF5_FILE_READ_CLOSE, 39 HDF5_FILE_WRITE_OPEN, 40 HDF5_FILE_WRITE_CLOSE, 41 HDF5_FINE_WRITE_FIXED_DIMS, 42 HDF5_FINE_READ_FIXED_DIMS, 43 HDF5_GROSS_WRITE_FIXED_DIMS, 44 HDF5_GROSS_READ_FIXED_DIMS, 45 HDF5_RAW_WRITE_FIXED_DIMS, 46 HDF5_RAW_READ_FIXED_DIMS, 47 NUM_TIMERS 48 } timer_type; 49 50 typedef enum clock_type_ { 51 SYS_CLOCK = 0, /* Use system clock to measure time */ 52 MPI_CLOCK = 1 /* Use MPI clock to measure time */ 53 } clock_type; 54 55 /* Miscellaneous identifiers */ 56 enum { 57 TSTART, /* Start a specified timer */ 58 TSTOP /* Stop a specified timer */ 59 }; 60 61 /* The performance time structure */ 62 typedef struct io_time_t { 63 clock_type type; 64 double total_time[NUM_TIMERS]; 65 double mpi_timer[NUM_TIMERS]; 66 struct timeval sys_timer[NUM_TIMERS]; 67 } io_time_t; 68 69 /* External function declarations */ 70 #ifdef __cplusplus 71 extern "C" { 72 #endif /* __cplusplus */ 73 H5TOOLS_DLL io_time_t *io_time_new(clock_type t); 74 H5TOOLS_DLL void io_time_destroy(io_time_t *pt); 75 H5TOOLS_DLL io_time_t *set_time(io_time_t *pt, timer_type t, int start_stop); 76 H5TOOLS_DLL double get_time(io_time_t *pt, timer_type t); 77 #ifdef __cplusplus 78 } 79 #endif /* __cplusplus */ 80 81 #endif /* IO_TIMER__ */ 82