/usr/include/givaro/givtimer.h is in libgivaro-dev 3.2.13-1.2.
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 | #ifndef _TIMER_H_
#define _TIMER_H_
// ==========================================================================
// $Source: /var/lib/cvs/Givaro/src/kernel/system/givtimer.h,v $
// Copyright(c)'94-97 by Givaro Team
// see the copyright file.
// Authors: T. Gautier
// $Id: givtimer.h,v 1.3 2006-06-06 12:52:39 jgdumas Exp $
// ==========================================================================
// Description:
#include <iostream>
class BaseTimer; class RealTimer; class SysTimer; class UserTimer;
class BaseTimer {
public:
enum {
MSPSEC = 1000000 // microsecond per second
};
// -- Clear timer :
inline void clear() { _t = 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;
const BaseTimer operator += (const BaseTimer & T) { return *this = *this + T; };
const BaseTimer operator -= (const BaseTimer & T) { return *this = *this - T; };
friend std::ostream& operator<< (std::ostream& o, const BaseTimer& BT)
{ return BT.print(o);}
public:
double _t; // time
};
class RealTimer : public BaseTimer {
public:
inline RealTimer( const BaseTimer& BT ): BaseTimer(BT) {};
inline RealTimer( ){};
void start();
void stop();
};
class UserTimer : public BaseTimer {
public:
inline UserTimer( const BaseTimer& BT ): BaseTimer(BT) {};
inline UserTimer( ) {};
void start();
void stop();
};
class SysTimer : public BaseTimer {
public:
inline SysTimer( const BaseTimer& BT ): BaseTimer(BT) {};
inline SysTimer( ) {};
void start();
void stop();
};
class Timer {
public :
// Clear timer :
void clear();
// Start timer
void start();
// Stop timer
void stop();
// total amount of second spent in user mode
double usertime() const { return ut.time(); }
// total amount of second spent in system mode
double systime () const { return st.time(); }
// real total amount of second spent.
double realtime () const { return rt.time(); }
// 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;
const Timer operator += (const Timer & T) { return *this = *this + T; };
const Timer operator -= (const Timer & T) { return *this = *this - T; };
// -- methods :
std::ostream& print( std::ostream& ) const;
public:
RealTimer rt;
UserTimer ut;
SysTimer st;
};
// inline std::ostream& operator<<( std::ostream& o, const Timer& T)
// { return T.print(o);}
inline std::ostream& operator<<( std::ostream& o, const Timer& T)
{ return o << T.realtime() << "s (" << T.usertime() << " cpu)"; }
#endif
|