11 #ifndef UTILS_MCLOCK_H_
12 #define UTILS_MCLOCK_H_
25 gettimeofday(&startTime, NULL);
30 gettimeofday(&endTime, NULL);
33 friend std::ostream&
operator<<(std::ostream& stream,
const MClock& clock) {
35 if (!clock.end_called) {
36 stream <<
"end not called";
38 long totalTime = (clock.endTime.tv_sec - clock.startTime.tv_sec) * 1000000L;
39 totalTime += (clock.endTime.tv_usec - clock.startTime.tv_usec);
40 stream << clock.num_seconds() <<
"s";
45 double num_seconds()
const {
46 if (!end_called) end();
47 long totalTime = (endTime.tv_sec - startTime.tv_sec) * 1000000L;
48 totalTime += (endTime.tv_usec - startTime.tv_usec);
49 return (totalTime / 1000L) /
static_cast<double>(1000);
53 mutable struct timeval startTime, endTime;
54 mutable bool end_called;
std::ostream & operator<<(std::ostream &os, const Permutahedral_representation< Vertex, OrderedSetPartition > &simplex)
Print a permutahedral representation to a stream.
Definition: Permutahedral_representation.h:173