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

perf scripts python intel-pt-events: Delete unused 'event_attr variable

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.

Signed-off-by: Alexander Pantyukhin <apantykhin@gmail.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/20230114130533.2877-1-apantykhin@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Alexander Pantyukhin and committed by
Arnaldo Carvalho de Melo
984abd34 eab50517

+3 -3
+3 -3
tools/perf/scripts/python/intel-pt-events.py
··· 340 340 print(start_str, src_str) 341 341 342 342 def do_process_event(param_dict): 343 - event_attr = param_dict["attr"] 344 343 sample = param_dict["sample"] 345 344 raw_buf = param_dict["raw_buf"] 346 345 comm = param_dict["comm"] ··· 348 349 # callchain = param_dict["callchain"] 349 350 # brstack = param_dict["brstack"] 350 351 # brstacksym = param_dict["brstacksym"] 352 + # event_attr = param_dict["attr"] 351 353 352 354 # Symbol and dso info are not always resolved 353 355 dso = get_optional(param_dict, "dso") ··· 359 359 print(glb_switch_str[cpu]) 360 360 del glb_switch_str[cpu] 361 361 362 - if name[0:12] == "instructions": 362 + if name.startswith("instructions"): 363 363 if glb_src: 364 364 print_srccode(comm, param_dict, sample, symbol, dso, True) 365 365 else: 366 366 print_instructions_start(comm, sample) 367 367 print_common_ip(param_dict, sample, symbol, dso) 368 - elif name[0:8] == "branches": 368 + elif name.startswith("branches"): 369 369 if glb_src: 370 370 print_srccode(comm, param_dict, sample, symbol, dso, False) 371 371 else: