Skip to content

Commit b00204f

Browse files
James-A-Clarkacmel
authored andcommitted
perf cs-etm: Tidy up auxtrace info header printing
cs_etm__print_auxtrace_info() is called twice in case there is an error somewhere in cs_etm__process_auxtrace_info(), but all the info is already available at the beginning so just print it there instead. Also use u64 and the already cast ptr variable to make it more consistent with the rest of the etm code. Signed-off-by: James Clark <[email protected]> Cc: Al Grant <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: John Garry <[email protected]> Cc: Leo Yan <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Mathieu Poirier <[email protected]> Cc: Mike Leach <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Suzuki Poulouse <[email protected]> Cc: Will Deacon <[email protected]> Cc: [email protected] Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent fe55ba1 commit b00204f

File tree

1 file changed

+10
-18
lines changed

1 file changed

+10
-18
lines changed

tools/perf/util/cs-etm.c

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2541,14 +2541,14 @@ static const char * const cs_etmv4_priv_fmts[] = {
25412541
};
25422542

25432543
static const char * const param_unk_fmt =
2544-
" Unknown parameter [%d] %llx\n";
2544+
" Unknown parameter [%d] %"PRIx64"\n";
25452545
static const char * const magic_unk_fmt =
2546-
" Magic number Unknown %llx\n";
2546+
" Magic number Unknown %"PRIx64"\n";
25472547

2548-
static int cs_etm__print_cpu_metadata_v0(__u64 *val, int *offset)
2548+
static int cs_etm__print_cpu_metadata_v0(u64 *val, int *offset)
25492549
{
25502550
int i = *offset, j, nr_params = 0, fmt_offset;
2551-
__u64 magic;
2551+
u64 magic;
25522552

25532553
/* check magic value */
25542554
magic = val[i + CS_ETM_MAGIC];
@@ -2580,10 +2580,10 @@ static int cs_etm__print_cpu_metadata_v0(__u64 *val, int *offset)
25802580
return 0;
25812581
}
25822582

2583-
static int cs_etm__print_cpu_metadata_v1(__u64 *val, int *offset)
2583+
static int cs_etm__print_cpu_metadata_v1(u64 *val, int *offset)
25842584
{
25852585
int i = *offset, j, total_params = 0;
2586-
__u64 magic;
2586+
u64 magic;
25872587

25882588
magic = val[i + CS_ETM_MAGIC];
25892589
/* total params to print is NR_PARAMS + common block size for v1 */
@@ -2619,7 +2619,7 @@ static int cs_etm__print_cpu_metadata_v1(__u64 *val, int *offset)
26192619
return 0;
26202620
}
26212621

2622-
static void cs_etm__print_auxtrace_info(__u64 *val, int num)
2622+
static void cs_etm__print_auxtrace_info(u64 *val, int num)
26232623
{
26242624
int i, cpu = 0, version, err;
26252625

@@ -2925,6 +2925,9 @@ int cs_etm__process_auxtrace_info(union perf_event *event,
29252925
pmu_type = (unsigned int) ((hdr[CS_PMU_TYPE_CPUS] >> 32) &
29262926
0xffffffff);
29272927

2928+
if (dump_trace)
2929+
cs_etm__print_auxtrace_info(ptr, num_cpu);
2930+
29282931
/*
29292932
* Create an RB tree for traceID-metadata tuple. Since the conversion
29302933
* has to be made for each packet that gets decoded, optimizing access
@@ -3074,10 +3077,6 @@ int cs_etm__process_auxtrace_info(union perf_event *event,
30743077
goto err_delete_thread;
30753078
}
30763079

3077-
if (dump_trace) {
3078-
cs_etm__print_auxtrace_info(auxtrace_info->priv, num_cpu);
3079-
}
3080-
30813080
err = cs_etm__synth_events(etm, session);
30823081
if (err)
30833082
goto err_delete_thread;
@@ -3113,12 +3112,5 @@ int cs_etm__process_auxtrace_info(union perf_event *event,
31133112
intlist__delete(traceid_list);
31143113
err_free_hdr:
31153114
zfree(&hdr);
3116-
/*
3117-
* At this point, as a minimum we have valid header. Dump the rest of
3118-
* the info section - the print routines will error out on structural
3119-
* issues.
3120-
*/
3121-
if (dump_trace)
3122-
cs_etm__print_auxtrace_info(auxtrace_info->priv, num_cpu);
31233115
return err;
31243116
}

0 commit comments

Comments
 (0)