Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1625756
| Path | csiph.com!news.redatomik.org!aioe.org!news.servidellagleba.it!bofh.it!news.nic.it!robomod |
|---|---|
| From | "Jin, Yao" <yao.jin@linux.intel.com> |
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v4 5/5] perf report: Show branch type in callchain entry |
| Date | Wed, 19 Apr 2017 02:40:02 +0200 |
| Message-ID | <txLP4-4F9-7@gated-at.bofh.it> (permalink) |
| References | <tv4XU-8aE-5@gated-at.bofh.it> <tv4XV-8aE-35@gated-at.bofh.it> <txGw3-1bd-23@gated-at.bofh.it> |
| X-Extloop1 | 1 |
| X-Ironport-Av | E=Sophos;i="5.37,219,1488873600"; d="scan'208";a="91469869" |
| User-Agent | Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.0 |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Content-Language | en-US |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 59 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | acme@kernel.org, jolsa@kernel.org, peterz@infradead.org, mingo@redhat.com, alexander.shishkin@linux.intel.com, Linux-kernel@vger.kernel.org, ak@linux.intel.com, kan.liang@intel.com, yao.jin@intel.com, linuxppc-dev@lists.ozlabs.org |
| X-Original-Date | Wed, 19 Apr 2017 08:33:56 +0800 |
| X-Original-Message-ID | <c26d35d6-cfa9-3735-363c-05e5be981082@linux.intel.com> |
| X-Original-References | <1491949266-6835-1-git-send-email-yao.jin@linux.intel.com> <1491949266-6835-6-git-send-email-yao.jin@linux.intel.com> <20170418185314.GA15584@krava> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1625756 |
Show key headers only | View raw
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 branch_type_str(struct branch_type_stat *stat,
>> + char *bf, int bfsize)
>> +{
>> + int i, j = 0, printed = 0;
>> + u64 total = 0;
>> +
>> + for (i = 0; i < PERF_BR_MAX; i++)
>> + total += stat->counts[i];
>> +
>> + if (total == 0)
>> + return 0;
>> +
>> + printed += scnprintf(bf + printed, bfsize - printed, " (");
>> +
>> + if (stat->jcc_fwd > 0) {
>> + j++;
>> + printed += scnprintf(bf + printed, bfsize - printed,
>> + "JCC forward");
>> + }
>> +
>> + if (stat->jcc_bwd > 0) {
>> + if (j++)
>> + printed += scnprintf(bf + printed, bfsize - printed,
>> + " JCC backward");
>> + else
>> + printed += scnprintf(bf + printed, bfsize - printed,
>> + "JCC backward");
>> + }
>> +
>> + if (stat->cross_4k > 0) {
>> + if (j++)
>> + printed += scnprintf(bf + printed, bfsize - printed,
>> + " CROSS_4K");
>> + else
>> + printed += scnprintf(bf + printed, bfsize - printed,
>> + "CROSS_4K");
>> + }
> could that 2 legs if be shortened to just one scnprintf like (untested):
>
> printed += scnprintf(bf + printed, bfsize - printed, "%s%s", j++ ? " " : "", "CROSS_4K");
>
> I'd also probably use some kind of macro or function
> with all that similar code, but I dont insist ;-)
>
> thanks,
> jirka
Thanks for this suggestion. I will use this kind of code. Of course, I
will test. :)
Thanks
Jin Yao
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v4 0/5] perf report: Show branch type Jin Yao <yao.jin@linux.intel.com> - 2017-04-11 16:30 +0200
[PATCH v4 2/5] perf/x86/intel: Record branch type Jin Yao <yao.jin@linux.intel.com> - 2017-04-11 16:30 +0200
[PATCH v4 1/5] perf/core: Define the common branch type classification Jin Yao <yao.jin@linux.intel.com> - 2017-04-11 16:30 +0200
[PATCH v4 5/5] perf report: Show branch type in callchain entry Jin Yao <yao.jin@linux.intel.com> - 2017-04-11 16:30 +0200
Re: [PATCH v4 5/5] perf report: Show branch type in callchain entry Jiri Olsa <jolsa@redhat.com> - 2017-04-18 21:00 +0200
Re: [PATCH v4 5/5] perf report: Show branch type in callchain entry "Jin, Yao" <yao.jin@linux.intel.com> - 2017-04-19 02:40 +0200
Re: [PATCH v4 5/5] perf report: Show branch type in callchain entry Jiri Olsa <jolsa@redhat.com> - 2017-04-18 21:00 +0200
Re: [PATCH v4 5/5] perf report: Show branch type in callchain entry "Jin, Yao" <yao.jin@linux.intel.com> - 2017-04-19 02:40 +0200
Re: [PATCH v4 0/5] perf report: Show branch type Jiri Olsa <jolsa@redhat.com> - 2017-04-12 13:00 +0200
Re: [PATCH v4 0/5] perf report: Show branch type "Jin, Yao" <yao.jin@linux.intel.com> - 2017-04-12 14:30 +0200
Re: [PATCH v4 0/5] perf report: Show branch type Jiri Olsa <jolsa@redhat.com> - 2017-04-12 16:30 +0200
Re: [PATCH v4 0/5] perf report: Show branch type Jiri Olsa <jolsa@redhat.com> - 2017-04-12 17:50 +0200
Re: [PATCH v4 0/5] perf report: Show branch type "Jin, Yao" <yao.jin@linux.intel.com> - 2017-04-12 17:50 +0200
Re: [PATCH v4 0/5] perf report: Show branch type "Jin, Yao" <yao.jin@linux.intel.com> - 2017-04-13 04:10 +0200
Re: [PATCH v4 0/5] perf report: Show branch type "Jin, Yao" <yao.jin@linux.intel.com> - 2017-04-13 05:30 +0200
Re: [PATCH v4 0/5] perf report: Show branch type Jiri Olsa <jolsa@redhat.com> - 2017-04-13 10:30 +0200
csiph-web