All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, igt-dev@lists.freedesktop.org
Cc: Intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [igt-dev] [PATCH i-g-t v6] intel-gpu-top: Support for client stats
Date: Fri, 22 Jan 2021 12:17:46 +0000	[thread overview]
Message-ID: <c5c67e55-2bd2-e39d-3362-782c15232a60@linux.intel.com> (raw)
In-Reply-To: <161131773470.3166.13248329911713611140@build.alporthouse.com>


On 22/01/2021 12:15, Chris Wilson wrote:
> Quoting Tvrtko Ursulin (2021-01-22 11:55:24)
>> +static int client_cmp(const void *_a, const void *_b)
>> +{
>> +       const struct client *a = _a;
>> +       const struct client *b = _b;
>> +       long tot_a, tot_b;
>> +
>> +       /*
>> +        * Sort clients in descending order of runtime in the previous sampling
>> +        * period for active ones, followed by inactive. Tie-breaker is client
>> +        * id.
>> +        */
>> +
>> +       tot_a = a->status == ALIVE ? a->total : -1;
>> +       tot_b = b->status == ALIVE ? b->total : -1;
>> +
>> +       tot_b -= tot_a;
>> +       if (!tot_b)
>> +               return (int)b->id - a->id;
>> +
>> +       if (tot_b > 0)
>> +               return 1;
>> +       if (tot_b < 0)
>> +               return -1;
>> +       return 0;
> 
> Nit, this is clearly now
> 
> 	if (tot_b > 0)
>                 return 1;
> 	if (tot_b < 0)
>                 return -1;
> 
> 	return (int)b->id - a->id;
> 
> And the decision flow now neatly matches the comment.

Fair enough, I forgot some other bits I wanted to do anyway. :)

Regards,

Tvrtko


_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

WARNING: multiple messages have this Message-ID (diff)
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, igt-dev@lists.freedesktop.org
Cc: Intel-gfx@lists.freedesktop.org,
	Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Subject: Re: [igt-dev] [PATCH i-g-t v6] intel-gpu-top: Support for client stats
Date: Fri, 22 Jan 2021 12:17:46 +0000	[thread overview]
Message-ID: <c5c67e55-2bd2-e39d-3362-782c15232a60@linux.intel.com> (raw)
In-Reply-To: <161131773470.3166.13248329911713611140@build.alporthouse.com>


On 22/01/2021 12:15, Chris Wilson wrote:
> Quoting Tvrtko Ursulin (2021-01-22 11:55:24)
>> +static int client_cmp(const void *_a, const void *_b)
>> +{
>> +       const struct client *a = _a;
>> +       const struct client *b = _b;
>> +       long tot_a, tot_b;
>> +
>> +       /*
>> +        * Sort clients in descending order of runtime in the previous sampling
>> +        * period for active ones, followed by inactive. Tie-breaker is client
>> +        * id.
>> +        */
>> +
>> +       tot_a = a->status == ALIVE ? a->total : -1;
>> +       tot_b = b->status == ALIVE ? b->total : -1;
>> +
>> +       tot_b -= tot_a;
>> +       if (!tot_b)
>> +               return (int)b->id - a->id;
>> +
>> +       if (tot_b > 0)
>> +               return 1;
>> +       if (tot_b < 0)
>> +               return -1;
>> +       return 0;
> 
> Nit, this is clearly now
> 
> 	if (tot_b > 0)
>                 return 1;
> 	if (tot_b < 0)
>                 return -1;
> 
> 	return (int)b->id - a->id;
> 
> And the decision flow now neatly matches the comment.

Fair enough, I forgot some other bits I wanted to do anyway. :)

Regards,

Tvrtko


_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2021-01-22 12:17 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-21 18:10 [Intel-gfx] [PATCH i-g-t] intel-gpu-top: Support for client stats Tvrtko Ursulin
2021-01-21 18:10 ` [igt-dev] " Tvrtko Ursulin
2021-01-21 19:56 ` [igt-dev] ✗ Fi.CI.BAT: failure for intel-gpu-top: Support for client stats (rev2) Patchwork
2021-01-21 21:34 ` [Intel-gfx] [PATCH i-g-t] intel-gpu-top: Support for client stats Chris Wilson
2021-01-21 21:34   ` [igt-dev] " Chris Wilson
2021-01-22 11:36   ` Tvrtko Ursulin
2021-01-22 11:36     ` [igt-dev] " Tvrtko Ursulin
2021-01-22 11:41     ` Chris Wilson
2021-01-22 11:41       ` [igt-dev] " Chris Wilson
2021-01-22 11:55 ` [Intel-gfx] [PATCH i-g-t v6] " Tvrtko Ursulin
2021-01-22 11:55   ` [igt-dev] " Tvrtko Ursulin
2021-01-22 12:15   ` [Intel-gfx] " Chris Wilson
2021-01-22 12:15     ` Chris Wilson
2021-01-22 12:17     ` Tvrtko Ursulin [this message]
2021-01-22 12:17       ` Tvrtko Ursulin
2021-01-22 12:21   ` [Intel-gfx] " Chris Wilson
2021-01-22 12:21     ` Chris Wilson
2021-01-22 13:12 ` [Intel-gfx] [PATCH i-g-t v7] " Tvrtko Ursulin
2021-01-22 13:12   ` [igt-dev] " Tvrtko Ursulin
2021-01-22 14:13 ` [igt-dev] ✓ Fi.CI.BAT: success for intel-gpu-top: Support for client stats (rev4) Patchwork
2021-01-22 22:21 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork

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=c5c67e55-2bd2-e39d-3362-782c15232a60@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=Intel-gfx@lists.freedesktop.org \
    --cc=chris@chris-wilson.co.uk \
    --cc=igt-dev@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 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.