1 #ifndef __JEEP__JTIMER__
2 #define __JEEP__JTIMER__
6 #include <sys/resource.h>
21 namespace JPP {
using namespace JEEP; }
36 typedef unsigned long long ull;
110 gettimeofday(&
tv, NULL);
111 getrusage(RUSAGE_SELF, &
usage);
131 gettimeofday(&
tv, NULL);
132 getrusage(RUSAGE_SELF, &
usage);
162 return (
unsigned long long)
tv.tv_sec * 1000000ULL + (
unsigned long long)
tv.tv_usec;
189 if (normalise &&
counter != 0) {
190 factor = 1.0 / (double)
counter;
257 static bool status =
true;
void scale(vector< double > &v, double c)
scale vector content
Enumeration for scaling of quantity.
Auxiliary class for CPU timing and usage.
unsigned long long usec_ucpu
void print(std::ostream &out, const JScale_t scale=milli_t) const
Print timer data.
JTimer(const JTitle &title)
Constructor.
unsigned int timing_get_cpu_percentage() const
Get CPU usage.
static unsigned long long timeval_to_usec(const struct timeval &tv)
Convert timeval to micro-seconds.
unsigned long long usec_wall
void print(std::ostream &out, const bool normalise, const JScale_t scale=milli_t) const
Print timer data.
static bool & get_status()
Get status.
JTimer()
Default constructor.
unsigned long long counter
JStatus_t
Status of clock.
static void disable()
Disable timers.
static void enable()
Enable timers.
unsigned long long usec_scpu
void print(std::ostream &out, const double factor, const JScale_t scale=milli_t) const
Print timer data.
friend std::ostream & operator<<(std::ostream &out, const JTimer &timer)
Print timer data.
Auxiliary class for title.
const std::string & getTitle() const
Get title.
General puprpose classes and methods.
double getValue(const JScale_t scale)
Get numerical value corresponding to scale.
JScale_t
Enumeration for scaling of quantity.
const char * getUnit(const int scale)
Get textual unit corresponding to scale.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure for floating point format specification.