OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "gpu/perftests/measurements.h" | 5 #include "gpu/perftests/measurements.h" |
6 | 6 |
| 7 #include <stdint.h> |
| 8 |
7 #include "base/logging.h" | 9 #include "base/logging.h" |
8 #include "testing/perf/perf_test.h" | 10 #include "testing/perf/perf_test.h" |
9 #include "ui/gl/gpu_timing.h" | 11 #include "ui/gl/gpu_timing.h" |
10 | 12 |
11 namespace gpu { | 13 namespace gpu { |
12 | 14 |
13 Measurement::Measurement() : name(), wall_time(), cpu_time(), gpu_time() { | 15 Measurement::Measurement() : name(), wall_time(), cpu_time(), gpu_time() { |
14 } | 16 } |
15 Measurement::Measurement(const Measurement& m) | 17 Measurement::Measurement(const Measurement& m) |
16 : name(m.name), | 18 : name(m.name), |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 } | 83 } |
82 } | 84 } |
83 | 85 |
84 Measurement MeasurementTimers::GetAsMeasurement(const std::string& name) { | 86 Measurement MeasurementTimers::GetAsMeasurement(const std::string& name) { |
85 DCHECK_NE(base::TimeDelta(), | 87 DCHECK_NE(base::TimeDelta(), |
86 wall_time_); // At least wall_time_ has been set. | 88 wall_time_); // At least wall_time_ has been set. |
87 | 89 |
88 if (!base::ThreadTicks::IsSupported()) { | 90 if (!base::ThreadTicks::IsSupported()) { |
89 cpu_time_ = base::TimeDelta::FromMicroseconds(-1); | 91 cpu_time_ = base::TimeDelta::FromMicroseconds(-1); |
90 } | 92 } |
91 int64 gpu_time = -1; | 93 int64_t gpu_time = -1; |
92 if (gpu_timer_.get() != nullptr && gpu_timer_->IsAvailable()) { | 94 if (gpu_timer_.get() != nullptr && gpu_timer_->IsAvailable()) { |
93 gpu_time = gpu_timer_->GetDeltaElapsed(); | 95 gpu_time = gpu_timer_->GetDeltaElapsed(); |
94 } | 96 } |
95 return Measurement(name, wall_time_, cpu_time_, | 97 return Measurement(name, wall_time_, cpu_time_, |
96 base::TimeDelta::FromMicroseconds(gpu_time)); | 98 base::TimeDelta::FromMicroseconds(gpu_time)); |
97 } | 99 } |
98 | 100 |
99 MeasurementTimers::~MeasurementTimers() { | 101 MeasurementTimers::~MeasurementTimers() { |
100 if (gpu_timer_.get()) { | 102 if (gpu_timer_.get()) { |
101 gpu_timer_->Destroy(true); | 103 gpu_timer_->Destroy(true); |
102 } | 104 } |
103 } | 105 } |
104 | 106 |
105 } // namespace gpu | 107 } // namespace gpu |
OLD | NEW |