/usr/include/code_saturne/cs_timer.h is in code-saturne-include 3.2.1-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | #ifndef __CS_TIMER_H__
#define __CS_TIMER_H__
/*============================================================================
* Program timing information
*============================================================================*/
/*
This file is part of Code_Saturne, a general-purpose CFD tool.
Copyright (C) 1998-2013 EDF S.A.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/*----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
* Local headers
*----------------------------------------------------------------------------*/
#include "cs_defs.h"
/*----------------------------------------------------------------------------*/
BEGIN_C_DECLS
/*============================================================================
* Public types
*============================================================================*/
/* Information structure for precise timings */
typedef struct {
long long wall_sec; /* wall-time seconds */
long long wall_nsec; /* wall-time nanoseconds */
long long cpu_sec; /* CPU time seconds */
long long cpu_nsec; /* CPU time nanoseconds */
} cs_timer_t;
/* Information structure for timing counters */
typedef struct {
long long wall_nsec; /* wall-time nanoseconds */
long long cpu_nsec; /* CPU time nanoseconds */
} cs_timer_counter_t;
/*============================================================================
* Public macros
*============================================================================*/
/*----------------------------------------------------------------------------
* Initialize timer counter.
*
* parameters:
* _t --> resulting counter.
*----------------------------------------------------------------------------*/
#define CS_TIMER_COUNTER_INIT(_t) \
(_t.wall_nsec = 0, \
_t.cpu_nsec = 0)
/*----------------------------------------------------------------------------
* Add timer counter.
*
* The result may be identical to one of the 2 counters to add.
*
* parameters:
* _res --> resulting counter.
* _c0 <-- counter to add.
* _c1 <-- counter to add.
*----------------------------------------------------------------------------*/
#define CS_TIMER_COUNTER_ADD(_res, _c0, _c1) \
(_res.wall_nsec = _c0.wall_nsec + _c1.wall_nsec, \
_res.cpu_nsec = _c0.cpu_nsec + _c1.cpu_nsec)
/*============================================================================
* Public function prototypes
*============================================================================*/
/*----------------------------------------------------------------------------
* Return Wall clock time
*
* returns:
* elapsed time from first call of a function of the cs_timer_...()
* series, or -1 if unable to compute.
*----------------------------------------------------------------------------*/
double
cs_timer_wtime(void);
/*----------------------------------------------------------------------------
* Return CPU time.
*
* Note that in the rare case that only the minimal C library clock()
* method is available (see cs_timer_cpu_time_method()), at least one of
* the cs_timer_...() functions (possibly this one) must be called
* upon program start for this function to be used. In addition,
* in this case, time may "loop" back to 0 every multiple of
* 2^size_t / CLOCKS_PER_SEC seconds.
*
* returns:
* current CPU time usage, or -1 if unable to compute.
*----------------------------------------------------------------------------*/
double
cs_timer_cpu_time(void);
/*----------------------------------------------------------------------------
* Return separate user and system CPU times.
*
* parameters:
* user_time --> current user CPU usage.
* system_time --> current system CPU usage.
*----------------------------------------------------------------------------*/
void
cs_timer_cpu_times(double *user_time,
double *system_time);
/*----------------------------------------------------------------------------
* Return a timer's value
*
* returns:
* timer structure.
*----------------------------------------------------------------------------*/
cs_timer_t
cs_timer_time(void);
/*----------------------------------------------------------------------------
* Compute the difference between 2 timers.
*
* parameters:
* t0 <-- oldest timer value
* t1 <-- most recent timer value
*
* returns:
* last - first timer value.
*----------------------------------------------------------------------------*/
cs_timer_counter_t
cs_timer_diff(const cs_timer_t *t0,
const cs_timer_t *t1);
/*----------------------------------------------------------------------------
* Add the the difference between 2 timers to a counter.
*
* parameters:
* tc <-> pointer to timer counter
* t0 <-- oldest timer value
* t1 <-- most recent timer value
*
* returns:
* last - first timer value.
*----------------------------------------------------------------------------*/
void
cs_timer_counter_add_diff(cs_timer_counter_t *tc,
const cs_timer_t *t0,
const cs_timer_t *t1);
/*----------------------------------------------------------------------------
* Return method used to return wall clock time.
*
* Note that in the rare case that only the minimal C library clock()
* method is available, this function will return -1 values.
*
* returns:
* short description of method used to return wall clock time.
*----------------------------------------------------------------------------*/
const char *
cs_timer_wtime_method(void);
/*----------------------------------------------------------------------------
* Return method used to return CPU time.
*
* returns:
* short description of method used to return CPU time.
*----------------------------------------------------------------------------*/
const char *
cs_timer_cpu_time_method(void);
/*----------------------------------------------------------------------------*/
END_C_DECLS
#endif /* __CS_TIMER_H__ */
|