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;
double getValue(const JScale_t scale)
Get numerical value corresponding to scale.
JScale_t
Enumeration for scaling of quantity.
unsigned int timing_get_cpu_percentage() const
Get CPU usage.
unsigned long long usec_ucpu
void print(std::ostream &out, const JScale_t scale=milli_t) const
Print timer data.
void print(std::ostream &out, const double factor, const JScale_t scale=milli_t) const
Print timer data.
Auxiliary data structure for floating point format specification.
const std::string & getTitle() const
Get title.
JTimer()
Default constructor.
unsigned long long usec_scpu
void print(std::ostream &out, const bool normalise, const JScale_t scale=milli_t) const
Print timer data.
I/O formatting auxiliaries.
Auxiliary class for title.
unsigned long long counter
Auxiliary class for CPU timing and usage.
Enumeration for scaling of quantity.
const char * getUnit(const int scale)
Get textual unit corresponding to scale.
friend std::ostream & operator<<(std::ostream &out, const JTimer &timer)
Print timer data.
static unsigned long long timeval_to_usec(const struct timeval &tv)
Convert timeval to micro-seconds.
JStatus_t
Status of clock.
JTimer(const JTitle &title)
Constructor.
unsigned long long usec_wall
void scale(vector< double > &v, double c)
scale vector content