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

perf db-export: Add trace begin / end branch type variants

Add branch types to cover different combinations with "trace begin" or
"trace end".

Previously, the Intel PT decoder would indicate begin / end by a branch
from / to zero. That hides useful information, in particular when a
trace ends with a call. Before remedying that, prepare the database
export to export branch types with more combinations that include trace
begin / end. In those cases extend the descriptions to include 'trace
begin' and 'trace end' separately.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/20180920130048.31432-3-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Adrian Hunter and committed by
Arnaldo Carvalho de Melo
ff645daf 62cb1b88

+22
+22
tools/perf/util/db-export.c
··· 463 463 if (err) 464 464 break; 465 465 } 466 + 467 + /* Add trace begin / end variants */ 468 + for (i = 0; branch_types[i].name ; i++) { 469 + const char *name = branch_types[i].name; 470 + u32 type = branch_types[i].branch_type; 471 + char buf[64]; 472 + 473 + if (type == PERF_IP_FLAG_BRANCH || 474 + (type & (PERF_IP_FLAG_TRACE_BEGIN | PERF_IP_FLAG_TRACE_END))) 475 + continue; 476 + 477 + snprintf(buf, sizeof(buf), "trace begin / %s", name); 478 + err = db_export__branch_type(dbe, type | PERF_IP_FLAG_TRACE_BEGIN, buf); 479 + if (err) 480 + break; 481 + 482 + snprintf(buf, sizeof(buf), "%s / trace end", name); 483 + err = db_export__branch_type(dbe, type | PERF_IP_FLAG_TRACE_END, buf); 484 + if (err) 485 + break; 486 + } 487 + 466 488 return err; 467 489 } 468 490