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

Side by Side Diff: content/browser/devtools/protocol/tracing_handler.cc

Issue 717083003: Report trace buffer usage as number of events, not only percentage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/browser/devtools/protocol/tracing_handler.h" 5 #include "content/browser/devtools/protocol/tracing_handler.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/debug/trace_event_impl.h" 10 #include "base/debug/trace_event_impl.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 weak_factory_.GetWeakPtr(), 135 weak_factory_.GetWeakPtr(),
136 command)); 136 command));
137 return command->AsyncResponsePromise(); 137 return command->AsyncResponsePromise();
138 } 138 }
139 139
140 void TracingHandler::OnRecordingEnabled( 140 void TracingHandler::OnRecordingEnabled(
141 scoped_refptr<DevToolsProtocol::Command> command) { 141 scoped_refptr<DevToolsProtocol::Command> command) {
142 client_->SendStartResponse(command, StartResponse::Create()); 142 client_->SendStartResponse(command, StartResponse::Create());
143 } 143 }
144 144
145 void TracingHandler::OnBufferUsage(float usage) { 145 void TracingHandler::OnBufferUsage(float usage, size_t buffer_usage) {
146 client_->BufferUsage(BufferUsageParams::Create()->set_value(usage)); 146 client_->BufferUsage(
147 BufferUsageParams::Create()->set_value(usage)->set_event_count(
148 buffer_usage));
147 } 149 }
148 150
149 void TracingHandler::OnCategoriesReceived( 151 void TracingHandler::OnCategoriesReceived(
150 scoped_refptr<DevToolsProtocol::Command> command, 152 scoped_refptr<DevToolsProtocol::Command> command,
151 const std::set<std::string>& category_set) { 153 const std::set<std::string>& category_set) {
152 std::vector<std::string> categories; 154 std::vector<std::string> categories;
153 for (const std::string& category : category_set) 155 for (const std::string& category : category_set)
154 categories.push_back(category); 156 categories.push_back(category);
155 client_->SendGetCategoriesResponse(command, 157 client_->SendGetCategoriesResponse(command,
156 GetCategoriesResponse::Create()->set_categories(categories)); 158 GetCategoriesResponse::Create()->set_categories(categories));
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 void TracingHandler::DisableRecording(bool abort) { 205 void TracingHandler::DisableRecording(bool abort) {
204 is_recording_ = false; 206 is_recording_ = false;
205 buffer_usage_poll_timer_.reset(); 207 buffer_usage_poll_timer_.reset();
206 TracingController::GetInstance()->DisableRecording( 208 TracingController::GetInstance()->DisableRecording(
207 abort ? nullptr : new DevToolsTraceSinkProxy(weak_factory_.GetWeakPtr())); 209 abort ? nullptr : new DevToolsTraceSinkProxy(weak_factory_.GetWeakPtr()));
208 } 210 }
209 211
210 } // namespace tracing 212 } // namespace tracing
211 } // namespace devtools 213 } // namespace devtools
212 } // namespace content 214 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698