| Index: apps/benchmark/measurements.h
|
| diff --git a/apps/benchmark/measurements.h b/apps/benchmark/measurements.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..ffbfcbbd418d3c56303b9bf5d6cc1ded5602bbda
|
| --- /dev/null
|
| +++ b/apps/benchmark/measurements.h
|
| @@ -0,0 +1,53 @@
|
| +// 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.
|
| +
|
| +#ifndef APPS_BENCHMARK_MEASUREMENTS_HH_
|
| +#define APPS_BENCHMARK_MEASUREMENTS_HH_
|
| +
|
| +#include <vector>
|
| +
|
| +#include "apps/benchmark/event.h"
|
| +#include "base/macros.h"
|
| +#include "base/memory/scoped_ptr.h"
|
| +#include "base/time/time.h"
|
| +#include "base/values.h"
|
| +
|
| +namespace benchmark {
|
| +
|
| +// Describes a trace event to match.
|
| +struct EventSpec {
|
| + std::string name;
|
| + std::string category;
|
| +};
|
| +
|
| +// Represents a single measurement to be performed on the collected trace.
|
| +struct Measurement {
|
| + enum MeasurementType { TIME_UNTIL, AVG_DURATION };
|
| +
|
| + MeasurementType type;
|
| + EventSpec target_event;
|
| + std::string spec;
|
| +};
|
| +
|
| +class Measurements {
|
| + public:
|
| + Measurements(std::vector<Event> events, EventSpec reference_spec);
|
| + ~Measurements();
|
| +
|
| + double Measure(const Measurement& measurement);
|
| +
|
| + private:
|
| + double TimeUntil(const EventSpec& event_spec);
|
| + double AvgDuration(const EventSpec& event_spec);
|
| +
|
| + base::TimeTicks FindEarliest(const EventSpec& spec);
|
| +
|
| + std::vector<Event> events_;
|
| + EventSpec reference_spec_;
|
| + DISALLOW_COPY_AND_ASSIGN(Measurements);
|
| +};
|
| +
|
| +} // namespace benchmark
|
| +
|
| +#endif // APPS_BENCHMARK_MEASUREMENTS_HH_
|
|
|