From: Andi Kleen <andi@firstfloor.org>
To: jolsa@redhat.com
Cc: acme@infradead.org, linux-kernel@vger.kernel.org,
namhyung@kernel.org, Andi Kleen <ak@linux.intel.com>
Subject: [PATCH 03/10] fixup! perf, tools: Add support for text descriptions of events and alias add
Date: Wed, 16 Apr 2014 11:49:25 -0700 [thread overview]
Message-ID: <1397674172-30959-3-git-send-email-andi@firstfloor.org> (raw)
In-Reply-To: <1397674172-30959-1-git-send-email-andi@firstfloor.org>
From: Andi Kleen <ak@linux.intel.com>
---
tools/perf/util/pmu.c | 48 ++++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 44 insertions(+), 4 deletions(-)
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index cc888d9..26311d9 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -737,11 +737,51 @@ static char *format_alias_or(char *buf, int len, struct perf_pmu *pmu,
return buf;
}
-static int cmp_string(const void *a, const void *b)
+struct pair {
+ char *name;
+ char *desc;
+};
+
+static int cmp_pair(const void *a, const void *b)
+{
+ const struct pair *as = a;
+ const struct pair *bs = b;
+
+ /* Put downloaded event list last */
+ if (!!as->desc != !!bs->desc)
+ return !!as->desc - !!bs->desc;
+ return strcmp(as->name, bs->name);
+}
+
+static void wordwrap(char *s, int start, int max, int corr)
+{
+ int column = start;
+ int n;
+
+ while (*s) {
+ int wlen = strcspn(s, " \t");
+
+ if (column + wlen >= max && column > start) {
+ printf("\n%*s", start, "");
+ column = start + corr;
+ }
+ n = printf("%s%.*s", column > start ? " " : "", wlen, s);
+ if (n <= 0)
+ break;
+ s += wlen;
+ column += n;
+ while (isspace(*s))
+ s++;
+ }
+}
+
+static int get_columns(void)
{
- const char * const *as = a;
- const char * const *bs = b;
- return strcmp(*as, *bs);
+ /*
+ * Should ask the terminal with TIOCGWINSZ here, but we
+ * need the original fd before the pager.
+ */
+ return 79;
}
void print_pmu_events(const char *event_glob, bool name_only)
--
1.8.5.3
next prev parent reply other threads:[~2014-04-16 18:49 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-16 18:49 [PATCH 01/10] perf, tools: Add jsmn `jasmine' JSON parser Andi Kleen
2014-04-16 18:49 ` [PATCH 02/10] perf, tools: Add support for text descriptions of events and alias add Andi Kleen
2014-04-16 18:49 ` Andi Kleen [this message]
2014-04-16 18:49 ` [PATCH 04/10] perf, tools: Add support for reading JSON event files Andi Kleen
2014-04-16 18:49 ` [PATCH 05/10] perf, tools: Automatically look for event file name for cpu v2 Andi Kleen
2014-04-16 18:49 ` [PATCH 06/10] perf, tools: Add perf download to download event files v2 Andi Kleen
2014-04-16 18:49 ` [PATCH 07/10] perf, tools: Allow events with dot Andi Kleen
2014-04-16 18:49 ` [PATCH 08/10] perf, tools: Query terminal width and use in perf list Andi Kleen
2014-04-16 18:49 ` [PATCH 09/10] perf, tools, test: Add test case for alias and JSON parsing Andi Kleen
2014-04-16 18:49 ` [PATCH 10/10] perf, tools, record: Always allow to overide default period v2 Andi Kleen
2014-04-25 13:17 ` [PATCH 01/10] perf, tools: Add jsmn `jasmine' JSON parser Jiri Olsa
2014-04-25 15:07 ` Andi Kleen
-- strict thread matches above, loose matches on Subject: below --
2014-03-14 21:31 perf: Add support for full Intel event lists v2 Andi Kleen
2014-03-14 21:31 ` [PATCH 03/10] fixup! perf, tools: Add support for text descriptions of events and alias add Andi Kleen
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=1397674172-30959-3-git-send-email-andi@firstfloor.org \
--to=andi@firstfloor.org \
--cc=acme@infradead.org \
--cc=ak@linux.intel.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=namhyung@kernel.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
Powered by JetHome