mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Jin, Yao" <yao.jin@linux.intel.com>
To: Jiri Olsa <jolsa@redhat.com>
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
Subject: Re: [PATCH v2] perf diff: Report noisy for cycles diff
Date: Tue, 6 Aug 2019 19:32:27 +0800	[thread overview]
Message-ID: <e61655d3-f69f-c210-3509-1cf745c1081c@linux.intel.com> (raw)
In-Reply-To: <20190806083429.GI7695@krava>



On 8/6/2019 4:34 PM, Jiri Olsa wrote:
> On Thu, Jul 25, 2019 at 06:14:32AM +0800, Jin Yao wrote:
> 
> SNIP
> 
>>   static int cycles_printf(struct hist_entry *he, struct hist_entry *pair,
>> -			 struct perf_hpp *hpp, int width)
>> +			 struct perf_hpp *hpp, int width __maybe_unused)
>>   {
>>   	struct block_hist *bh = container_of(he, struct block_hist, he);
>>   	struct block_hist *bh_pair = container_of(pair, struct block_hist, he);
>>   	struct hist_entry *block_he;
>>   	struct block_info *bi;
>> -	char buf[128];
>> +	char buf[128], spark[32];
>>   	char *start_line, *end_line;
>> +	int ret = 0, pad;
>> +	char pfmt[20] = " ";
>> +	double d;
>>   
>>   	block_he = hists__get_entry(&bh_pair->block_hists, bh->block_idx);
>>   	if (!block_he) {
>> @@ -1350,18 +1375,56 @@ static int cycles_printf(struct hist_entry *he, struct hist_entry *pair,
>>   	end_line = map__srcline(he->ms.map, bi->sym->start + bi->end,
>>   				he->ms.sym);
>>   
>> -	if ((start_line != SRCLINE_UNKNOWN) && (end_line != SRCLINE_UNKNOWN)) {
>> -		scnprintf(buf, sizeof(buf), "[%s -> %s] %4ld",
>> -			  start_line, end_line, block_he->diff.cycles);
>> +	if (show_noisy) {
>> +		ret = print_stat_spark(spark, sizeof(spark),
>> +				       &block_he->diff.stats);
>> +		d = rel_stddev_stats(stddev_stats(&block_he->diff.stats),
>> +				     avg_stats(&block_he->diff.stats));
>> +
>> +		if ((start_line != SRCLINE_UNKNOWN) &&
>> +		    (end_line != SRCLINE_UNKNOWN)) {
>> +			scnprintf(buf, sizeof(buf),
>> +				  "[%s -> %s] %4ld  %s%5.1f%% %s",
>> +				  start_line, end_line, block_he->diff.cycles,
>> +				  "\u00B1", d, spark);
>> +		} else {
>> +			scnprintf(buf, sizeof(buf),
>> +				  "[%7lx -> %7lx] %4ld  %s%5.1f%% %s",
>> +				  bi->start, bi->end, block_he->diff.cycles,
>> +				  "\u00B1", d, spark);
>> +		}
>> +
>> +		if (ret > 0) {
>> +			pad = 8 - ((ret - 1) / 3);
>> +			scnprintf(pfmt, 20, "%%%ds",
>> +				  81 + (2 * ((ret - 1) / 3)) - pad);
>> +			ret = scnprintf(hpp->buf, hpp->size, pfmt, buf);
>> +			if (pad > 0) {
>> +				ret += scnprintf(hpp->buf + ret,
>> +						 hpp->size - ret,
>> +						 "%-*s", pad, " ");
>> +			}
>> +		} else {
>> +			ret = scnprintf(hpp->buf, hpp->size, "%73s", buf);
>> +			ret += scnprintf(hpp->buf + ret, hpp->size - ret,
>> +					 "%-*s", 8, " ");
>> +		}
> 
> 
> hum, why isn't the histogram in the separate column?
> looks like there's lot of duplicated code in here
> 
> thanks,
> jirka
> 

Yes, it'd better add the histogram in a separate column. But it's not 
very easy to add that. Anyway let me double check if I can find a less 
complicated method for that.

Thanks
Jin Yao


>>   	} else {
>> -		scnprintf(buf, sizeof(buf), "[%7lx -> %7lx] %4ld",
>> -			  bi->start, bi->end, block_he->diff.cycles);
>> +		if ((start_line != SRCLINE_UNKNOWN) &&
>> +		    (end_line != SRCLINE_UNKNOWN)) {
>> +			scnprintf(buf, sizeof(buf), "[%s -> %s] %4ld",
>> +				  start_line, end_line, block_he->diff.cycles);
>> +		} else {
>> +			scnprintf(buf, sizeof(buf), "[%7lx -> %7lx] %4ld",
>> +				  bi->start, bi->end, block_he->diff.cycles);
>> +		}
>> +
>> +		ret = scnprintf(hpp->buf, hpp->size, "%*s", width, buf);
>>   	}
>>   
>>   	free_srcline(start_line);
>>   	free_srcline(end_line);
>> -
>> -	return scnprintf(hpp->buf, hpp->size, "%*s", width, buf);
>> +	return ret;
>>   }
> 
> SNIP
> 

      reply	other threads:[~2019-08-06 11:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-24 22:14 Jin Yao
2019-08-06  0:16 ` Jin, Yao
2019-08-06  8:34 ` Jiri Olsa
2019-08-06 11:39   ` Jin, Yao
2019-08-06  8:34 ` Jiri Olsa
2019-08-06 11:46   ` Jin, Yao
2019-08-06  8:34 ` Jiri Olsa
2019-08-06 11:32   ` Jin, Yao [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e61655d3-f69f-c210-3509-1cf745c1081c@linux.intel.com \
    --to=yao.jin@linux.intel.com \
    --cc=Linux-kernel@vger.kernel.org \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=jolsa@kernel.org \
    --cc=jolsa@redhat.com \
    --cc=kan.liang@intel.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=yao.jin@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®