lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 02 Sep 2012 21:51:14 +0800
From:	don <haodong@...ux.vnet.ibm.com>
To:	Andrew Jones <drjones@...hat.com>
CC:	avi@...hat.com, acme@...radead.org, mtosatti@...hat.com,
	mingo@...e.hu, xiaoguangrong@...ux.vnet.ibm.com,
	linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
	dsahern@...il.com
Subject: Re: [PATCH v7 3/3] KVM: perf: kvm events analysis tool

于 2012年08月27日 23:53, Andrew Jones 写道:
> On Mon, Aug 27, 2012 at 05:51:46PM +0800, Dong Hao wrote:
>
> <snip>
>
>> +struct event_stats {
>> +	u64 count;
>> +	u64 time;
>> +
>> +	/* used to calculate stddev. */
>> +	double mean;
>> +	double M2;
>> +};
> How about moving the stats functions from builtin-stat.c to e.g.
> util/stats.c, and then reusing them? Then this struct (which I would
> rename to kvm_event_stats) would look like this
>
> struct kvm_event_stats {
>          u64 time;
>          struct stats stats;
> };
>
> of course the get_event_ accessor generators would need tweaking
>
> <snip>
>
>> +static void update_event_stats(struct event_stats *stats, u64 time_diff)
>> +{
>> +	double delta;
>> +
>> +	stats->count++;
>> +	stats->time += time_diff;
>> +
>> +	delta = time_diff - stats->mean;
>> +	stats->mean += delta / stats->count;
>> +	stats->M2 += delta*(time_diff - stats->mean);
>> +}
> Reusing stats would allow this to become just
>
> static void update_event_stats(struct kvm_event_stats *stats, u64 time_diff)
> {
> 	update_stats(&kvm_stats->stats, time_diff);
> 	kvm_stats->time += time_diff;
> }
>
>> +
>> +static double event_stats_stddev(int vcpu_id, struct kvm_event *event)
>> +{
>> +	struct event_stats *stats = &event->total;
>> +	double variance, variance_mean, stddev;
>> +
>> +	if (vcpu_id != -1)
>> +		stats = &event->vcpu[vcpu_id];
>> +
>> +	BUG_ON(!stats->count);
>> +
>> +	variance = stats->M2 / (stats->count - 1);
>> +	variance_mean = variance / stats->count;
>> +	stddev = sqrt(variance_mean);
>> +
>> +	return stddev * 100 / stats->mean;
> This function's name implies it returns the stddev, but it returns the
> relative stddev instead. Maybe rename it? This would be simplified
> with code reuse too to basically just
>
> return stddev_stats(&kvm_stats->stats) * 100 / kvm_stats->stats.mean;
>
> Drew
>
Sorry for my late response, Andrew and thank you very much for your 
comments. We will try
to realize it in our next version.

Thanks,
Dong

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ