Skip to content

Commit 0b31ea6

Browse files
James-A-Clarkacmel
authored andcommitted
perf cs-etm: No-op refactor of synth opt usage
sample_branches and sample_instructions are already saved in the synth_opts struct. Other usages like synth_opts.last_branch don't save a value, so make this more consistent by always going through synth_opts and not saving duplicate values. Reviewed-by: Leo Yan <[email protected]> Signed-off-by: James Clark <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: John Garry <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Mathieu Poirier <[email protected]> Cc: Mike Leach <[email protected]> Cc: Namhyung Kim <[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 096972f commit 0b31ea6

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

tools/perf/util/cs-etm.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ struct cs_etm_auxtrace {
5050
u8 timeless_decoding;
5151
u8 snapshot_mode;
5252
u8 data_queued;
53-
u8 sample_branches;
54-
u8 sample_instructions;
5553

5654
int num_cpu;
5755
u64 latest_kernel_timestamp;
@@ -410,8 +408,8 @@ static void cs_etm__packet_swap(struct cs_etm_auxtrace *etm,
410408
{
411409
struct cs_etm_packet *tmp;
412410

413-
if (etm->sample_branches || etm->synth_opts.last_branch ||
414-
etm->sample_instructions) {
411+
if (etm->synth_opts.branches || etm->synth_opts.last_branch ||
412+
etm->synth_opts.instructions) {
415413
/*
416414
* Swap PACKET with PREV_PACKET: PACKET becomes PREV_PACKET for
417415
* the next incoming packet.
@@ -1365,7 +1363,6 @@ static int cs_etm__synth_events(struct cs_etm_auxtrace *etm,
13651363
err = cs_etm__synth_event(session, &attr, id);
13661364
if (err)
13671365
return err;
1368-
etm->sample_branches = true;
13691366
etm->branches_sample_type = attr.sample_type;
13701367
etm->branches_id = id;
13711368
id += 1;
@@ -1389,7 +1386,6 @@ static int cs_etm__synth_events(struct cs_etm_auxtrace *etm,
13891386
err = cs_etm__synth_event(session, &attr, id);
13901387
if (err)
13911388
return err;
1392-
etm->sample_instructions = true;
13931389
etm->instructions_sample_type = attr.sample_type;
13941390
etm->instructions_id = id;
13951391
id += 1;
@@ -1420,7 +1416,7 @@ static int cs_etm__sample(struct cs_etm_queue *etmq,
14201416
tidq->prev_packet->last_instr_taken_branch)
14211417
cs_etm__update_last_branch_rb(etmq, tidq);
14221418

1423-
if (etm->sample_instructions &&
1419+
if (etm->synth_opts.instructions &&
14241420
tidq->period_instructions >= etm->instructions_sample_period) {
14251421
/*
14261422
* Emit instruction sample periodically
@@ -1503,7 +1499,7 @@ static int cs_etm__sample(struct cs_etm_queue *etmq,
15031499
}
15041500
}
15051501

1506-
if (etm->sample_branches) {
1502+
if (etm->synth_opts.branches) {
15071503
bool generate_sample = false;
15081504

15091505
/* Generate sample for tracing on packet */
@@ -1582,7 +1578,7 @@ static int cs_etm__flush(struct cs_etm_queue *etmq,
15821578

15831579
}
15841580

1585-
if (etm->sample_branches &&
1581+
if (etm->synth_opts.branches &&
15861582
tidq->prev_packet->sample_type == CS_ETM_RANGE) {
15871583
err = cs_etm__synth_branch_sample(etmq, tidq);
15881584
if (err)

0 commit comments

Comments
 (0)