From: Damien Lespiau <damien.lespiau@intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH i-g-t 17/18] stats: Add support for quartiles (and thus median)
Date: Sat, 27 Jun 2015 16:52:56 +0100 [thread overview]
Message-ID: <20150627155256.GA7045@strange.ger.corp.intel.com> (raw)
In-Reply-To: <20150627151541.GH14226@nuc-i3427.alporthouse.com>
On Sat, Jun 27, 2015 at 04:15:41PM +0100, Chris Wilson wrote:
> > +static void igt_stats_ensure_sorted_values(igt_stats_t *stats)
> > +{
> > + if (stats->sorted_array_valid)
> > + return;
> > +
> > + if (!stats->sorted) {
> > + stats->sorted = calloc(stats->capacity, sizeof(*stats->values));
> > + igt_assert(stats->sorted);
> > + }
>
> Since sorted_array_valid = false on igt_stats_push, but we only allocate
> for the first call to sort, there's no safeguard against
>
> igt_stats_push();
> igt_stats_get_median();
> igt_stats_push();
> igt_stats_get_median();
>
> exploding.
I believe it's fine (and I just sent a test telling the same story, but
well, overflowing an small heap allocated array can often be "fine" with
an overallocation from malloc() rounding up the size to git in a bin),
as the size of the dataset is an invariant (I didn't implement your
suggestion to grow the array at push() time). We allocate the full
capacity here, not just the current n_values.
I did have a think about a growing ->values array, but I think we know
the number of data points we want upfront most of the time (if not
always) when going to do some measurements?
--
Damien
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2015-06-27 15:53 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-27 15:07 More stats thingies Damien Lespiau
2015-06-27 15:07 ` [PATCH i-g-t 01/18] stats: Zero the whole structure at init() time Damien Lespiau
2015-06-27 15:08 ` [PATCH i-g-t 02/18] doc: Remove i-g-t/intel prefixes and capitalize section titles Damien Lespiau
2015-06-27 15:08 ` [PATCH i-g-t 03/18] stats: Add header gards Damien Lespiau
2015-06-27 15:08 ` [PATCH i-g-t 04/18] stats: Add gtkdoc section for igt_stats Damien Lespiau
2015-06-27 15:08 ` [PATCH i-g-t 05/18] stats: Add a way to specify if the data set is a population or a sample Damien Lespiau
2015-06-27 15:08 ` [PATCH i-g-t 06/18] stats: Add a getter for the population property Damien Lespiau
2015-06-27 15:08 ` [PATCH i-g-t 07/18] stats: Add a note about the standard deviation derived from unbiased variance Damien Lespiau
2015-06-27 15:08 ` [PATCH i-g-t 08/18] stats: Factor out a fixture to initialize stats Damien Lespiau
2015-06-27 15:08 ` [PATCH i-g-t 09/18] stats: Add functions to retrieve min/max values of the dataset Damien Lespiau
2015-06-27 15:08 ` [PATCH i-g-t 10/18] stats: Add igt_stats_get_range() Damien Lespiau
2015-06-27 15:08 ` [PATCH i-g-t 11/18] docs: Fix a "libraray" typo Damien Lespiau
2015-06-27 15:08 ` [PATCH i-g-t 12/18] docs: Add documentation for igt_assert_u32() Damien Lespiau
2015-06-27 15:08 ` [PATCH i-g-t 13/18] docs: Add documentation for igt_assert_cmpuint() Damien Lespiau
2015-06-27 15:08 ` [PATCH i-g-t 14/18] lib: Add double versions of igt_assert_cmp() and igt_assert_eq() Damien Lespiau
2015-06-27 15:08 ` [PATCH i-g-t 15/18] stats: Use igt_assert_eq_double() when asserting on doubles Damien Lespiau
2015-06-27 15:08 ` [PATCH i-g-t 16/18] stats: Add a bulk version of _push() Damien Lespiau
2015-06-27 15:08 ` [PATCH i-g-t 17/18] stats: Add support for quartiles (and thus median) Damien Lespiau
2015-06-27 15:15 ` Chris Wilson
2015-06-27 15:52 ` Damien Lespiau [this message]
2015-06-27 15:56 ` Chris Wilson
2015-06-27 16:04 ` Damien Lespiau
2015-06-27 15:08 ` [PATCH i-g-t 18/18] stats: Add support for the interquartile range (IQR) Damien Lespiau
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=20150627155256.GA7045@strange.ger.corp.intel.com \
--to=damien.lespiau@intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=intel-gfx@lists.freedesktop.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox