Go to the documentation of this file.
2 #ifndef __JEEP__JTIMER__
3 #define __JEEP__JTIMER__
7 #include <sys/resource.h>
22 namespace JPP {
using namespace JEEP; }
37 typedef unsigned long long ull;
96 gettimeofday(&tv, NULL);
97 getrusage(RUSAGE_SELF, &usage);
120 gettimeofday(&tv, NULL);
121 getrusage(RUSAGE_SELF, &usage);
151 return (
unsigned long long) tv.tv_sec * 1000000ULL + (
unsigned long long) tv.tv_usec;
178 if (normalise &&
counter != 0) {
179 factor = 1.0 / (double)
counter;
201 out <<
FIXED(10,3) <<
usec_wall * y <<
" " <<
u <<
"s elapsed" << endl;
unsigned long long usec_scpu
Auxiliary class for CPU timing and usage.
Auxiliary data structure for floating point format specification.
void print(std::ostream &out, const JScale_t scale=milli_t) const
Print timer data.
General puprpose classes and methods.
unsigned long long usec_wall
const char * getUnit(const int scale)
Get textual unit corresponding to scale.
static unsigned long long timeval_to_usec(const struct timeval &tv)
Convert timeval to micro-seconds.
void print(std::ostream &out, const double factor, const JScale_t scale=milli_t) const
Print timer data.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary class for title.
JScale_t
Enumeration for scaling of quantity.
const std::string & getTitle() const
Get title.
unsigned long long counter
unsigned long long usec_ucpu
unsigned int timing_get_cpu_percentage() const
Get CPU usage.
JStatus_t
Status of clock.
friend std::ostream & operator<<(std::ostream &out, const JTimer &timer)
Print timer data.
double getValue(const JScale_t scale)
Get numerical value corresponding to scale.
void print(std::ostream &out, const bool normalise, const JScale_t scale=milli_t) const
Print timer data.
JTimer()
Default constructor.
void scale(vector< double > &v, double c)
scale vector content
JTimer(const JTitle &title)
Constructor.