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

Unified Diff: base/debug/trace_event_android.cc

Issue 12221047: Support JellyBean MR2 style of systrace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: For landing Created 7 years, 10 months 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
« no previous file with comments | « no previous file | base/debug/trace_event_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/debug/trace_event_android.cc
diff --git a/base/debug/trace_event_android.cc b/base/debug/trace_event_android.cc
index 29e684a659d6e17aa51f0087aae3860b16d4c206..2901a3427f22fdc815c0b5fa5c3d380a89c416ee 100644
--- a/base/debug/trace_event_android.cc
+++ b/base/debug/trace_event_android.cc
@@ -20,12 +20,21 @@ const char* kATraceMarkerFile = "/sys/kernel/debug/tracing/trace_marker";
namespace base {
namespace debug {
-// static
-void TraceLog::InitATrace() {
- DCHECK(g_atrace_fd == -1);
- g_atrace_fd = open(kATraceMarkerFile, O_WRONLY | O_APPEND);
- if (g_atrace_fd == -1)
- LOG(WARNING) << "Couldn't open " << kATraceMarkerFile;
+void TraceLog::StartATrace() {
+ AutoLock lock(lock_);
+ if (g_atrace_fd == -1) {
+ g_atrace_fd = open(kATraceMarkerFile, O_WRONLY);
+ if (g_atrace_fd == -1)
+ LOG(WARNING) << "Couldn't open " << kATraceMarkerFile;
+ }
+}
+
+void TraceLog::StopATrace() {
+ AutoLock lock(lock_);
+ if (g_atrace_fd != -1) {
+ close(g_atrace_fd);
+ g_atrace_fd = -1;
+ }
}
void TraceLog::SendToATrace(char phase,
@@ -91,6 +100,8 @@ void TraceLog::SendToATrace(char phase,
void TraceLog::ApplyATraceEnabledFlag(unsigned char* category_enabled) {
if (g_atrace_fd != -1)
*category_enabled |= ATRACE_ENABLED;
+ else
+ *category_enabled &= ~ATRACE_ENABLED;
}
} // namespace debug
« no previous file with comments | « no previous file | base/debug/trace_event_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698