| 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> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "testing/perf/perf_test.h" | 10 #include "testing/perf/perf_test.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 return *this; | 47 return *this; |
| 48 } | 48 } |
| 49 | 49 |
| 50 Measurement Measurement::Divide(int a) const { | 50 Measurement Measurement::Divide(int a) const { |
| 51 return Measurement(name, wall_time / a, cpu_time / a, gpu_time / a); | 51 return Measurement(name, wall_time / a, cpu_time / a, gpu_time / a); |
| 52 } | 52 } |
| 53 | 53 |
| 54 Measurement::~Measurement() { | 54 Measurement::~Measurement() { |
| 55 } | 55 } |
| 56 | 56 |
| 57 MeasurementTimers::MeasurementTimers(gfx::GPUTimingClient* gpu_timing_client) | 57 MeasurementTimers::MeasurementTimers(gl::GPUTimingClient* gpu_timing_client) |
| 58 : wall_time_start_(), cpu_time_start_(), gpu_timer_() { | 58 : wall_time_start_(), cpu_time_start_(), gpu_timer_() { |
| 59 DCHECK(gpu_timing_client); | 59 DCHECK(gpu_timing_client); |
| 60 wall_time_start_ = base::TimeTicks::Now(); | 60 wall_time_start_ = base::TimeTicks::Now(); |
| 61 if (base::ThreadTicks::IsSupported()) { | 61 if (base::ThreadTicks::IsSupported()) { |
| 62 base::ThreadTicks::WaitUntilInitialized(); | 62 base::ThreadTicks::WaitUntilInitialized(); |
| 63 cpu_time_start_ = base::ThreadTicks::Now(); | 63 cpu_time_start_ = base::ThreadTicks::Now(); |
| 64 } else { | 64 } else { |
| 65 static bool logged_once = false; | 65 static bool logged_once = false; |
| 66 LOG_IF(WARNING, !logged_once) << "ThreadTicks not supported."; | 66 LOG_IF(WARNING, !logged_once) << "ThreadTicks not supported."; |
| 67 logged_once = true; | 67 logged_once = true; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 98 base::TimeDelta::FromMicroseconds(gpu_time)); | 98 base::TimeDelta::FromMicroseconds(gpu_time)); |
| 99 } | 99 } |
| 100 | 100 |
| 101 MeasurementTimers::~MeasurementTimers() { | 101 MeasurementTimers::~MeasurementTimers() { |
| 102 if (gpu_timer_.get()) { | 102 if (gpu_timer_.get()) { |
| 103 gpu_timer_->Destroy(true); | 103 gpu_timer_->Destroy(true); |
| 104 } | 104 } |
| 105 } | 105 } |
| 106 | 106 |
| 107 } // namespace gpu | 107 } // namespace gpu |
| OLD | NEW |