Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Side by Side Diff: gpu/perftests/measurements.cc

Issue 1424703003: Kills TraceTicks, which was functionally the same as TimeTicks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed win compile error. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gpu/perftests/measurements.h ('k') | ipc/ipc_message_utils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 Measurement Measurement::Divide(int a) const { 48 Measurement Measurement::Divide(int a) const {
49 return Measurement(name, wall_time / a, cpu_time / a, gpu_time / a); 49 return Measurement(name, wall_time / a, cpu_time / a, gpu_time / a);
50 } 50 }
51 51
52 Measurement::~Measurement() { 52 Measurement::~Measurement() {
53 } 53 }
54 54
55 MeasurementTimers::MeasurementTimers(gfx::GPUTimingClient* gpu_timing_client) 55 MeasurementTimers::MeasurementTimers(gfx::GPUTimingClient* gpu_timing_client)
56 : wall_time_start_(), cpu_time_start_(), gpu_timer_() { 56 : wall_time_start_(), cpu_time_start_(), gpu_timer_() {
57 DCHECK(gpu_timing_client); 57 DCHECK(gpu_timing_client);
58 wall_time_start_ = base::TraceTicks::Now(); 58 wall_time_start_ = base::TimeTicks::Now();
59 if (base::ThreadTicks::IsSupported()) { 59 if (base::ThreadTicks::IsSupported()) {
60 base::ThreadTicks::WaitUntilInitialized(); 60 base::ThreadTicks::WaitUntilInitialized();
61 cpu_time_start_ = base::ThreadTicks::Now(); 61 cpu_time_start_ = base::ThreadTicks::Now();
62 } else { 62 } else {
63 static bool logged_once = false; 63 static bool logged_once = false;
64 LOG_IF(WARNING, !logged_once) << "ThreadTicks not supported."; 64 LOG_IF(WARNING, !logged_once) << "ThreadTicks not supported.";
65 logged_once = true; 65 logged_once = true;
66 } 66 }
67 67
68 if (gpu_timing_client->IsAvailable()) { 68 if (gpu_timing_client->IsAvailable()) {
69 gpu_timer_ = gpu_timing_client->CreateGPUTimer(true); 69 gpu_timer_ = gpu_timing_client->CreateGPUTimer(true);
70 gpu_timer_->Start(); 70 gpu_timer_->Start();
71 } 71 }
72 } 72 }
73 73
74 void MeasurementTimers::Record() { 74 void MeasurementTimers::Record() {
75 wall_time_ = base::TraceTicks::Now() - wall_time_start_; 75 wall_time_ = base::TimeTicks::Now() - wall_time_start_;
76 if (base::ThreadTicks::IsSupported()) { 76 if (base::ThreadTicks::IsSupported()) {
77 cpu_time_ = base::ThreadTicks::Now() - cpu_time_start_; 77 cpu_time_ = base::ThreadTicks::Now() - cpu_time_start_;
78 } 78 }
79 if (gpu_timer_.get()) { 79 if (gpu_timer_.get()) {
80 gpu_timer_->End(); 80 gpu_timer_->End();
81 } 81 }
82 } 82 }
83 83
84 Measurement MeasurementTimers::GetAsMeasurement(const std::string& name) { 84 Measurement MeasurementTimers::GetAsMeasurement(const std::string& name) {
85 DCHECK_NE(base::TimeDelta(), 85 DCHECK_NE(base::TimeDelta(),
(...skipping 10 matching lines...) Expand all
96 base::TimeDelta::FromMicroseconds(gpu_time)); 96 base::TimeDelta::FromMicroseconds(gpu_time));
97 } 97 }
98 98
99 MeasurementTimers::~MeasurementTimers() { 99 MeasurementTimers::~MeasurementTimers() {
100 if (gpu_timer_.get()) { 100 if (gpu_timer_.get()) {
101 gpu_timer_->Destroy(true); 101 gpu_timer_->Destroy(true);
102 } 102 }
103 } 103 }
104 104
105 } // namespace gpu 105 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/perftests/measurements.h ('k') | ipc/ipc_message_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698