OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef APPS_BENCHMARK_MEASUREMENTS_HH_ |
| 6 #define APPS_BENCHMARK_MEASUREMENTS_HH_ |
| 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "apps/benchmark/event.h" |
| 11 #include "base/macros.h" |
| 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/time/time.h" |
| 14 #include "base/values.h" |
| 15 |
| 16 namespace benchmark { |
| 17 |
| 18 // Describes a trace event to match. |
| 19 struct EventSpec { |
| 20 std::string name; |
| 21 std::string category; |
| 22 }; |
| 23 |
| 24 // Represents a single measurement to be performed on the collected trace. |
| 25 struct Measurement { |
| 26 enum MeasurementType { TIME_UNTIL, AVG_DURATION }; |
| 27 |
| 28 MeasurementType type; |
| 29 EventSpec target_event; |
| 30 std::string spec; |
| 31 }; |
| 32 |
| 33 class Measurements { |
| 34 public: |
| 35 Measurements(std::vector<Event> events, EventSpec reference_spec); |
| 36 ~Measurements(); |
| 37 |
| 38 double Measure(const Measurement& measurement); |
| 39 |
| 40 private: |
| 41 double TimeUntil(const EventSpec& event_spec); |
| 42 double AvgDuration(const EventSpec& event_spec); |
| 43 |
| 44 base::TimeTicks FindEarliest(const EventSpec& spec); |
| 45 |
| 46 std::vector<Event> events_; |
| 47 EventSpec reference_spec_; |
| 48 DISALLOW_COPY_AND_ASSIGN(Measurements); |
| 49 }; |
| 50 |
| 51 } // namespace benchmark |
| 52 |
| 53 #endif // APPS_BENCHMARK_MEASUREMENTS_HH_ |
OLD | NEW |