From: Namhyung Kim <namhyung@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [for-next][PATCH 3/6] tracing: Only calculate stats of tracepoint benchmarks for 2^32 times
Date: Tue, 10 Jun 2014 14:17:54 +0900 [thread overview]
Message-ID: <87sindbawt.fsf@sejong.aot.lge.com> (raw)
In-Reply-To: <20140606172104.552734596@goodmis.org> (Steven Rostedt's message of "Fri, 06 Jun 2014 12:30:37 -0400")
Hi Steve,
On Fri, 06 Jun 2014 12:30:37 -0400, Steven Rostedt wrote:
> From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
>
> When calculating the average and standard deviation, it is required that
> the count be less than UINT_MAX, otherwise the do_div() will get
> undefined results. After 2^32 counts of data, the average and standard
> deviation should pretty much be set anyway.
[SNIP]
> if (bm_cnt > 1) {
> /*
> * Apply Welford's method to calculate standard deviation:
> * s^2 = 1 / (n * (n-1)) * (n * \Sum (x_i)^2 - (\Sum x_i)^2)
> */
> stddev = (u64)bm_cnt * bm_totalsq - bm_total * bm_total;
> - do_div(stddev, bm_cnt);
> - do_div(stddev, bm_cnt - 1);
> + do_div(stddev, (u32)bm_cnt);
> + do_div(stddev, (u32)bm_cnt - 1);
> } else
> stddev = 0;
I also think that this if-else can go as it checks bm_cnt == 1 above.
Thanks,
Namhyung
next prev parent reply other threads:[~2014-06-10 5:17 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-06 16:30 [for-next][PATCH 0/6] tracing: Hopefully the last updates for 3.16 merge window Steven Rostedt
2014-06-06 16:30 ` [for-next][PATCH 1/6] tracing: Introduce saved_cmdlines_size file Steven Rostedt
2014-06-06 16:30 ` [for-next][PATCH 2/6] tracing: Convert stddev into u64 in tracepoint benchmark Steven Rostedt
2014-06-06 16:30 ` [for-next][PATCH 3/6] tracing: Only calculate stats of tracepoint benchmarks for 2^32 times Steven Rostedt
2014-06-10 5:17 ` Namhyung Kim [this message]
2014-06-10 12:16 ` Steven Rostedt
2014-06-10 13:42 ` Steven Rostedt
2014-06-10 16:12 ` Steven Rostedt
2014-06-06 16:30 ` [for-next][PATCH 4/6] tracing: Return error if ftrace_trace_arrays list is empty Steven Rostedt
2014-06-10 5:20 ` Namhyung Kim
2014-06-10 13:42 ` Steven Rostedt
2014-06-06 16:30 ` [for-next][PATCH 5/6] tracing/kprobes: Avoid self tests if tracing is disabled on boot up Steven Rostedt
2014-06-06 16:30 ` [for-next][PATCH 6/6] tracing: Fix leak of ring buffer data when new instances creation fails Steven Rostedt
2014-06-10 5:25 ` Namhyung Kim
2014-06-10 15:58 ` Steven Rostedt
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=87sindbawt.fsf@sejong.aot.lge.com \
--to=namhyung@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=rostedt@goodmis.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.