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

Unified Diff: content/browser/tracing/tracing_controller_impl.cc

Issue 109933006: Implement sampling profiler (chromium side change) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/tracing/tracing_controller_impl.cc
diff --git a/content/browser/tracing/tracing_controller_impl.cc b/content/browser/tracing/tracing_controller_impl.cc
index ead4cf24359b0ecc59d17b93a2aebcdb5cd5e291..8b4877eb95754f0af38c184627d01fdb32d02c9a 100644
--- a/content/browser/tracing/tracing_controller_impl.cc
+++ b/content/browser/tracing/tracing_controller_impl.cc
@@ -80,7 +80,7 @@ void TracingControllerImpl::ResultFile::OpenTask() {
void TracingControllerImpl::ResultFile::WriteTask(
const scoped_refptr<base::RefCountedString>& events_str_ptr) {
- if (!file_)
+ if (!file_ || !events_str_ptr->data().size())
return;
// If there is already a result in the file, then put a commma
@@ -173,7 +173,9 @@ bool TracingControllerImpl::EnableRecording(
// TODO(haraken): How to handle ENABLE_SYSTRACE?
TraceLog::GetInstance()->SetEnabled(
- base::debug::CategoryFilter(category_filter), trace_options);
+ base::debug::CategoryFilter(category_filter),
+ base::debug::TraceLog::RECORDING_MODE,
+ trace_options);
is_recording_ = true;
// Notify all child processes.
@@ -247,10 +249,11 @@ bool TracingControllerImpl::EnableMonitoring(
int monitoring_tracing_options = 0;
if (options & ENABLE_SAMPLING)
- monitoring_tracing_options |= base::debug::TraceLog::MONITOR_SAMPLING;
+ monitoring_tracing_options |= base::debug::TraceLog::ENABLE_SAMPLING;
TraceLog::GetInstance()->SetEnabled(
base::debug::CategoryFilter(category_filter),
+ base::debug::TraceLog::MONITORING_MODE,
static_cast<TraceLog::Options>(monitoring_tracing_options));
// Notify all child processes.
@@ -420,7 +423,7 @@ void TracingControllerImpl::AddTraceMessageFilter(
trace_message_filter->SendSetWatchEvent(watch_category_name_,
watch_event_name_);
}
- if (can_disable_recording()) {
+ if (can_disable_recording() || can_disable_monitoring()) {
trace_message_filter->SendBeginTracing(
TraceLog::GetInstance()->GetCurrentCategoryFilter().ToString(),
TraceLog::GetInstance()->trace_options());

Powered by Google App Engine
This is Rietveld 408576698