Messages in this thread | | | Subject | Re: [PATCH v4 5/5] perf report: Show branch type in callchain entry | From | "Jin, Yao" <> | Date | Wed, 19 Apr 2017 08:32:27 +0800 |
| |
On 4/19/2017 2:53 AM, Jiri Olsa wrote: > On Wed, Apr 12, 2017 at 06:21:06AM +0800, Jin Yao wrote: > > SNIP > >> static int counts_str_build(char *bf, int bfsize, >> u64 branch_count, u64 predicted_count, >> u64 abort_count, u64 cycles_count, >> - u64 iter_count, u64 samples_count) >> + u64 iter_count, u64 samples_count, >> + struct branch_type_stat *brtype_stat) >> { >> - double predicted_percent = 0.0; >> - const char *null_str = ""; >> - char iter_str[32]; >> - char cycle_str[32]; >> - char *istr, *cstr; >> u64 cycles; >> + int printed, i = 0; >> >> if (branch_count == 0) >> return scnprintf(bf, bfsize, " (calltrace)"); >> >> + printed = branch_type_str(brtype_stat, bf, bfsize); >> + if (printed) >> + i++; >> + >> cycles = cycles_count / branch_count; >> + if (cycles) { >> + if (i++) >> + printed += scnprintf(bf + printed, bfsize - printed, >> + " cycles:%" PRId64 "", cycles); >> + else >> + printed += scnprintf(bf + printed, bfsize - printed, >> + " (cycles:%" PRId64 "", cycles); >> + } >> >> if (iter_count && samples_count) { >> - if (cycles > 0) >> - scnprintf(iter_str, sizeof(iter_str), >> - " iterations:%" PRId64 "", >> - iter_count / samples_count); >> + if (i++) >> + printed += scnprintf(bf + printed, bfsize - printed, >> + " iterations:%" PRId64 "", >> + iter_count / samples_count); >> else >> - scnprintf(iter_str, sizeof(iter_str), >> - "iterations:%" PRId64 "", >> - iter_count / samples_count); >> - istr = iter_str; > could you please put the change from using iter_str > to bf into separate patch before the actual branch > display change? > > it's hard to see if anything is broken ;-) > > thanks, > jirka Got it, I will separate the patches.
Thanks Jin Yao
| |