@@ -913,7 +913,7 @@ static int grab_bb(u8 *buffer, u64 start, u64 end,
913
913
914
914
static int ip__fprintf_jump (uint64_t ip , struct branch_entry * en ,
915
915
struct perf_insn * x , u8 * inbuf , int len ,
916
- int insn , FILE * fp )
916
+ int insn , FILE * fp , int * total_cycles )
917
917
{
918
918
int printed = fprintf (fp , "\t%016" PRIx64 "\t%-30s\t#%s%s%s%s" , ip ,
919
919
dump_insn (x , ip , inbuf , len , NULL ),
@@ -922,7 +922,8 @@ static int ip__fprintf_jump(uint64_t ip, struct branch_entry *en,
922
922
en -> flags .in_tx ? " INTX" : "" ,
923
923
en -> flags .abort ? " ABORT" : "" );
924
924
if (en -> flags .cycles ) {
925
- printed += fprintf (fp , " %d cycles" , en -> flags .cycles );
925
+ * total_cycles += en -> flags .cycles ;
926
+ printed += fprintf (fp , " %d cycles [%d]" , en -> flags .cycles , * total_cycles );
926
927
if (insn )
927
928
printed += fprintf (fp , " %.2f IPC" , (float )insn / en -> flags .cycles );
928
929
}
@@ -979,6 +980,7 @@ static int perf_sample__fprintf_brstackinsn(struct perf_sample *sample,
979
980
u8 buffer [MAXBB ];
980
981
unsigned off ;
981
982
struct symbol * lastsym = NULL ;
983
+ int total_cycles = 0 ;
982
984
983
985
if (!(br && br -> nr ))
984
986
return 0 ;
@@ -999,7 +1001,7 @@ static int perf_sample__fprintf_brstackinsn(struct perf_sample *sample,
999
1001
printed += ip__fprintf_sym (br -> entries [nr - 1 ].from , thread ,
1000
1002
x .cpumode , x .cpu , & lastsym , attr , fp );
1001
1003
printed += ip__fprintf_jump (br -> entries [nr - 1 ].from , & br -> entries [nr - 1 ],
1002
- & x , buffer , len , 0 , fp );
1004
+ & x , buffer , len , 0 , fp , & total_cycles );
1003
1005
}
1004
1006
1005
1007
/* Print all blocks */
@@ -1027,7 +1029,8 @@ static int perf_sample__fprintf_brstackinsn(struct perf_sample *sample,
1027
1029
1028
1030
printed += ip__fprintf_sym (ip , thread , x .cpumode , x .cpu , & lastsym , attr , fp );
1029
1031
if (ip == end ) {
1030
- printed += ip__fprintf_jump (ip , & br -> entries [i ], & x , buffer + off , len - off , insn , fp );
1032
+ printed += ip__fprintf_jump (ip , & br -> entries [i ], & x , buffer + off , len - off , insn , fp ,
1033
+ & total_cycles );
1031
1034
break ;
1032
1035
} else {
1033
1036
printed += fprintf (fp , "\t%016" PRIx64 "\t%s\n" , ip ,
0 commit comments