linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	Ingo Molnar <mingo@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2/resend] tracing: eliminate const char[] auto variables
Date: Mon, 18 Mar 2019 21:53:57 +0000	[thread overview]
Message-ID: <20190318215356.GJ2217@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20190318213427.22108-1-linux@rasmusvillemoes.dk>

On Mon, Mar 18, 2019 at 10:34:27PM +0100, Rasmus Villemoes wrote:

> I didn't get any response to this; just let me know if you don't want
> this kind of microoptimization patches.

Umm...  What's wrong with "%*s", width, "" instead of those games?
As in
{
        bool tgid = flags & TRACE_ITER_RECORD_TGID;
	int width = tgid ? 10 : 2;

        print_event_info(buf, m);

        seq_printf(m, "#                          %*s  _-----=> irqs-off\n",
		   width, "");
        seq_printf(m, "#                          %*s / _----=> need-resched\n",
		   width, "");
        seq_printf(m, "#                          %*s| / _---=> hardirq/softirq\n",
		   width, "");
        seq_printf(m, "#                          %*s|| / _--=> preempt-depth\n",
		   width, "");
        seq_printf(m, "#                          %*s||| /     delay\n",
		   width, "");
        seq_printf(m, "#           TASK-PID %*sCPU#  ||||    TIMESTAMP  FUNCTION\n",
		   width, tgid ? "TGID   " : "");
        seq_printf(m, "#              | |   %*s  |   ||||       |         |\n",
		   width, "");
}
and bugger those constants...

PS: it's very tempting to add some warlording to that piece of... ASCII art

  reply	other threads:[~2019-03-18 21:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-02 20:54 [PATCH] tracing: eliminate const char[] auto variables Rasmus Villemoes
2019-03-18 21:34 ` [PATCH v2/resend] " Rasmus Villemoes
2019-03-18 21:53   ` Al Viro [this message]
2019-03-19 16:39     ` Steven Rostedt
2019-03-20  8:17   ` [PATCH v3] " Rasmus Villemoes

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=20190318215356.GJ2217@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    /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).