Skip to content

Commit

Permalink
Fix native traces to appear in systrace.py
Browse files Browse the repository at this point in the history
Previously traces from the native side would only get included if the
callsite had not previously cached the category enabled result. (e.g.
worked well if tracing enabled prior to app launch, but not for apps
that had been running a while).

BUG=

Review URL: https://chromiumcodereview.appspot.com/14940015

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@199862 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
joth@chromium.org committed May 14, 2013
1 parent 5b0414f commit b3e057f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 5 additions & 1 deletion base/debug/trace_event_android.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,11 @@ void TraceLog::StartATrace() {
AutoLock lock(lock_);
if (g_atrace_fd == -1) {
g_atrace_fd = open(kATraceMarkerFile, O_WRONLY);
if (g_atrace_fd == -1)
if (g_atrace_fd == -1) {
LOG(WARNING) << "Couldn't open " << kATraceMarkerFile;
} else {
EnableIncludedCategoryGroups();
}
}
}

Expand All @@ -77,6 +80,7 @@ void TraceLog::StopATrace() {
if (g_atrace_fd != -1) {
close(g_atrace_fd);
g_atrace_fd = -1;
EnableIncludedCategoryGroups();
}
}

Expand Down
7 changes: 4 additions & 3 deletions base/debug/trace_event_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,10 @@ void TraceLog::EnableIncludedCategoryGroup(int category_index) {
g_category_groups[category_index]);
g_category_group_enabled[category_index] =
is_enabled ? TraceLog::CATEGORY_ENABLED : 0;

#if defined(OS_ANDROID)
ApplyATraceEnabledFlag(&g_category_group_enabled[category_index]);
#endif
}

void TraceLog::EnableIncludedCategoryGroups() {
Expand Down Expand Up @@ -880,9 +884,6 @@ const unsigned char* TraceLog::GetCategoryGroupEnabledInternal(
&g_category_group_enabled[g_category_categories_exhausted];
}
}
#if defined(OS_ANDROID)
ApplyATraceEnabledFlag(category_group_enabled);
#endif
return category_group_enabled;
}

Expand Down

0 comments on commit b3e057f

Please sign in to comment.