namespace caffe {
+const float kMillisecondsThreshold = 30;
+
template <typename TypeParam>
class BenchmarkTest : public MultiDeviceTest<TypeParam> {};
EXPECT_FALSE(timer.has_run_at_least_once());
timer.Start();
usleep(300 * 1000);
- EXPECT_GE(timer.MilliSeconds(), 290);
- EXPECT_LE(timer.MilliSeconds(), 310);
+ EXPECT_GE(timer.MilliSeconds(), 300 - kMillisecondsThreshold);
+ EXPECT_LE(timer.MilliSeconds(), 300 + kMillisecondsThreshold);
EXPECT_TRUE(timer.initted());
EXPECT_FALSE(timer.running());
EXPECT_TRUE(timer.has_run_at_least_once());
EXPECT_FALSE(timer.has_run_at_least_once());
timer.Start();
usleep(300 * 1000);
- EXPECT_GE(timer.Seconds(), 0.290);
- EXPECT_LE(timer.Seconds(), 0.310);
+ EXPECT_GE(timer.Seconds(), 0.3 - kMillisecondsThreshold / 1000.);
+ EXPECT_LE(timer.Seconds(), 0.3 + kMillisecondsThreshold / 1000.);
EXPECT_TRUE(timer.initted());
EXPECT_FALSE(timer.running());
EXPECT_TRUE(timer.has_run_at_least_once());