[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1452021465-17831-1-git-send-email-andi@firstfloor.org>
Date: Tue, 5 Jan 2016 11:17:45 -0800
From: Andi Kleen <andi@...stfloor.org>
To: acme@...nel.org
Cc: jolsa@...nel.org, mingo@...nel.org, linux-kernel@...r.kernel.org,
Andi Kleen <ak@...ux.intel.com>
Subject: [PATCH] perf, tools, stat: Force C numeric locale for CSV mode
From: Andi Kleen <ak@...ux.intel.com>
Some locales print floating point numbers with a comma instead of a dot.
This causes problems with CSV mode because it causes extra false CSV
fields. Force the numeric locale to be always C in CSV mode.
Before:
$ LC_ALL=pl_PL.utf8 perf stat -x, true
0,399472,,task-clock,399472,100,00 <---- extra bogus field
...
After:
$ LC_ALL=pl_PL.utf8 ./obj-perf/perf stat -x, true
0.338422,,task-clock,338422,100.00
Originally reported in https://github.com/andikleen/pmu-tools/issues/43
Signed-off-by: Andi Kleen <ak@...ux.intel.com>
---
tools/perf/builtin-stat.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 9805e03..4d5e504 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -1826,6 +1826,7 @@ int cmd_stat(int argc, const char **argv, const char *prefix __maybe_unused)
csv_output = true;
if (!strcmp(csv_sep, "\\t"))
csv_sep = "\t";
+ setlocale(LC_NUMERIC, "C");
} else
csv_sep = DEFAULT_SEPARATOR;
--
2.4.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists