Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(817)

Unified Diff: mojo/edk/system/ref_counted_perftest.cc

Issue 1423713009: EDK: Move ref counting classes to mojo/edk/util. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/edk/system/ref_counted_internal.h ('k') | mojo/edk/system/ref_counted_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/ref_counted_perftest.cc
diff --git a/mojo/edk/system/ref_counted_perftest.cc b/mojo/edk/system/ref_counted_perftest.cc
deleted file mode 100644
index c7100fe3a4d58f4ddee08e84e5c936f0a6aa94ce..0000000000000000000000000000000000000000
--- a/mojo/edk/system/ref_counted_perftest.cc
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#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 "testing/gtest/include/gtest/gtest.h"
-
-namespace mojo {
-namespace system {
-namespace {
-
-class MyClass : public RefCountedThreadSafe<MyClass> {
- public:
- static RefPtr<MyClass> Create() {
- return RefPtr<MyClass>(AdoptRef(new MyClass()));
- }
-
- private:
- friend class RefCountedThreadSafe<MyClass>;
-
- MyClass() {}
- ~MyClass() {}
-};
-
-TEST(RefCountedPerfTest, OneThreadCreateAdoptDestroy) {
- uint64_t iterations = 0;
- test::Stopwatch stopwatch;
- stopwatch.Start();
- do {
- for (size_t i = 0; i < 1000; i++, iterations++) {
- RefPtr<MyClass> x = MyClass::Create();
- x = nullptr;
- }
- iterations++;
- } while (stopwatch.Elapsed() < test::DeadlineFromMilliseconds(1000));
- double elapsed = stopwatch.Elapsed() / 1000000.0;
-
- test::LogPerfResult("OneThreadCreateAdoptDestroy", iterations / elapsed,
- "iterations/s");
-}
-
-TEST(RefCountedPerfTest, OneThreadAssignRefPtr) {
- RefPtr<MyClass> x = MyClass::Create();
- uint64_t iterations = 0;
- 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));
- double elapsed = stopwatch.Elapsed() / 1000000.0;
-
- test::LogPerfResult("OneThreadAssignRefPtr", iterations / elapsed,
- "iterations/s");
-}
-
-// TODO(vtl): Add threaded perf tests.
-
-} // namespace
-} // namespace system
-} // namespace mojo
« no previous file with comments | « mojo/edk/system/ref_counted_internal.h ('k') | mojo/edk/system/ref_counted_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698