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

Unified Diff: tools/telemetry/telemetry/core/platform/profiler/perf_profiler_unittest.py

Issue 19857003: [Telemetry] Add a profiler based loading measurement. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add tests Created 7 years, 5 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
Index: tools/telemetry/telemetry/core/platform/profiler/perf_profiler_unittest.py
diff --git a/tools/telemetry/telemetry/core/platform/profiler/perf_profiler_unittest.py b/tools/telemetry/telemetry/core/platform/profiler/perf_profiler_unittest.py
new file mode 100644
index 0000000000000000000000000000000000000000..cd2b9a88ee418b5deb60165c404d17704b043bdc
--- /dev/null
+++ b/tools/telemetry/telemetry/core/platform/profiler/perf_profiler_unittest.py
@@ -0,0 +1,31 @@
+# Copyright (c) 2013 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.
+import os
+import logging
+import unittest
+
+from telemetry.core.platform.profiler import perf_profiler
+from telemetry.unittest import options_for_unittests
+
+class TestPerfProfiler(unittest.TestCase):
+ def testPerfProfiler(self):
+ options = options_for_unittests.GetCopy()
+ if not perf_profiler.PerfProfiler.is_supported(options):
+ logging.warning('PerfProfiler is not supported. Skipping test')
+ return
+
+ profile_file = os.path.join(os.path.dirname(__file__),
+ 'testdata', 'perf.profile')
+ self.assertEqual(perf_profiler.PerfProfiler.GetTopSamples(profile_file, 10),
+ { 'v8::internal::StaticMarkingVisitor::MarkMapContents': 63615201,
+ 'v8::internal::RelocIterator::next': 38271931,
+ 'v8::internal::LAllocator::MeetConstraintsBetween': 42913933,
+ 'v8::internal::FlexibleBodyVisitor::Visit': 31909537,
+ 'v8::internal::LiveRange::CreateAssignedOperand': 42913933,
+ 'void v8::internal::RelocInfo::Visit': 96878864,
+ 'WebCore::HTMLTokenizer::nextToken': 48240439,
+ 'v8::internal::Scanner::ScanIdentifierOrKeyword': 46054550,
+ 'sk_memset32_SSE2': 45121317,
+ 'v8::internal::HeapObject::Size': 39786862
+ })

Powered by Google App Engine
This is Rietveld 408576698