| 1 |
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
| 2 |
// vi: set et ts=4 sw=2 sts=2: |
| 3 |
// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root |
| 4 |
// SPDX-License-Identifier: LGPL-2.1-or-later |
| 5 |
/****************************************************************************/ |
| 6 |
/* */ |
| 7 |
/* File: stat.h */ |
| 8 |
/* */ |
| 9 |
/* Purpose: DDD statistical evaluation, header file */ |
| 10 |
/* */ |
| 11 |
/* Author: Klaus Birken */ |
| 12 |
/* Rechenzentrum Uni Stuttgart */ |
| 13 |
/* Universitaet Stuttgart */ |
| 14 |
/* Allmandring 30 */ |
| 15 |
/* 70550 Stuttgart */ |
| 16 |
/* internet: [email protected] */ |
| 17 |
/* */ |
| 18 |
/* */ |
| 19 |
/* History: 95/01/16 kb begin */ |
| 20 |
/* */ |
| 21 |
/* Remarks: */ |
| 22 |
/* */ |
| 23 |
/****************************************************************************/ |
| 24 |
|
| 25 |
/****************************************************************************/ |
| 26 |
/* */ |
| 27 |
/* auto include mechanism and other include files */ |
| 28 |
/* */ |
| 29 |
/****************************************************************************/ |
| 30 |
|
| 31 |
#ifndef __DDD_STAT_H__ |
| 32 |
#define __DDD_STAT_H__ |
| 33 |
|
| 34 |
|
| 35 |
#include <dune/uggrid/parallel/ddd/include/dddaddon.h> |
| 36 |
|
| 37 |
START_UGDIM_NAMESPACE |
| 38 |
|
| 39 |
/****************************************************************************/ |
| 40 |
/* */ |
| 41 |
/* compile time constants defining array sizes */ |
| 42 |
/* */ |
| 43 |
/****************************************************************************/ |
| 44 |
|
| 45 |
#define STAT_NTIME 64 |
| 46 |
#define STAT_NITEM 64 |
| 47 |
|
| 48 |
|
| 49 |
/****************************************************************************/ |
| 50 |
/* */ |
| 51 |
/* data structures exported by the corresponding source file */ |
| 52 |
/* */ |
| 53 |
/****************************************************************************/ |
| 54 |
|
| 55 |
|
| 56 |
/****************************************************************************/ |
| 57 |
/* STATISTICS: global record for statistical data */ |
| 58 |
/****************************************************************************/ |
| 59 |
|
| 60 |
struct STAT_DATA |
| 61 |
{ |
| 62 |
/* current DDD module */ |
| 63 |
int curr_module; |
| 64 |
|
| 65 |
/* temporary starttime timer 1-4 */ |
| 66 |
double starttime[DDD_MODULES][4]; |
| 67 |
|
| 68 |
/* miscellaneous time measurements */ |
| 69 |
double durations[DDD_MODULES][STAT_NTIME]; |
| 70 |
|
| 71 |
/* miscellaneous count measurements */ |
| 72 |
long items[DDD_MODULES][STAT_NITEM]; |
| 73 |
}; |
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
/****************************************************************************/ |
| 79 |
/* */ |
| 80 |
/* definition of exported global variables */ |
| 81 |
/* */ |
| 82 |
/****************************************************************************/ |
| 83 |
|
| 84 |
/* from stat.c |
| 85 |
statistical data (compile with option -DStatistics) */ |
| 86 |
|
| 87 |
#ifdef Statistics |
| 88 |
extern STAT_DATA stat_data; |
| 89 |
#endif |
| 90 |
|
| 91 |
|
| 92 |
/****************************************************************************/ |
| 93 |
/* */ |
| 94 |
/* macros */ |
| 95 |
/* */ |
| 96 |
/****************************************************************************/ |
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
#ifdef Statistics |
| 101 |
|
| 102 |
/*** macros for "DDD with statistic evaluation" ***/ |
| 103 |
|
| 104 |
# define STAT_SET_MODULE(m) stat_data.curr_module = (m) |
| 105 |
# define STAT_GET_MODULE(m) (m) = stat_data.curr_module |
| 106 |
|
| 107 |
# define STAT_RESETX(n) \ |
| 108 |
stat_data.starttime[stat_data.curr_module][(n)] = CURRENT_TIME |
| 109 |
# define STAT_RESET STAT_RESETX(0) |
| 110 |
# define STAT_RESET1 STAT_RESETX(0) |
| 111 |
# define STAT_RESET2 STAT_RESETX(1) |
| 112 |
# define STAT_RESET3 STAT_RESETX(2) |
| 113 |
# define STAT_RESET4 STAT_RESETX(3) |
| 114 |
|
| 115 |
# define STAT_TIMERX(n,d) \ |
| 116 |
stat_data.durations[stat_data.curr_module][(d)] = \ |
| 117 |
CURRENT_TIME-stat_data.starttime[stat_data.curr_module][(n)] |
| 118 |
# define STAT_TIMER(d) STAT_TIMERX(0,d) |
| 119 |
# define STAT_TIMER1(d) STAT_TIMERX(0,d) |
| 120 |
# define STAT_TIMER2(d) STAT_TIMERX(1,d) |
| 121 |
# define STAT_TIMER3(d) STAT_TIMERX(2,d) |
| 122 |
# define STAT_TIMER4(d) STAT_TIMERX(3,d) |
| 123 |
|
| 124 |
# define STAT_INCTIMERX(n,d) \ |
| 125 |
stat_data.durations[stat_data.curr_module][(d)] += \ |
| 126 |
CURRENT_TIME-stat_data.starttime[stat_data.curr_module][(n)] |
| 127 |
# define STAT_INCTIMER(d) STAT_INCTIMERX(0,d) |
| 128 |
# define STAT_INCTIMER1(d) STAT_INCTIMERX(0,d) |
| 129 |
# define STAT_INCTIMER2(d) STAT_INCTIMERX(1,d) |
| 130 |
# define STAT_INCTIMER3(d) STAT_INCTIMERX(2,d) |
| 131 |
# define STAT_INCTIMER4(d) STAT_INCTIMERX(3,d) |
| 132 |
|
| 133 |
# define STAT_SETTIMER(d,v) \ |
| 134 |
stat_data.durations[stat_data.curr_module][(d)] = (v) |
| 135 |
# define STAT_GETTIMER(d) \ |
| 136 |
stat_data.durations[stat_data.curr_module][(d)] |
| 137 |
|
| 138 |
|
| 139 |
# define STAT_SETCOUNT(d,v) \ |
| 140 |
stat_data.items[stat_data.curr_module][(d)] = (v) |
| 141 |
# define STAT_GETCOUNT(d) \ |
| 142 |
stat_data.items[stat_data.curr_module][(d)] |
| 143 |
|
| 144 |
|
| 145 |
# define STAT_ZEROTIMER { int i; for (i=0; i<STAT_NTIME; i++) \ |
| 146 |
STAT_SETTIMER(i,0.0);} |
| 147 |
# define STAT_ZEROCOUNT { int i; for (i=0; i<STAT_NITEM; i++) \ |
| 148 |
STAT_SETCOUNT(i,0);} |
| 149 |
# define STAT_ZEROALL STAT_ZEROTIMER; STAT_ZEROCOUNT |
| 150 |
|
| 151 |
|
| 152 |
#else |
| 153 |
|
| 154 |
/*** macros for "DDD without statistic evaluation" ***/ |
| 155 |
|
| 156 |
# define STAT_SET_MODULE(m) |
| 157 |
# define STAT_GET_MODULE(m) |
| 158 |
|
| 159 |
# define STAT_RESET |
| 160 |
# define STAT_RESET0 |
| 161 |
# define STAT_RESET1 |
| 162 |
# define STAT_RESET2 |
| 163 |
# define STAT_RESET3 |
| 164 |
# define STAT_RESET4 |
| 165 |
|
| 166 |
# define STAT_TIMER(d) |
| 167 |
# define STAT_TIMER1(d) |
| 168 |
# define STAT_TIMER2(d) |
| 169 |
# define STAT_TIMER3(d) |
| 170 |
# define STAT_TIMER4(d) |
| 171 |
|
| 172 |
# define STAT_INCTIMER(d) |
| 173 |
# define STAT_INCTIMER1(d) |
| 174 |
# define STAT_INCTIMER2(d) |
| 175 |
# define STAT_INCTIMER3(d) |
| 176 |
# define STAT_INCTIMER4(d) |
| 177 |
|
| 178 |
# define STAT_INCTIMER(d) |
| 179 |
# define STAT_SETTIMER(d,v) |
| 180 |
# define STAT_GETTIMER(d) 0.0 |
| 181 |
# define STAT_SETCOUNT(d,v) |
| 182 |
# define STAT_GETCOUNT(d) 0 |
| 183 |
|
| 184 |
# define STAT_ZEROTIMER |
| 185 |
# define STAT_ZEROCOUNT |
| 186 |
# define STAT_ZEROALL |
| 187 |
|
| 188 |
#endif |
| 189 |
|
| 190 |
END_UGDIM_NAMESPACE |
| 191 |
|
| 192 |
#endif |