summaryrefslogtreecommitdiffstats
path: root/cmds
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2015-03-27 00:43:31 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-03-27 00:43:31 +0000
commitc1c024a50c9b1cfd2c74d507de60ad4a52ca9dbd (patch)
tree7810dff5dab9f22b39403583e52af6c87ceefe4e /cmds
parent7844220f657dce74a9b05b794f7f5e253eb256e8 (diff)
parent3e785e2ef93b068630d0ffb5178a5f38cc249a3d (diff)
downloadframeworks_native-c1c024a50c9b1cfd2c74d507de60ad4a52ca9dbd.zip
frameworks_native-c1c024a50c9b1cfd2c74d507de60ad4a52ca9dbd.tar.gz
frameworks_native-c1c024a50c9b1cfd2c74d507de60ad4a52ca9dbd.tar.bz2
am 3e785e2e: am 88c52865: am 0faebfb2: Merge "Add trace_event_clock_sync to atrace"
* commit '3e785e2ef93b068630d0ffb5178a5f38cc249a3d': Add trace_event_clock_sync to atrace
Diffstat (limited to 'cmds')
-rw-r--r--cmds/atrace/atrace.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/cmds/atrace/atrace.cpp b/cmds/atrace/atrace.cpp
index 8fd80cc..515d761 100644
--- a/cmds/atrace/atrace.cpp
+++ b/cmds/atrace/atrace.cpp
@@ -35,6 +35,7 @@
#include <cutils/properties.h>
#include <utils/String8.h>
+#include <utils/Timers.h>
#include <utils/Trace.h>
using namespace android;
@@ -192,6 +193,9 @@ static const char* k_tracingOnPath =
static const char* k_tracePath =
"/sys/kernel/debug/tracing/trace";
+static const char* k_traceMarkerPath =
+ "/sys/kernel/debug/tracing/trace_marker";
+
// Check whether a file exists.
static bool fileExists(const char* filename) {
return access(filename, F_OK) != -1;
@@ -254,6 +258,14 @@ static bool appendStr(const char* filename, const char* str)
return _writeStr(filename, str, O_APPEND|O_WRONLY);
}
+static void writeClockSyncMarker()
+{
+ char buffer[128];
+ float now_in_seconds = systemTime(CLOCK_MONOTONIC) / 1000000000.0f;
+ snprintf(buffer, 128, "trace_event_clock_sync: parent_ts=%f\n", now_in_seconds);
+ writeStr(k_traceMarkerPath, buffer);
+}
+
// Enable or disable a kernel option by writing a "1" or a "0" into a /sys
// file.
static bool setKernelOptionEnable(const char* filename, bool enable)
@@ -631,6 +643,7 @@ static bool startTrace()
// Disable tracing in the kernel.
static void stopTrace()
{
+ writeClockSyncMarker();
setTracingEnabled(false);
}