public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Tauro, Riana" <riana.tauro@intel.com>
To: "Gupta, Anshuman" <anshuman.gupta@intel.com>,
	"Dixit, Ashutosh" <ashutosh.dixit@intel.com>,
	"igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>
Cc: "Nilawar, Badal" <badal.nilawar@intel.com>
Subject: Re: [igt-dev] [PATCH i-g-t] i915/i915_power: Measure GPU idle/busy power
Date: Wed, 18 Jan 2023 12:52:46 +0530	[thread overview]
Message-ID: <bddffb35-4a95-58c5-473d-5904fb1dfc84@intel.com> (raw)
In-Reply-To: <CY5PR11MB621110BD11315EEA8F6F69BC95C79@CY5PR11MB6211.namprd11.prod.outlook.com>

Hi Ashutosh

Energy measurement when idle and with workload is also a part of 
rc6-idle test.
Why do we need new tests?

Thanks
Riana

On 1/18/2023 12:00 PM, Gupta, Anshuman wrote:
> 
> 
>> -----Original Message-----
>> From: Dixit, Ashutosh <ashutosh.dixit@intel.com>
>> Sent: Wednesday, January 18, 2023 12:33 AM
>> To: igt-dev@lists.freedesktop.org
>> Cc: Nilawar, Badal <badal.nilawar@intel.com>; Tauro, Riana
>> <riana.tauro@intel.com>; Gupta, Anshuman <anshuman.gupta@intel.com>;
>> Ewins, Jon <jon.ewins@intel.com>
>> Subject: [PATCH i-g-t] i915/i915_power: Measure GPU idle/busy power
>>
>> In several instances (e.g. when investigating GPU power limits) it is very
>> useful to be able to measure GPU power easily. Since we already have all
>> ingredients for doing so, add a couple of tests to measure GPU power when
>> idle and power under load.
>>
>> Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
>> ---
>>   tests/i915/i915_power.c | 60
>> +++++++++++++++++++++++++++++++++++++++++
>>   tests/meson.build       |  1 +
>>   2 files changed, 61 insertions(+)
>>   create mode 100644 tests/i915/i915_power.c
>>
>> diff --git a/tests/i915/i915_power.c b/tests/i915/i915_power.c new file mode
>> 100644 index 00000000000..74c5a4ba4af
>> --- /dev/null
>> +++ b/tests/i915/i915_power.c
>> @@ -0,0 +1,60 @@
>> +// SPDX-License-Identifier: MIT
>> +/*
>> + * Copyright © 2022 Intel Corporation
>> + */
>> +
>> +#include "igt.h"
>> +#include "i915/gem.h"
>> +#include "igt_power.h"
>> +
>> +IGT_TEST_DESCRIPTION("i915 power measurement/tests");
>> +
>> +static void measure_power(int i915, const char *domain, bool load) {
>> +	const intel_ctx_t *ctx = intel_ctx_create_all_physical(i915);
>> +	struct power_sample sample[2];
>> +	int sleep_duration_sec = 3;
>> +	struct igt_power pwr;
>> +	igt_spin_t *spin;
>> +
>> +	gem_quiescent_gpu(i915);
>> +	if (load) {
>> +		spin = igt_spin_new(i915, .ctx = ctx, .engine = ALL_ENGINES,
>> +				    .flags = IGT_SPIN_POLL_RUN);
>> +		/* Wait till at least one spinner starts */
>> +		igt_spin_busywait_until_started(spin);
>> +	}
>> +
>> +	igt_require(!igt_power_open(i915, &pwr, domain));
>> +	igt_power_get_energy(&pwr, &sample[0]);
>> +	usleep(sleep_duration_sec * USEC_PER_SEC);
>> +	igt_power_get_energy(&pwr, &sample[1]);
>> +	igt_info("Measured power: %g mW\n", igt_power_get_mW(&pwr,
>> &sample[0],
>> +&sample[1]));
> Are we testing anything here, if not then don't call it a test, better to move it under tools.
> Thanks,
> Anshuman Gupta.
>> +
>> +	igt_power_close(&pwr);
>> +	igt_free_spins(i915);
>> +	intel_ctx_destroy(i915, ctx);
>> +}
>> +
>> +igt_main
>> +{
>> +	int i915;
>> +
>> +	igt_fixture {
>> +		i915 = drm_open_driver_master(DRIVER_INTEL);
>> +	}
>> +
>> +	igt_describe("Measure idle gpu power");
>> +	igt_subtest("gpu-idle") {
>> +		measure_power(i915, "gpu", false);
>> +	}
>> +
>> +	igt_describe("Measure gpu power with load");
>> +	igt_subtest("gpu-busy") {
>> +		measure_power(i915, "gpu", true);
>> +	}
>> +
>> +	igt_fixture {
>> +		close(i915);
>> +	}
>> +}
>> diff --git a/tests/meson.build b/tests/meson.build index
>> e20a864035b..e0f41e9e6a1 100644
>> --- a/tests/meson.build
>> +++ b/tests/meson.build
>> @@ -212,6 +212,7 @@ i915_progs = [
>>   	'i915_pm_dc',
>>   	'i915_pm_rps',
>>   	'i915_pm_sseu',
>> +	'i915_power',
>>   	'i915_query',
>>   	'i915_selftest',
>>   	'i915_suspend',
>> --
>> 2.38.0
> 

  reply	other threads:[~2023-01-18  7:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-17 19:03 [igt-dev] [PATCH i-g-t] i915/i915_power: Measure GPU idle/busy power Ashutosh Dixit
2023-01-17 20:54 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2023-01-18  6:30 ` [igt-dev] [PATCH i-g-t] " Gupta, Anshuman
2023-01-18  7:22   ` Tauro, Riana [this message]
2023-01-19  3:32     ` Dixit, Ashutosh
2023-01-23  5:46       ` Tauro, Riana
2023-01-19  5:07   ` Dixit, Ashutosh
2023-01-18 10:29 ` [igt-dev] ✓ Fi.CI.IGT: success for " 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=bddffb35-4a95-58c5-473d-5904fb1dfc84@intel.com \
    --to=riana.tauro@intel.com \
    --cc=anshuman.gupta@intel.com \
    --cc=ashutosh.dixit@intel.com \
    --cc=badal.nilawar@intel.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox