The 'event_attr' is never used later, the var is ok be deleted. Additional code simplification is to substitute string slice comparison with "substring" function. This case no need to know the length specific words.
Showing the changes to tools/perf/scripts/python (1 of 1 file). Show all
Unified · Split
| @@ -340,7 +340,6 @@ def print_srccode(comm, param_dict, sample, symbol, dso, with_insn): · 339 unmodified lines | |||
| 340 | print(start_str, src_str) | 340 | print(start_str, src_str) |
| 341 | 341 | ||
| 342 | def do_process_event(param_dict): | 342 | def do_process_event(param_dict): |
| 343 | event_attr = param_dict["attr"] | ||
| 344 | sample = param_dict["sample"] | 343 | sample = param_dict["sample"] |
| 345 | raw_buf = param_dict["raw_buf"] | 344 | raw_buf = param_dict["raw_buf"] |
| 346 | comm = param_dict["comm"] | 345 | comm = param_dict["comm"] |
| @@ -349,6 +348,7 @@ def do_process_event(param_dict): · 2 unmodified lines | |||
| 349 | # callchain = param_dict["callchain"] | 348 | # callchain = param_dict["callchain"] |
| 350 | # brstack = param_dict["brstack"] | 349 | # brstack = param_dict["brstack"] |
| 351 | # brstacksym = param_dict["brstacksym"] | 350 | # brstacksym = param_dict["brstacksym"] |
| 351 | # event_attr = param_dict["attr"] | ||
| 352 | 352 | ||
| 353 | # Symbol and dso info are not always resolved | 353 | # Symbol and dso info are not always resolved |
| 354 | dso = get_optional(param_dict, "dso") | 354 | dso = get_optional(param_dict, "dso") |
| @@ -359,13 +359,13 @@ def do_process_event(param_dict): · 4 unmodified lines | |||
| 359 | print(glb_switch_str[cpu]) | 359 | print(glb_switch_str[cpu]) |
| 360 | del glb_switch_str[cpu] | 360 | del glb_switch_str[cpu] |
| 361 | 361 | ||
| 362 | if name[0:12] == "instructions": | 362 | if name.startswith("instructions"): |
| 363 | if glb_src: | 363 | if glb_src: |
| 364 | print_srccode(comm, param_dict, sample, symbol, dso, True) | 364 | print_srccode(comm, param_dict, sample, symbol, dso, True) |
| 365 | else: | 365 | else: |
| 366 | print_instructions_start(comm, sample) | 366 | print_instructions_start(comm, sample) |
| 367 | print_common_ip(param_dict, sample, symbol, dso) | 367 | print_common_ip(param_dict, sample, symbol, dso) |
| 368 | elif name[0:8] == "branches": | 368 | elif name.startswith("branches"): |
| 369 | if glb_src: | 369 | if glb_src: |
| 370 | print_srccode(comm, param_dict, sample, symbol, dso, False) | 370 | print_srccode(comm, param_dict, sample, symbol, dso, False) |
| 371 | else: | 371 | else: |