| Index: mojo/edk/util/ref_counted_perftest.cc
|
| diff --git a/mojo/edk/system/ref_counted_perftest.cc b/mojo/edk/util/ref_counted_perftest.cc
|
| similarity index 70%
|
| rename from mojo/edk/system/ref_counted_perftest.cc
|
| rename to mojo/edk/util/ref_counted_perftest.cc
|
| index c7100fe3a4d58f4ddee08e84e5c936f0a6aa94ce..3c270e5787a2f60e3f034f66839f206f4486edd0 100644
|
| --- a/mojo/edk/system/ref_counted_perftest.cc
|
| +++ b/mojo/edk/util/ref_counted_perftest.cc
|
| @@ -4,14 +4,14 @@
|
|
|
| #include <stdint.h>
|
|
|
| -#include "mojo/edk/system/ref_counted.h"
|
| #include "mojo/edk/system/test/perf_log.h"
|
| #include "mojo/edk/system/test/stopwatch.h"
|
| #include "mojo/edk/system/test/timeouts.h"
|
| +#include "mojo/edk/util/ref_counted.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| namespace mojo {
|
| -namespace system {
|
| +namespace util {
|
| namespace {
|
|
|
| class MyClass : public RefCountedThreadSafe<MyClass> {
|
| @@ -29,7 +29,7 @@ class MyClass : public RefCountedThreadSafe<MyClass> {
|
|
|
| TEST(RefCountedPerfTest, OneThreadCreateAdoptDestroy) {
|
| uint64_t iterations = 0;
|
| - test::Stopwatch stopwatch;
|
| + system::test::Stopwatch stopwatch;
|
| stopwatch.Start();
|
| do {
|
| for (size_t i = 0; i < 1000; i++, iterations++) {
|
| @@ -37,32 +37,32 @@ TEST(RefCountedPerfTest, OneThreadCreateAdoptDestroy) {
|
| x = nullptr;
|
| }
|
| iterations++;
|
| - } while (stopwatch.Elapsed() < test::DeadlineFromMilliseconds(1000));
|
| + } while (stopwatch.Elapsed() < system::test::DeadlineFromMilliseconds(1000));
|
| double elapsed = stopwatch.Elapsed() / 1000000.0;
|
|
|
| - test::LogPerfResult("OneThreadCreateAdoptDestroy", iterations / elapsed,
|
| - "iterations/s");
|
| + system::test::LogPerfResult("OneThreadCreateAdoptDestroy",
|
| + iterations / elapsed, "iterations/s");
|
| }
|
|
|
| TEST(RefCountedPerfTest, OneThreadAssignRefPtr) {
|
| RefPtr<MyClass> x = MyClass::Create();
|
| uint64_t iterations = 0;
|
| - test::Stopwatch stopwatch;
|
| + system::test::Stopwatch stopwatch;
|
| stopwatch.Start();
|
| do {
|
| for (size_t i = 0; i < 1000; i++, iterations++) {
|
| RefPtr<MyClass> y = x;
|
| }
|
| iterations++;
|
| - } while (stopwatch.Elapsed() < test::DeadlineFromMilliseconds(1000));
|
| + } while (stopwatch.Elapsed() < system::test::DeadlineFromMilliseconds(1000));
|
| double elapsed = stopwatch.Elapsed() / 1000000.0;
|
|
|
| - test::LogPerfResult("OneThreadAssignRefPtr", iterations / elapsed,
|
| - "iterations/s");
|
| + system::test::LogPerfResult("OneThreadAssignRefPtr", iterations / elapsed,
|
| + "iterations/s");
|
| }
|
|
|
| // TODO(vtl): Add threaded perf tests.
|
|
|
| } // namespace
|
| -} // namespace system
|
| +} // namespace util
|
| } // namespace mojo
|
|
|