1 2 /* 3 * Copyright 2011 Google Inc. 4 * 5 * Use of this source code is governed by a BSD-style license that can be 6 * found in the LICENSE file. 7 */ 8 #include "BenchSysTimer_c.h" 9 10 //Time 11 #include <time.h> 12 13 void BenchSysTimer::startWall() { 14 this->fStartWall = time(); 15 } 16 void BenchSysTimer::startCpu() { 17 this->fStartCpu = clock(); 18 } 19 20 double BenchSysTimer::endCpu() { 21 clock_t end_cpu = clock(); 22 this->fCpu = (end_cpu - this->fStartCpu) * CLOCKS_PER_SEC / 1000.0; 23 } 24 double BenchSysTimer::endWall() { 25 time_t end_wall = time(); 26 this->fWall = difftime(end_wall, this->fstartWall) / 1000.0; 27 } 28