linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: "Vladislav Valtchev (VMware)" <vladislav.valtchev@gmail.com>
Cc: y.karadz@gmail.com, linux-trace-devel@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 3/3] trace-cmd: Making stat to report when the stack tracer is ON
Date: Fri, 12 Jan 2018 10:47:28 -0500	[thread overview]
Message-ID: <20180112104728.2f7d93b1@gandalf.local.home> (raw)
In-Reply-To: <20171221152520.25867-4-vladislav.valtchev@gmail.com>

On Thu, 21 Dec 2017 17:25:20 +0200
"Vladislav Valtchev (VMware)" <vladislav.valtchev@gmail.com> wrote:

> 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(+)
> 
> diff --git a/trace-cmd.h b/trace-cmd.h
> index 6fd34d7..9704b2e 100644
> --- a/trace-cmd.h
> +++ b/trace-cmd.h
> @@ -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,
> diff --git a/trace-stack.c b/trace-stack.c
> index d55d994..0028ecc 100644
> --- a/trace-stack.c
> +++ b/trace-stack.c
> @@ -107,6 +107,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(int new_status)
>  {
> diff --git a/trace-stat.c b/trace-stat.c
> index fd16354..61dd41f 100644
> --- a/trace-stat.c
> +++ b/trace-stat.c
> @@ -894,6 +894,7 @@ void trace_stat (int argc, char **argv)
>  	struct buffer_instance *instance = &top_instance;
>  	int topt = 0;
>  	int c;
> +	int stack_tracer_status;

Needs to be upside down x-mas tree. (can't you feel the season?) ;-)

Not to mention, it's an awfully verbose variable name. Just call it
"status".

>  
>  	for (;;) {
>  		c = getopt(argc-1, argv+1, "tB:");
> @@ -928,5 +929,12 @@ void trace_stat (int argc, char **argv)
>  		stat_instance(instance);
>  	}
>  
> +	if (tracecmd_stack_tracer_status(&stack_tracer_status) >= 0) {
> +		if (stack_tracer_status > 0)
> +			printf("Stack tracing is enabled\n\n");
> +	} else {
> +		printf("The status of the stack tracer is indeterminate\n\n");

I wonder if we should report saying there was an error?

	printf("Error reading stack tracer status\n");

-- Steve

> +	}
> +
>  	exit(0);
>  }

      reply	other threads:[~2018-01-12 15:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-21 15:25 [PATCH v2 0/3] trace-cmd: Integrate stack tracer status in 'stat' Vladislav Valtchev (VMware)
2017-12-21 15:25 ` [PATCH v2 1/3] trace-cmd: Make read_proc() to return int status via OUT arg Vladislav Valtchev (VMware)
2018-01-12 15:13   ` Steven Rostedt
2018-01-16 14:47     ` Vladislav Valtchev
2018-01-16 16:27       ` Steven Rostedt
2018-01-16 18:49         ` Vladislav Valtchev
2018-01-16 19:34           ` Steven Rostedt
2017-12-21 15:25 ` [PATCH v2 2/3] trace-cmd: Remove the die() call from read_proc() Vladislav Valtchev (VMware)
2018-01-12 15:43   ` Steven Rostedt
2018-01-16 15:04     ` Vladislav Valtchev
2017-12-21 15:25 ` [PATCH v2 3/3] trace-cmd: Making stat to report when the stack tracer is ON Vladislav Valtchev (VMware)
2018-01-12 15:47   ` Steven Rostedt [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180112104728.2f7d93b1@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=vladislav.valtchev@gmail.com \
    --cc=y.karadz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).