mmgs
chrono.h
Go to the documentation of this file.
1 /* =============================================================================
2 ** This file is part of the mmg software package for the tetrahedral
3 ** mesh modification.
4 ** Copyright (c) Bx INP/CNRS/Inria/UBordeaux/UPMC, 2004-
5 **
6 ** mmg is free software: you can redistribute it and/or modify it
7 ** under the terms of the GNU Lesser General Public License as published
8 ** by the Free Software Foundation, either version 3 of the License, or
9 ** (at your option) any later version.
10 **
11 ** mmg is distributed in the hope that it will be useful, but WITHOUT
12 ** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 ** FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 ** License for more details.
15 **
16 ** You should have received a copy of the GNU Lesser General Public
17 ** License and of the GNU General Public License along with mmg (in
18 ** files COPYING.LESSER and COPYING). If not, see
19 ** <http://www.gnu.org/licenses/>. Please read their terms carefully and
20 ** use this copy of the mmg distribution only if you accept them.
21 ** =============================================================================
22 */
23 
24 #ifndef CHRONO_H
25 #define CHRONO_H
26 
27 #include <time.h>
28 #include "mmgcommon.h"
29 
30 #ifndef POSIX
31 #include <windows.h>
32 #else
33 #include <sys/time.h>
34 #include <sys/resource.h>
35 #endif
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
41 #ifndef ON
42 #define RESET 0
43 #define ON 1
44 #define OFF 2
45 #endif
46 
47 #define BIG 1e6
48 #define BIG1 1e-6
49 #define TIMEMAX 12
50 
58 typedef struct mytime {
60 #ifdef POSIX
61  struct timeval rutim;
62  struct rusage ru;
63 #else
64  HANDLE thisProcess;
65  FILETIME ftIni, ftEnd, ftSys, ftUser;
66  SYSTEMTIME stSys, stUser;
67  LARGE_INTEGER frequency;
68  LARGE_INTEGER rutim;
69 #endif
70  int call;
71 } mytime;
72 
73 
74 /* prototypes */
75 void chrono(int cmode,mytime *ptt);
76 void tminit(mytime *t,int maxtim);
77 void printim(double ,char *);
78 
79 #ifdef __cplusplus
80 }
81 #endif
82 
83 #endif
double gdif
Definition: chrono.h:59
Chrono object.
Definition: chrono.h:58
double uend
Definition: chrono.h:59
int call
Definition: chrono.h:70
void tminit(mytime *t, int maxtim)
Initialize mytime object.
Definition: chrono.c:120
double send
Definition: chrono.h:59
double sdif
Definition: chrono.h:59
double udif
Definition: chrono.h:59
void chrono(int cmode, mytime *ptt)
Function to measure time.
Definition: chrono.c:49
double gini
Definition: chrono.h:59
double uini
Definition: chrono.h:59
double gend
Definition: chrono.h:59
struct timeval rutim
Definition: chrono.h:61
struct mytime mytime
void printim(double, char *)
Print real time.
Definition: chrono.c:149
double sini
Definition: chrono.h:59
struct rusage ru
Definition: chrono.h:62