32 #ifndef DEF_GRAPHCHI_CONTEXT
33 #define DEF_GRAPHCHI_CONTEXT
40 #include "graphchi_types.hpp"
53 std::vector<double> deltas;
58 gettimeofday(&start, NULL);
63 gettimeofday(&end, NULL);
64 return end.tv_sec-start.tv_sec+ ((double)(end.tv_usec-start.tv_usec))/1.0E6;
71 last_iteration = _last_iteration;
74 void reset_deltas(
int nthreads) {
75 deltas = std::vector<double>(nthreads, 0.0);
80 for(
int i=0; i < (int)deltas.size(); i++) {
86 inline bool isnan(
double x) {
87 return !(x<0 || x>=0);
97 deltas[omp_get_thread_num()] += delta;
99 assert(!isnan(delta));