summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Fernandes <joelaf@google.com>2017-06-06 12:20:29 -0700
committerJoel Fernandes <joelaf@google.com>2017-06-06 20:42:45 +0000
commit9351f72049a2bc65170afcf131008c8bd1710959 (patch)
treeae6f4ea047c325365dd08151a165367575a23acb
parent7258088ea589874770b6b47a1612d59429f16bab (diff)
downloadnative-9351f72049a2bc65170afcf131008c8bd1710959.tar.gz
atrace: setup saved_cmdlines_size and write only if available
Older kernels (bullhead etc) don't have saved_cmdlines_size, check and write only if available. Also make work on non-root by setting permissions in rc file (thanks John Reck for suggestion). Bug: 62375794 Change-Id: Iefffc3203afd092ffb6cf420a144b38844aaee39 Signed-off-by: Joel Fernandes <joelaf@google.com>
-rw-r--r--cmds/atrace/atrace.cpp5
-rw-r--r--cmds/atrace/atrace.rc4
2 files changed, 8 insertions, 1 deletions
diff --git a/cmds/atrace/atrace.cpp b/cmds/atrace/atrace.cpp
index 6f2159db23..8758516a4d 100644
--- a/cmds/atrace/atrace.cpp
+++ b/cmds/atrace/atrace.cpp
@@ -444,7 +444,10 @@ static bool setTraceBufferSizeKB(int size)
// Set the default size of cmdline hashtable
static bool setCmdlineSize()
{
- return writeStr(k_traceCmdlineSizePath, "8192");
+ if (fileExists(k_traceCmdlineSizePath)) {
+ return writeStr(k_traceCmdlineSizePath, "8192");
+ }
+ return true;
}
// Set the clock to the best available option while tracing. Use 'boot' if it's
diff --git a/cmds/atrace/atrace.rc b/cmds/atrace/atrace.rc
index cef41bebf4..5e9cef384b 100644
--- a/cmds/atrace/atrace.rc
+++ b/cmds/atrace/atrace.rc
@@ -15,6 +15,8 @@ on post-fs
chown root shell /sys/kernel/tracing/options/overwrite
chown root shell /sys/kernel/debug/tracing/options/print-tgid
chown root shell /sys/kernel/tracing/options/print-tgid
+ chown root shell /sys/kernel/debug/tracing/options/saved_cmdlines_size
+ chown root shell /sys/kernel/tracing/options/saved_cmdlines_size
chown root shell /sys/kernel/debug/tracing/events/sched/sched_switch/enable
chown root shell /sys/kernel/tracing/events/sched/sched_switch/enable
chown root shell /sys/kernel/debug/tracing/events/sched/sched_wakeup/enable
@@ -63,6 +65,8 @@ on post-fs
chmod 0664 /sys/kernel/tracing/options/overwrite
chmod 0664 /sys/kernel/debug/tracing/options/print-tgid
chmod 0664 /sys/kernel/tracing/options/print-tgid
+ chmod 0664 /sys/kernel/debug/tracing/options/saved_cmdlines_size
+ chmod 0664 /sys/kernel/tracing/options/saved_cmdlines_size
chmod 0664 /sys/kernel/debug/tracing/events/sched/sched_switch/enable
chmod 0664 /sys/kernel/tracing/events/sched/sched_switch/enable
chmod 0664 /sys/kernel/debug/tracing/events/sched/sched_wakeup/enable