Move the Stopwatch class to NetdConstants.
Also implement TimedOperation by subclassing Stopwatch, since
it essentially does the same thing.
Change-Id: I68febcf1caa8a00b548790f9e3ccc10836877639
diff --git a/tests/binder_test.cpp b/tests/binder_test.cpp
index defe875..bc9cf88 100644
--- a/tests/binder_test.cpp
+++ b/tests/binder_test.cpp
@@ -55,17 +55,14 @@
};
-class TimedOperation {
+class TimedOperation : public Stopwatch {
public:
- TimedOperation(std::string name): mStart(std::chrono::steady_clock::now()), mName(name) {}
+ TimedOperation(std::string name): mName(name) {}
virtual ~TimedOperation() {
- using ms = std::chrono::duration<float, std::ratio<1, 1000>>;
- fprintf(stderr, " %s: %6.1f ms\n", mName.c_str(),
- std::chrono::duration_cast<ms>(std::chrono::steady_clock::now() - mStart).count());
+ fprintf(stderr, " %s: %6.1f ms\n", mName.c_str(), timeTaken());
}
private:
- std::chrono::time_point<std::chrono::steady_clock> mStart;
std::string mName;
};