Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

perf jevents: Support parsing negative exponents

Support negative exponents when parsing from a json metric string by
making the numbers after the 'e' optional in the 'Event' insertion fix
up.

Signed-off-by: Ian Rogers <irogers@google.com>
Tested-by: Thomas Falcon <thomas.falcon@intel.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>

authored by

Ian Rogers and committed by
Namhyung Kim
826650f7 e90c66c3

+5 -1
+1 -1
tools/perf/pmu-events/metric.py
··· 573 573 # a double by the Bison parser 574 574 py = re.sub(r'0Event\(r"[xX]([0-9a-fA-F]*)"\)', r'Event("0x\1")', py) 575 575 # Convert accidentally converted scientific notation constants back 576 - py = re.sub(r'([0-9]+)Event\(r"(e[0-9]+)"\)', r'\1\2', py) 576 + py = re.sub(r'([0-9]+)Event\(r"(e[0-9]*)"\)', r'\1\2', py) 577 577 # Convert all the known keywords back from events to just the keyword 578 578 keywords = ['if', 'else', 'min', 'max', 'd_ratio', 'source_count', 'has_event', 'strcmp_cpuid_str'] 579 579 for kw in keywords:
+4
tools/perf/pmu-events/metric_test.py
··· 61 61 after = before 62 62 self.assertEqual(ParsePerfJson(before).ToPerfJson(), after) 63 63 64 + before = r'a + 3e-12 + b' 65 + after = before 66 + self.assertEqual(ParsePerfJson(before).ToPerfJson(), after) 67 + 64 68 def test_IfElseTests(self): 65 69 # if-else needs rewriting to Select and back. 66 70 before = r'Event1 if #smt_on else Event2'