summaryrefslogtreecommitdiffstats
path: root/vespalib/src/tests/executor
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2019-11-19 23:22:55 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2019-11-20 21:55:01 +0000
commitcf3b20dba22718b533eac6854cde86b6538958af (patch)
tree9a0e795cd74d2721140c48012f794298dfef7420 /vespalib/src/tests/executor
parent64b7c822099d7cda921699e380c4d95608a1ab00 (diff)
FastOS_Time -> std::chrono.
Diffstat (limited to 'vespalib/src/tests/executor')
-rw-r--r--vespalib/src/tests/executor/stress_test.cpp26
1 files changed, 11 insertions, 15 deletions
diff --git a/vespalib/src/tests/executor/stress_test.cpp b/vespalib/src/tests/executor/stress_test.cpp
index 702991fd779..bbe754be2bd 100644
--- a/vespalib/src/tests/executor/stress_test.cpp
+++ b/vespalib/src/tests/executor/stress_test.cpp
@@ -4,7 +4,7 @@
#include <vespa/vespalib/util/executor.h>
#include <vespa/vespalib/util/threadstackexecutor.h>
#include <vespa/vespalib/locale/c.h>
-#include <vespa/fastos/time.h>
+#include <vespa/fastos/timestamp.h>
using namespace vespalib;
using namespace std::literals;
@@ -60,29 +60,28 @@ uint32_t
Test::calibrate(double wanted_ms)
{
uint32_t n = 0;
- FastOS_Time t0;
- FastOS_Time t1;
+ fastos::StopWatch t0;
+ fastos::StopWatch t1;
{ // calibration of calibration loop
uint32_t result = 0;
- t0.SetNow();
double ms;
do {
result += doStuff(++n);
- t1.SetNow();
- ms = (t1.MilliSecs() - t0.MilliSecs());
+ t1.restart();
+ ms = (t1.elapsed().ms() - t0.elapsed().ms());
} while (ms < 1000.0);
_result += result;
}
{ // calibrate loop
- t0.SetNow();
+ t0.restart();
uint32_t result = 0;
for (uint32_t i = 0; i < n; ++i) {
result += doStuff(i);
}
_result += result;
- t1.SetNow();
+ t1.restart();
}
- double ms = (t1.MilliSecs() - t0.MilliSecs());
+ double ms = (t1.elapsed().ms() - t0.elapsed().ms());
double size = (((double)n) / ms) * wanted_ms;
return (uint32_t) std::round(size);
}
@@ -122,22 +121,19 @@ Test::Main()
fprintf(stderr, "all threads have been accounted for...\n");
}
{
- FastOS_Time t0;
- FastOS_Time t1;
+ fastos::StopWatch t0;
fprintf(stderr, "starting task submission...\n");
- t0.SetNow();
uint32_t result = 0;
for (uint32_t i = 0; i < tasks; ++i) {
Executor::Task::UP t(new CPUTask(taskSize, result));
t = executor.execute(std::move(t));
- while (t.get() != 0) {
+ while (t) {
std::this_thread::sleep_for(10ms);
t = executor.execute(std::move(t));
}
}
executor.sync();
- t1.SetNow();
- double ms = (t1.MilliSecs() - t0.MilliSecs());
+ double ms = t0.elapsed().ms();
fprintf(stderr, "total execution wall time: %g ms\n", ms);
_result += result;
}