Ifpack Package Browser (Single Doxygen Collection)
Development
Toggle main menu visibility
Loading...
Searching...
No Matches
src
euclid
Timer_dh.h
Go to the documentation of this file.
1
/*@HEADER
2
// ***********************************************************************
3
//
4
// Ifpack: Object-Oriented Algebraic Preconditioner Package
5
// Copyright (2002) Sandia Corporation
6
//
7
// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8
// license for use of this work by or on behalf of the U.S. Government.
9
//
10
// Redistribution and use in source and binary forms, with or without
11
// modification, are permitted provided that the following conditions are
12
// met:
13
//
14
// 1. Redistributions of source code must retain the above copyright
15
// notice, this list of conditions and the following disclaimer.
16
//
17
// 2. Redistributions in binary form must reproduce the above copyright
18
// notice, this list of conditions and the following disclaimer in the
19
// documentation and/or other materials provided with the distribution.
20
//
21
// 3. Neither the name of the Corporation nor the names of the
22
// contributors may be used to endorse or promote products derived from
23
// this software without specific prior written permission.
24
//
25
// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36
//
37
// Questions? Contact Michael A. Heroux (maherou@sandia.gov)
38
//
39
// ***********************************************************************
40
//@HEADER
41
*/
42
43
#ifndef TIMER_DH_H
44
#define TIMER_DH_H
45
46
#include "
euclid_common.h
"
47
48
/*--------------------------------------------------------------*/
49
/* Stuff in this block isn't really needed for multi-processor
50
* runs, since recording CPU time probably isn't useful.
51
* if EUCLID_TIMING is defined in $PCPACK_DIR/bmake_XXX/common,
52
* the times() function is used;
53
* then MPI_Wtime() is used in preference to times().
54
*
55
* You may need to fiddle with some of these includes, depending
56
* on your system. Make sure and check the logFile to ensure
57
* that CLK_TCK was properly defined. See Timer_dhCreate()
58
* for additional details.
59
*
60
* if "JUNK_TIMING" is defined during compilation, timing functions
61
* either do nothing, or return -1.0; this is primarily for debugging.
62
*/
63
64
#ifdef EUCLID_TIMING
65
#include <sys/times.h>
66
#include <sys/types.h>
67
#if HAVE_UNISTD_H
68
# include <unistd.h>
69
#endif
/* HAVE_UNISTD_H */
70
71
#elif !defined(JUNK_TIMING)
72
/* #include <sys/types.h>
73
#include <sys/sysconfig.h>
74
*/
75
#ifdef WIN32
76
# include <time.h>
77
#endif
78
#if HAVE_UNISTD_H
79
# include <unistd.h>
/* needed for sysconf(_SC_CLK_TCK) */
80
#endif
/* HAVE_UNISTD_H */
81
#endif
82
83
84
/*
85
??? may be needed for some compilers/platforms?
86
#include <limits.h>
87
#include <time.h>
88
#include <sys/resource.h>
89
*/
90
91
/*--------------------------------------------------------------*/
92
93
#ifdef __cplusplus
94
extern
"C"
95
{
96
#endif
97
98
struct
_timer_dh
99
{
100
bool
isRunning
;
101
long
int
sc_clk_tck
;
102
double
begin_wall
;
103
double
end_wall
;
104
105
#ifdef EUCLID_TIMING
106
struct
tms begin_cpu;
107
struct
tms end_cpu;
108
#endif
109
110
};
111
112
extern
void
Timer_dhCreate
(
Timer_dh
* t);
113
extern
void
Timer_dhDestroy
(
Timer_dh
t);
114
extern
void
Timer_dhStart
(
Timer_dh
t);
115
extern
void
Timer_dhStop
(
Timer_dh
t);
116
extern
double
Timer_dhReadCPU
(
Timer_dh
t);
117
extern
double
Timer_dhReadWall
(
Timer_dh
t);
118
extern
double
Timer_dhReadUsage
(
Timer_dh
t);
119
120
/* notes:
121
(1) unless compiled with EUCLID_TIMING defined, readCPU
122
and readUseage return -1.0.
123
(2) whenever start() is called, the timer is reset; you
124
don't need to call stop() first.
125
(3) if stop() HAS been called, the readXX functions return
126
timings between start() and stop(); , if start()
127
was called but not stop(), they sample the time then
128
return; if start() was never called, they return junk.
129
*/
130
131
#ifdef __cplusplus
132
}
133
#endif
134
135
#endif
Timer_dhCreate
void Timer_dhCreate(Timer_dh *t)
Definition
Timer_dh.c:49
Timer_dhStop
void Timer_dhStop(Timer_dh t)
Definition
Timer_dh.c:217
Timer_dhReadCPU
double Timer_dhReadCPU(Timer_dh t)
Definition
Timer_dh.c:231
Timer_dhReadWall
double Timer_dhReadWall(Timer_dh t)
Definition
Timer_dh.c:224
Timer_dhStart
void Timer_dhStart(Timer_dh t)
Definition
Timer_dh.c:210
Timer_dhReadUsage
double Timer_dhReadUsage(Timer_dh t)
Definition
Timer_dh.c:238
Timer_dhDestroy
void Timer_dhDestroy(Timer_dh t)
Definition
Timer_dh.c:80
euclid_common.h
Timer_dh
struct _timer_dh * Timer_dh
Definition
euclid_common.h:81
_timer_dh
Definition
Timer_dh.h:99
_timer_dh::begin_wall
double begin_wall
Definition
Timer_dh.h:102
_timer_dh::end_wall
double end_wall
Definition
Timer_dh.h:103
_timer_dh::isRunning
bool isRunning
Definition
Timer_dh.h:100
_timer_dh::sc_clk_tck
long int sc_clk_tck
Definition
Timer_dh.h:101
Generated by
1.17.0