24 #ifndef Weight_Profiler_defs_hh
25 #define Weight_Profiler_defs_hh 1
39 : file(file), line(line), delta(delta),
41 for (
int i = 0; i < 2; ++i) {
45 stat[i].squares_sum = 0;
59 int r = clock_gettime(CLOCK_THREAD_CPUTIME_ID, &
stamp);
62 clock_gettime(CLOCK_THREAD_CPUTIME_ID, &
stamp);
66 void end(
unsigned int factor = 1) {
69 struct timespec start =
stamp;
72 if (
stamp.tv_nsec >= start.tv_nsec) {
73 elapsed = (
stamp.tv_nsec - start.tv_nsec)
74 + (
stamp.tv_sec - start.tv_sec) * 1e9;
77 elapsed = (1000000000 - start.tv_nsec +
stamp.tv_nsec )
78 + (
stamp.tv_sec - start.tv_sec - 1) * 1e9;
81 double elapsed1 = elapsed / factor;
88 stat[i].min =
stat[i].max = elapsed1;
90 else if (
stat[i].
min > elapsed1) {
91 stat[i].min = elapsed1;
93 else if (
stat[i].
max < elapsed1) {
94 stat[i].max = elapsed1;
96 stat[i].sum += elapsed;
97 stat[i].squares_sum += elapsed * elapsed1;
98 stat[i].count += factor;
157 #endif // Weight_Profiler_defs_hh
Weight_Profiler(const char *file, int line, Weightwatch_Traits::Delta delta, double min_threshold=0, double max_threshold=0)
Weightwatch_Traits::Delta delta
Computational weight to be added at each iteration.
unsigned long long Threshold
The type used to specify thresholds for computational weight.
struct Parma_Polyhedra_Library::Weight_Profiler::@2 stat[2]
Statistical data for samples (both DISCARDED and VALID)
double min_threshold
Times less than this value are discarded.
double squares_sum
Sum of the squares of the measured times (to compute variance).
void end(unsigned int factor=1)
unsigned long long Delta
The type used to specify increments of computational weight.
double max_threshold
Times greater than this value are discarded.
static struct timespec stamp
Holds the time corresponding to last time begin() was called.
unsigned int samples
Number of collected samples.
static Threshold weight
The current computational weight.
double sum
Sum of the measured times.
The entire library is confined to this namespace.
const char * file
File of this profiling point.
static double tune_adjustment()
double max
Maximum measured time.
unsigned int count
Number of collected iterations.
double min
Minimum measured time.
int line
Line of this profiling point.
static double adjustment
Time quantity used to adjust the elapsed times so as not to take into account the time spent by the m...