system_time reports the current amount of system cpu time accumulated by this StopWatch. If the stop_watch is currently off, this is just the accumulated time. If the StopWatch is running, this is the accumulated time plus the time since the stop_watch was last started
| 178 | // this is just the accumulated time. If the StopWatch is running, this |
| 179 | // is the accumulated time plus the time since the stop_watch was last started |
| 180 | double StopWatch::getSystemTime() const |
| 181 | { |
| 182 | if (is_running_ == false) |
| 183 | { |
| 184 | /* stop_watch is currently off, so just return accumulated time */ |
| 185 | return accumulated_times_.kernelTime(); |
| 186 | } |
| 187 | |
| 188 | /* stop_watch is currently running, so add the elapsed time since */ |
| 189 | /* the stop_watch was last started to the accumulated time */ |
| 190 | auto now = snapShot_(); |
| 191 | auto diff = now - last_start_; |
| 192 | |
| 193 | /* convert into floating point number of seconds */ |
| 194 | return accumulated_times_.kernelTime() + diff.kernelTime(); |
| 195 | } |
| 196 | |
| 197 | bool StopWatch::operator==(const StopWatch& rhs) const |
| 198 | { |
no test coverage detected