All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Arnaldo Carvalho de Melo <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: mingo@kernel.org, tglx@linutronix.de, namhyung@kernel.org,
	adrian.hunter@intel.com, dsahern@gmail.com, wangnan0@huawei.com,
	acme@redhat.com, linux-kernel@vger.kernel.org, jolsa@kernel.org,
	hpa@zytor.com
Subject: [tip:perf/core] perf evsel: Allow passing a left alignment when printing a symbol
Date: Wed, 13 Apr 2016 00:23:36 -0700	[thread overview]
Message-ID: <tip-uk9ekchd67651c625ltaur5y@git.kernel.org> (raw)

Commit-ID:  db3617f362d7e205621c1ccc22b77d224a81ee14
Gitweb:     http://git.kernel.org/tip/db3617f362d7e205621c1ccc22b77d224a81ee14
Author:     Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Mon, 11 Apr 2016 10:53:51 -0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 11 Apr 2016 22:18:15 -0300

perf evsel: Allow passing a left alignment when printing a symbol

For callchains, etc where we want it to align just below the syscall
name, for instance, in 'perf trace'

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-uk9ekchd67651c625ltaur5y@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-script.c | 4 ++--
 tools/perf/util/session.c   | 6 +++++-
 tools/perf/util/session.h   | 2 +-
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index dbf208f..60fde9f 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -579,7 +579,7 @@ static void print_sample_bts(struct perf_sample *sample,
 				print_opts &= ~PRINT_IP_OPT_SRCLINE;
 			}
 		}
-		perf_evsel__print_ip(evsel, sample, al, print_opts,
+		perf_evsel__print_ip(evsel, sample, al, 0, print_opts,
 				     scripting_max_stack, stdout);
 	}
 
@@ -788,7 +788,7 @@ static void process_event(struct perf_script *script,
 		else
 			printf("\n");
 
-		perf_evsel__print_ip(evsel, sample, al,
+		perf_evsel__print_ip(evsel, sample, al, 0,
 				     output[attr->type].print_ip_opts,
 				     scripting_max_stack, stdout);
 	}
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index bbac0ef..62b6d40 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -1954,7 +1954,7 @@ struct perf_evsel *perf_session__find_first_evtype(struct perf_session *session,
 }
 
 void perf_evsel__print_ip(struct perf_evsel *evsel, struct perf_sample *sample,
-			  struct addr_location *al,
+			  struct addr_location *al, int left_alignment,
 			  unsigned int print_opts, unsigned int stack_depth,
 			  FILE *fp)
 {
@@ -1992,6 +1992,8 @@ void perf_evsel__print_ip(struct perf_evsel *evsel, struct perf_sample *sample,
 			if (node->sym && node->sym->ignore)
 				goto next;
 
+			fprintf(fp, "%-*.*s", left_alignment, left_alignment, " ");
+
 			if (print_ip)
 				fprintf(fp, "%c%16" PRIx64, s, node->ip);
 
@@ -2032,6 +2034,8 @@ next:
 		if (al->sym && al->sym->ignore)
 			return;
 
+		fprintf(fp, "%-*.*s", left_alignment, left_alignment, " ");
+
 		if (print_ip)
 			fprintf(fp, "%16" PRIx64, sample->ip);
 
diff --git a/tools/perf/util/session.h b/tools/perf/util/session.h
index 0ee3d9d..a6bc4dd 100644
--- a/tools/perf/util/session.h
+++ b/tools/perf/util/session.h
@@ -105,7 +105,7 @@ struct perf_evsel *perf_session__find_first_evtype(struct perf_session *session,
 					    unsigned int type);
 
 void perf_evsel__print_ip(struct perf_evsel *evsel, struct perf_sample *sample,
-			  struct addr_location *al,
+			  struct addr_location *al, int left_alignment,
 			  unsigned int print_opts, unsigned int stack_depth,
 			  FILE *fp);
 

                 reply	other threads:[~2016-04-13  7:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=tip-uk9ekchd67651c625ltaur5y@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=acme@redhat.com \
    --cc=adrian.hunter@intel.com \
    --cc=dsahern@gmail.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=wangnan0@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.