@@ -1304,7 +1304,8 @@ static int intel_pt_synth_branch_sample(struct intel_pt_queue *ptq)
13041304 sample .branch_stack = (struct branch_stack * )& dummy_bs ;
13051305 }
13061306
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 ;
13081309 if (sample .cyc_cnt ) {
13091310 sample .insn_cnt = ptq -> ipc_insn_cnt - ptq -> last_br_insn_cnt ;
13101311 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)
13661367 sample .stream_id = ptq -> pt -> instructions_id ;
13671368 sample .period = ptq -> state -> tot_insn_cnt - ptq -> last_insn_cnt ;
13681369
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 ;
13701372 if (sample .cyc_cnt ) {
13711373 sample .insn_cnt = ptq -> ipc_insn_cnt - ptq -> last_in_insn_cnt ;
13721374 ptq -> last_in_insn_cnt = ptq -> ipc_insn_cnt ;
@@ -1901,14 +1903,8 @@ static int intel_pt_sample(struct intel_pt_queue *ptq)
19011903
19021904 ptq -> have_sample = false;
19031905
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 ;
19121908
19131909 /*
19141910 * Do PEBS first to allow for the possibility that the PEBS timestamp
0 commit comments