| 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 "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "testing/perf/perf_test.h" | 8 #include "testing/perf/perf_test.h" |
| 9 #include "ui/gl/gpu_timing.h" | 9 #include "ui/gl/gpu_timing.h" |
| 10 | 10 |
| 11 namespace gpu { | 11 namespace gpu { |
| 12 | 12 |
| 13 Measurement::Measurement() : name(), wall_time(), cpu_time(), gpu_time() { | 13 Measurement::Measurement() : name(), wall_time(), cpu_time(), gpu_time() { |
| 14 } | 14 } |
| 15 Measurement::Measurement(const Measurement& m) | 15 Measurement::Measurement(const Measurement& m) |
| 16 : name(m.name), | 16 : name(m.name), |
| 17 wall_time(m.wall_time), | 17 wall_time(m.wall_time), |
| 18 cpu_time(m.cpu_time), | 18 cpu_time(m.cpu_time), |
| 19 gpu_time(m.gpu_time) { | 19 gpu_time(m.gpu_time) { |
| 20 } | 20 } |
| 21 Measurement::Measurement(const std::string& name, | 21 Measurement::Measurement(const std::string& name, |
| 22 const base::TimeDelta wall_time, | 22 const base::TimeDelta wall_time, |
| 23 const base::TimeDelta cpu_time, | 23 const base::TimeDelta cpu_time, |
| 24 const base::TimeDelta gpu_time) | 24 const base::TimeDelta gpu_time) |
| 25 : name(name), wall_time(wall_time), cpu_time(cpu_time), gpu_time(gpu_time) { | 25 : name(name), wall_time(wall_time), cpu_time(cpu_time), gpu_time(gpu_time) { |
| 26 } | 26 } |
| 27 | 27 |
| 28 void Measurement::PrintResult(const std::string& suffix) const { | 28 void Measurement::PrintResult(const std::string& graph) const { |
| 29 perf_test::PrintResult(name, "_wall" + suffix, "", | 29 perf_test::PrintResult(graph, "", name + "_wall", wall_time.InMillisecondsF(), |
| 30 wall_time.InMillisecondsF(), "ms", true); | 30 "ms", true); |
| 31 if (cpu_time.InMicroseconds() >= 0) { | 31 if (cpu_time.InMicroseconds() >= 0) { |
| 32 perf_test::PrintResult(name, "_cpu" + suffix, "", | 32 perf_test::PrintResult(graph, "", name + "_cpu", cpu_time.InMillisecondsF(), |
| 33 cpu_time.InMillisecondsF(), "ms", true); | 33 "ms", true); |
| 34 } | 34 } |
| 35 if (gpu_time.InMicroseconds() >= 0) { | 35 if (gpu_time.InMicroseconds() >= 0) { |
| 36 perf_test::PrintResult(name, "_gpu" + suffix, "", | 36 perf_test::PrintResult(graph, "", name + "_gpu", gpu_time.InMillisecondsF(), |
| 37 gpu_time.InMillisecondsF(), "ms", true); | 37 "ms", true); |
| 38 } | 38 } |
| 39 } | 39 } |
| 40 | 40 |
| 41 Measurement& Measurement::Increment(const Measurement& m) { | 41 Measurement& Measurement::Increment(const Measurement& m) { |
| 42 wall_time += m.wall_time; | 42 wall_time += m.wall_time; |
| 43 cpu_time += m.cpu_time; | 43 cpu_time += m.cpu_time; |
| 44 gpu_time += m.gpu_time; | 44 gpu_time += m.gpu_time; |
| 45 return *this; | 45 return *this; |
| 46 } | 46 } |
| 47 | 47 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 gpu_time = gpu_timer_->GetDeltaElapsed(); | 92 gpu_time = gpu_timer_->GetDeltaElapsed(); |
| 93 } | 93 } |
| 94 return Measurement(name, wall_time_, cpu_time_, | 94 return Measurement(name, wall_time_, cpu_time_, |
| 95 base::TimeDelta::FromMicroseconds(gpu_time)); | 95 base::TimeDelta::FromMicroseconds(gpu_time)); |
| 96 } | 96 } |
| 97 | 97 |
| 98 MeasurementTimers::~MeasurementTimers() { | 98 MeasurementTimers::~MeasurementTimers() { |
| 99 } | 99 } |
| 100 | 100 |
| 101 } // namespace gpu | 101 } // namespace gpu |
| OLD | NEW |