@@ -358,6 +358,8 @@ void tracecmd_free_hooks(struct hook_list *hooks);
/* --- Hack! --- */
int tracecmd_blk_hack(struct tracecmd_input *handle);
+/* --- Stack tracer functions --- */
+int tracecmd_stack_tracer_status(int *status);
/* --- Debugging --- */
struct kbuffer *tracecmd_record_kbuf(struct tracecmd_input *handle,
@@ -96,6 +96,12 @@ static int read_proc(int *status)
return 1; /* full success */
}
+/* Public wrapper of read_proc() */
+int tracecmd_stack_tracer_status(int *status)
+{
+ return read_proc(status);
+}
+
/* NOTE: this implementation only accepts new_status in the range [0..9]. */
static void change_stack_tracer_status(unsigned new_status)
{
@@ -893,6 +893,7 @@ void trace_stat (int argc, char **argv)
{
struct buffer_instance *instance = &top_instance;
int topt = 0;
+ int status;
int c;
for (;;) {
@@ -928,5 +929,12 @@ void trace_stat (int argc, char **argv)
stat_instance(instance);
}
+ if (tracecmd_stack_tracer_status(&status) >= 0) {
+ if (status > 0)
+ printf("Stack tracing is enabled\n\n");
+ } else {
+ printf("Error reading stack tracer status\n\n");
+ }
+
exit(0);
}
trace-cmd stat is a handy way for users to see what tracing is currently going on, but currently it does not say anything about the stack tracing. This patch makes the command to show a message when the stack tracer is ON. Signed-off-by: Vladislav Valtchev (VMware) <vladislav.valtchev@gmail.com> --- trace-cmd.h | 2 ++ trace-stack.c | 6 ++++++ trace-stat.c | 8 ++++++++ 3 files changed, 16 insertions(+)