[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180326125131.15fba249@gandalf.local.home>
Date: Mon, 26 Mar 2018 12:51:31 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Matthias Schiffer <mschiffer@...verse-factory.net>
Cc: mingo@...hat.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ftrace: fix stddev calculation in function profiler
(again)
On Sat, 24 Mar 2018 17:26:38 +0100
Matthias Schiffer <mschiffer@...verse-factory.net> wrote:
> @@ -905,8 +898,20 @@ static void profile_graph_return(struct ftrace_graph_ret *trace)
>
> rec = ftrace_find_profiled_func(stat, trace->func);
> if (rec) {
> + unsigned long long avg, delta1, delta2;
> +
> rec->time += calltime;
> - rec->time_squared += calltime * calltime;
> +
> + /* Apply Welford's method */
> + delta1 = calltime - rec->avg;
> +
> + avg = rec->time;
> + do_div(avg, rec->counter);
Can you find a way not to do a divide in every function call?
-- Steve
> + rec->avg = avg;
> +
> + delta2 = calltime - rec->avg;
> +
> + rec->stddev += delta1 * delta2;
> }
>
> out:
Powered by blists - more mailing lists