This file is indexed.

/usr/include/givaro/givtimer.h is in libgivaro-dev 3.7.2-1.

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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
/* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
/* kernel/system/givtimer.h
 * Copyright (C) 1994-1997 Givaro Team
 *
 * Written by T. Gautier
 *
 * ------------------------------------
 * Modified by Bradford Hovinen <hovinen@cis.udel.edu>
 *
 * Added _start_t member to BaseTimer, so that stop () does not clobber the
 * class' memory of its start time. This allows it to be called repeatedly to
 * get elapsed times.
 * ------------------------------------
 *
 * See COPYING for license information.
 *
 */

/** @file givtimer.h
 * @ingroup system
 * @brief timer
 */

#ifndef __GIVARO_timer_H
#define __GIVARO_timer_H

#include <iostream>
#include <givaro/givconfig.h>
namespace Givaro {
// class BaseTimer; class RealTimer; class SysTimer; class UserTimer;

/** \brief base for class RealTimer; class SysTimer; class UserTimer;
  \ingroup util
  */
class BaseTimer {
public:
	enum {
		MSPSEC = 1000000  // microsecond per second
	};

	BaseTimer() : _start_t(0.), _t(0.) {}

	// -- Clear timer :
	inline void clear()
	{
		_t = 0.0;
	}

	// -- total amount of second spent
	inline double time() const
	{
		return _t;
	}

	// -- Return a value to initialize random generator
	static long seed();

	// -- basic methods:
	std::ostream& print( std::ostream& ) const;

	// -- Some arithmetic operators to compute cumulative time :
	BaseTimer& operator = (const BaseTimer & T) ;
	const BaseTimer operator - (const BaseTimer & T)  const;
	const BaseTimer operator - () ;
	const BaseTimer operator +  (const BaseTimer & T)  const;
	BaseTimer& operator += (const BaseTimer & T) { return *this = *this + T; };
	BaseTimer& operator -= (const BaseTimer & T) { return *this = *this - T; };
	public:
	double _start_t;  // time as of start ()
	double _t;        // time
};

//! I/O
inline std::ostream& operator<< (std::ostream& o, const BaseTimer& BT)
{
	return BT.print(o);
}

//! Real timer
class RealTimer : public BaseTimer {
public:
	inline RealTimer( const BaseTimer& BT ): BaseTimer(BT) {};
	inline RealTimer(){};
	void start();
	void stop();
	inline double elapsed()
	{
		stop();
		return _t ; // time()
	}

};


//! User timer
class UserTimer : public BaseTimer {
public:
	inline UserTimer( const BaseTimer& BT ) : BaseTimer(BT) {};
	inline UserTimer() {};
	void start();
	void stop();
	inline double elapsed()
	{
		stop();
		return _t ; // time()
	}

};

//! Sys timer
class SysTimer : public BaseTimer {
public:
	inline SysTimer( const BaseTimer& BT ): BaseTimer(BT) {};
	inline SysTimer() {};
	void start();
	void stop();
	inline double elapsed()
	{
		stop();
		return _t ; // time()
	}

};


//! Timer
class Timer {
public :

	Timer() : _count(0)
	{
		rt.clear();
		ut.clear();
		st.clear();
	}

	/*! Clear timer.
	 * Everything reset to 0. This need not be called before the first
	 * start since the constructor does it.
	 */
	void clear();

	/*! Start timer.
	 * Starts the timer.
	 * If called after  another \c start() or a \c stop(), it sets the timer
	 * to a totally fresh new start.
	 */
	void start();

	/*! Stop timer.
	 * Stops the timer. The time since the previous \c start() is stored.
	 * If called again, \c stop() will store the time since the previous \c
	 * start() again, acting as a \c pause().
	 * @pre \c start() should have been called before...
	 */
	void stop();

	/*! total amount of second spent in user mode.
	 * @return the user time elapsed between the latest \c start() and the
	 * latest \c stop().
	 * @pre \c stop() is called before.
	 */
	double usertime() const { return ut.time(); }

	/*! total amount of second spent in system mode.
	 * @return the system time elapsed between the latest \c start() and
	 * the latest \c stop().
	 * @pre \c stop() is called before.
	 */
	double systime () const { return st.time(); }

	/*! real total amount of second spent.
	 * @return the real total time elapsed between the latest \c start()
	 * and the latest \c stop().
	 * @pre \c stop() is called before.
	 */
	double realtime () const { return rt.time(); }

	/*! User mode time spent since start.
	 * A call to \c stop() is useless.
	 * @return elpased time (in seconds) since \c start() in user mode.
	 */
	double userElapsedTime()  { return ut.elapsed(); }

	/*! System mode time spent since start.
	 * A call to \c stop() is useless.
	 * @return elpased time (in seconds) since \c start() in system mode.
	 */
	double sysElapsedTime ()  { return st.elapsed(); }

	/*! real total amount of second spent since start.
	 * A call to \c stop() is useless.
	 * @return elpased time (in seconds) since \c start().
	 */
	double realElapsedTime () { return rt.elapsed(); }


	// retourne une petite graine
	// long seed() const { return RealTimer::seed(); }

	// Some arithmetic operators to compute cumulative time :
	Timer& operator = (const Timer & T) ;
	const Timer operator - (const Timer & T)  const;
	const Timer operator - () ;
	const Timer operator + (const Timer & T)  const;
	Timer& operator += (const Timer & T) { return *this = *this + T; };
	Timer& operator -= (const Timer & T) { return *this = *this - T; };


	// -- methods :
	std::ostream& print( std::ostream& ) const;

	size_t count() const
	{
		return _count;
	}

private:
	size_t _count; // how many
	RealTimer rt;
	UserTimer ut;
	SysTimer  st;
};

//! I/O
inline std::ostream &operator << (std::ostream &o, const Timer &T)
{
	double ut = T.usertime();
	if (ut < 0.0000000001) ut = 0;
	return o << T.realtime() << "s (" << ut << " cpu) [" << T.count() << "]";
}
}

#ifdef GIVARO_USES_OMP
#include <omp.h>

namespace Givaro {
//! OMP timer
struct OMPTimer {
	double _c;
	void start() { _c = omp_get_wtime(); }
	void stop() { _c = omp_get_wtime() - _c; }
	void clear() { _c = 0.0; }
	double realtime() { return _c; }
	double usertime() { return _c; }
	double time() const { return _c; }
	friend std::ostream& operator<<(std::ostream& o, const OMPTimer& t) {
		return o << t._c << 's';
	}

	OMPTimer& operator =(const OMPTimer& t) { _c = t._c; return *this; }
	OMPTimer& operator+=(const OMPTimer& t) { _c += t._c; return *this; }
	OMPTimer& operator-=(const OMPTimer& t) { _c -= t._c; return *this; }
	OMPTimer  operator +(const OMPTimer& t) const
	{
		OMPTimer r; r._c = _c + t._c; return r;
	}
	OMPTimer  operator -(const OMPTimer& t) const
	{
		OMPTimer r; r._c = _c - t._c; return r;
	}
	OMPTimer  operator -() { OMPTimer r; r._c = - _c; return r; }
};
} // namespace Givaro
#endif // OMP


#endif // __GIVARO_timer_H
// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s