[Interpreter] Support Linux perf >= 4.1 in linux_perf_report.py.

Since Linux 4.1, flag -f became -F, but the long option --flags stayed
the same. Using --flags assures compatibility with new and old versions.

Also, symbols appear to be reported as name+offset in newer versions
even when not requested, so we trim the latter part if present.

BUG=v8:4899
LOG=N

Review-Url: https://codereview.chromium.org/2134703002
Cr-Commit-Position: refs/heads/master@{#37614}
This commit is contained in:
ssanfilippo 2016-07-08 09:24:04 -07:00 committed by Commit bot
parent 120b753f71
commit c9fedd252c

View File

@ -97,7 +97,8 @@ def collapsed_callchains_generator(perf_stream, show_all=False,
if skip_until_end_of_chain:
continue
symbol = line.split(" ", 1)[1]
# Trim the leading address and the trailing +offset, if present.
symbol = line.split(" ", 1)[1].split("+", 1)[0]
if not show_full_signatures:
symbol = strip_function_parameters(symbol)
current_chain.append(symbol)
@ -204,7 +205,7 @@ def parse_command_line():
def main():
program_options = parse_command_line()
perf = subprocess.Popen(["perf", "script", "-f", "ip,sym",
perf = subprocess.Popen(["perf", "script", "--fields", "ip,sym",
"-i", program_options.perf_filename],
stdout=subprocess.PIPE)