From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1764224AbdDSOPp (ORCPT ); Wed, 19 Apr 2017 10:15:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37272 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1764196AbdDSOPm (ORCPT ); Wed, 19 Apr 2017 10:15:42 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 7B445C059724 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jolsa@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 7B445C059724 Date: Wed, 19 Apr 2017 16:15:38 +0200 From: Jiri Olsa To: Jin Yao 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 Subject: Re: [PATCH v5 7/7] perf report: Show branch type in callchain entry Message-ID: <20170419141538.GE19643@krava> References: <1492616894-3635-1-git-send-email-yao.jin@linux.intel.com> <1492616894-3635-8-git-send-email-yao.jin@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1492616894-3635-8-git-send-email-yao.jin@linux.intel.com> User-Agent: Mutt/1.8.0 (2017-02-23) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 19 Apr 2017 14:15:41 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 19, 2017 at 11:48:14PM +0800, Jin Yao wrote: SNIP > +static int count_str_printf(int index, const char *str, > + char *bf, int bfsize) > +{ > + int printed; > + > + printed = scnprintf(bf, bfsize, > + "%s%s", > + (index) ? " " : " (", str); > + > + return printed; > +} > + > +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; > + > + if (stat->jcc_fwd > 0) > + printed += count_str_printf(j++, "JCC forward", > + bf + printed, bfsize - printed); > + > + if (stat->jcc_bwd > 0) > + printed += count_str_printf(j++, "JCC backward", > + bf + printed, bfsize - printed); > + > + for (i = 0; i < PERF_BR_MAX; i++) { > + if (i == PERF_BR_JCC) > + continue; > + > + if (stat->counts[i] > 0) > + printed += count_str_printf(j++, branch_type_name(i), > + bf + printed, bfsize - printed); > + } > + > + if (stat->cross_4k > 0) > + printed += count_str_printf(j++, "CROSS_4K", > + bf + printed, bfsize - printed); > + > + if (stat->cross_2m > 0) > + printed += count_str_printf(j++, "CROSS_2M", > + bf + printed, bfsize - printed); > + > + return printed; > +} could you please also move this one to that new branch.c file thanks, jirka