From: Irina Tirdea <irina.tirdea@gmail.com>
To: mingo@redhat.com, acme@ghostprotocols.net,
a.p.zijlstra@chello.nl, rostedt@goodmis.org
Cc: paulus@samba.org, dsahern@gmail.com, namhyung.kim@lge.com,
linux-kernel@vger.kernel.org,
Irina Tirdea <irina.tirdea@intel.com>
Subject: [PATCH 2/4] perf stat: add compile-time option to disable --big-num
Date: Fri, 14 Sep 2012 01:07:41 +0300 [thread overview]
Message-ID: <1347574063-22521-3-git-send-email-irina.tirdea@intel.com> (raw)
In-Reply-To: <1347574063-22521-1-git-send-email-irina.tirdea@intel.com>
From: Irina Tirdea <irina.tirdea@intel.com>
In printf's format, ' is used to group the output with thousands' grouping
characters for decimal conversion. Bionic does not support ' for printf.
Add a compile-time option (NO_BIG_NUM) to disable the --big-num option from
perf stat.
Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
---
tools/perf/Makefile | 8 ++++++++
tools/perf/builtin-stat.c | 8 ++++++++
tools/perf/config/feature-tests.mak | 12 ++++++++++++
3 files changed, 28 insertions(+)
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 209774b..8daa781 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -768,6 +768,14 @@ else
endif
endif
+ifdef NO_BIG_NUM
+ BASIC_CFLAGS += -DNO_BIG_NUM
+else
+ ifneq ($(call try-cc,$(SOURCE_BIG_NUM),),y)
+ BASIC_CFLAGS += -DNO_BIG_NUM
+ endif
+endif
+
ifdef ASCIIDOC8
export ASCIIDOC8
endif
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index dab347d..ad8013e 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -188,7 +188,11 @@ static pid_t child_pid = -1;
static bool null_run = false;
static int detailed_run = 0;
static bool sync_run = false;
+#ifdef NO_BIG_NUM
+static bool big_num = false;
+#else
static bool big_num = true;
+#endif
static int big_num_opt = -1;
static const char *csv_sep = NULL;
static bool csv_output = false;
@@ -1075,12 +1079,14 @@ static const char * const stat_usage[] = {
NULL
};
+#ifndef NO_BIG_NUM
static int stat__set_big_num(const struct option *opt __maybe_unused,
const char *s __maybe_unused, int unset)
{
big_num_opt = unset ? 0 : 1;
return 0;
}
+#endif
static bool append_file;
@@ -1112,9 +1118,11 @@ static const struct option options[] = {
"detailed run - start a lot of events"),
OPT_BOOLEAN('S', "sync", &sync_run,
"call sync() before starting a run"),
+#ifndef NO_BIG_NUM
OPT_CALLBACK_NOOPT('B', "big-num", NULL, NULL,
"print large numbers with thousands\' separators",
stat__set_big_num),
+#endif
OPT_STRING('C', "cpu", &target.cpu_list, "cpu",
"list of cpus to monitor in system-wide"),
OPT_BOOLEAN('A', "no-aggr", &no_aggr,
diff --git a/tools/perf/config/feature-tests.mak b/tools/perf/config/feature-tests.mak
index 116690a..2e5fad7 100644
--- a/tools/perf/config/feature-tests.mak
+++ b/tools/perf/config/feature-tests.mak
@@ -193,3 +193,15 @@ int main(void)
}
endef
endif
+
+ifndef NO_BIG_NUM
+define SOURCE_BIG_NUM
+#include <stdio.h>
+
+int main(void)
+{
+ printf(\"%'\''.2f\", 1234567.89);
+ return 0;
+}
+endef
+endif
--
1.7.9.5
next prev parent reply other threads:[~2012-09-13 22:10 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-13 22:07 [PATCH 0/4] perf tools: runtime fixes for Android Irina Tirdea
2012-09-13 22:07 ` [PATCH 1/4] perf tools: remove sscanf extension %as Irina Tirdea
2012-09-14 1:54 ` Namhyung Kim
2012-09-19 3:20 ` Masami Hiramatsu
2012-09-20 19:13 ` Irina Tirdea
2012-09-20 20:37 ` [PATCH v2 1/1] " irina.tirdea
2012-09-21 15:29 ` Arnaldo Carvalho de Melo
2012-09-24 7:13 ` Masami Hiramatsu
2012-09-27 5:35 ` [tip:perf/core] " tip-bot for Irina Tirdea
2012-09-13 22:07 ` Irina Tirdea [this message]
2012-09-14 5:40 ` [PATCH 2/4] perf stat: add compile-time option to disable --big-num Ingo Molnar
2012-09-20 19:17 ` Irina Tirdea
2012-09-23 21:48 ` [PATCH v2 1/1] perf stat: implement --big-num grouping Irina Tirdea
2012-09-13 22:07 ` [PATCH 3/4] perf archive: remove -f from the rm command Irina Tirdea
2012-09-19 15:19 ` [tip:perf/core] perf archive: Remove " tip-bot for Irina Tirdea
2012-09-13 22:07 ` [PATCH 4/4] perf archive: make f the last parameter for tar Irina Tirdea
2012-09-19 15:20 ` [tip:perf/core] perf archive: Make 'f' " tip-bot for Irina Tirdea
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=1347574063-22521-3-git-send-email-irina.tirdea@intel.com \
--to=irina.tirdea@gmail.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@ghostprotocols.net \
--cc=dsahern@gmail.com \
--cc=irina.tirdea@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung.kim@lge.com \
--cc=paulus@samba.org \
--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
all inboxes | Powered by JetHome®