@@ -1304,7 +1304,8 @@ static int intel_pt_synth_branch_sample(struct intel_pt_queue *ptq)
1304
1304
sample .branch_stack = (struct branch_stack * )& dummy_bs ;
1305
1305
}
1306
1306
1307
- sample .cyc_cnt = ptq -> ipc_cyc_cnt - ptq -> last_br_cyc_cnt ;
1307
+ if (ptq -> state -> flags & INTEL_PT_SAMPLE_IPC )
1308
+ sample .cyc_cnt = ptq -> ipc_cyc_cnt - ptq -> last_br_cyc_cnt ;
1308
1309
if (sample .cyc_cnt ) {
1309
1310
sample .insn_cnt = ptq -> ipc_insn_cnt - ptq -> last_br_insn_cnt ;
1310
1311
ptq -> last_br_insn_cnt = ptq -> ipc_insn_cnt ;
@@ -1366,7 +1367,8 @@ static int intel_pt_synth_instruction_sample(struct intel_pt_queue *ptq)
1366
1367
sample .stream_id = ptq -> pt -> instructions_id ;
1367
1368
sample .period = ptq -> state -> tot_insn_cnt - ptq -> last_insn_cnt ;
1368
1369
1369
- sample .cyc_cnt = ptq -> ipc_cyc_cnt - ptq -> last_in_cyc_cnt ;
1370
+ if (ptq -> state -> flags & INTEL_PT_SAMPLE_IPC )
1371
+ sample .cyc_cnt = ptq -> ipc_cyc_cnt - ptq -> last_in_cyc_cnt ;
1370
1372
if (sample .cyc_cnt ) {
1371
1373
sample .insn_cnt = ptq -> ipc_insn_cnt - ptq -> last_in_insn_cnt ;
1372
1374
ptq -> last_in_insn_cnt = ptq -> ipc_insn_cnt ;
@@ -1901,14 +1903,8 @@ static int intel_pt_sample(struct intel_pt_queue *ptq)
1901
1903
1902
1904
ptq -> have_sample = false;
1903
1905
1904
- if (ptq -> state -> tot_cyc_cnt > ptq -> ipc_cyc_cnt ) {
1905
- /*
1906
- * Cycle count and instruction count only go together to create
1907
- * a valid IPC ratio when the cycle count changes.
1908
- */
1909
- ptq -> ipc_insn_cnt = ptq -> state -> tot_insn_cnt ;
1910
- ptq -> ipc_cyc_cnt = ptq -> state -> tot_cyc_cnt ;
1911
- }
1906
+ ptq -> ipc_insn_cnt = ptq -> state -> tot_insn_cnt ;
1907
+ ptq -> ipc_cyc_cnt = ptq -> state -> tot_cyc_cnt ;
1912
1908
1913
1909
/*
1914
1910
* Do PEBS first to allow for the possibility that the PEBS timestamp
0 commit comments