// Copyright 2016 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_TRACING_TEST_PERF_TEST_HELPERS_H_ #define COMPONENTS_TRACING_TEST_PERF_TEST_HELPERS_H_ #include <stdint.h> #include <vector> #include "base/time/time.h" namespace tracing { // Measure time spent in a scope. // Must be used inside GTest case and result will be printed in perf_test format // with value name passed to constructor. class ScopedStopwatch { … }; // Measure median time of loop iterations. // Example: // IterableStopwatch stopwatch("foo"); // for (int i = 0; i < 100; i++) { // ... // stopwatch.NextLap(); // } // Must be used inside GTest case and result will be printed in perf_test format // with value name passed to constructor. class IterableStopwatch { … }; } // namespace tracing #endif // COMPONENTS_TRACING_TEST_PERF_TEST_HELPERS_H_