dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Thierry Reding <thierry.reding@gmail.com>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH i-g-t 1/7] tests/perf: Fix a bunch of warnings on 32-bit systems
Date: Thu, 12 Oct 2017 16:42:40 +0300	[thread overview]
Message-ID: <20171012134240.GJ10981@intel.com> (raw)
In-Reply-To: <20171012132943.28316-1-thierry.reding@gmail.com>

On Thu, Oct 12, 2017 at 03:29:37PM +0200, Thierry Reding wrote:
> From: Thierry Reding <treding@nvidia.com>
> 
> Data types are defined differently on 32-bit systems, causing gcc to
> complain about printf format specifiers not matching the size of the
> variables passed in. Use PRIu64 and %zu where appropriate.

I periodically fix these but someone keeps sneaking in new ones :(
Would be nice if ci actually made sure no new warnings get added..

Based on a quick glance this looks good so
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> 
> Signed-off-by: Thierry Reding <treding@nvidia.com>
> ---
>  tests/perf.c | 32 ++++++++++++++++----------------
>  1 file changed, 16 insertions(+), 16 deletions(-)
> 
> diff --git a/tests/perf.c b/tests/perf.c
> index ad62319e1bbc..a161c45d7009 100644
> --- a/tests/perf.c
> +++ b/tests/perf.c
> @@ -932,25 +932,25 @@ accumulator_print(struct accumulator *accumulator, const char *title)
>  
>  	igt_debug("%s:\n", title);
>  	if (intel_gen(devid) >= 8) {
> -		igt_debug("\ttime delta = %lu\n", deltas[idx++]);
> -		igt_debug("\tclock cycle delta = %lu\n", deltas[idx++]);
> +		igt_debug("\ttime delta = %"PRIu64"\n", deltas[idx++]);
> +		igt_debug("\tclock cycle delta = %"PRIu64"\n", deltas[idx++]);
>  
>  		for (int i = 0; i < format.n_a40; i++)
> -			igt_debug("\tA%u = %lu\n", i, deltas[idx++]);
> +			igt_debug("\tA%u = %"PRIu64"\n", i, deltas[idx++]);
>  	} else {
> -		igt_debug("\ttime delta = %lu\n", deltas[idx++]);
> +		igt_debug("\ttime delta = %"PRIu64"\n", deltas[idx++]);
>  	}
>  
>  	for (int i = 0; i < format.n_a; i++) {
>  		int a_id = format.first_a + i;
> -		igt_debug("\tA%u = %lu\n", a_id, deltas[idx++]);
> +		igt_debug("\tA%u = %"PRIu64"\n", a_id, deltas[idx++]);
>  	}
>  
>  	for (int i = 0; i < format.n_a; i++)
> -		igt_debug("\tB%u = %lu\n", i, deltas[idx++]);
> +		igt_debug("\tB%u = %"PRIu64"\n", i, deltas[idx++]);
>  
>  	for (int i = 0; i < format.n_c; i++)
> -		igt_debug("\tC%u = %lu\n", i, deltas[idx++]);
> +		igt_debug("\tC%u = %"PRIu64"\n", i, deltas[idx++]);
>  }
>  
>  /* The TestOa metric set is designed so */
> @@ -2126,7 +2126,7 @@ test_oa_exponents(void)
>  						}
>  
>  						igt_debug(" > report ts=%u"
> -							  " ts_delta_last=%8u ts_delta_last_periodic=%8u is_timer=%i ctx_id=%8x gpu_ticks=%u period=%.2f A0=%lu A%i=%lu\n",
> +							  " ts_delta_last=%8u ts_delta_last_periodic=%8u is_timer=%i ctx_id=%8x gpu_ticks=%u period=%.2f A0=%"PRIu64" A%i=%"PRIu64"\n",
>  							  rpt[1],
>  							  (last != NULL) ? (rpt[1] - last[1]) : 0,
>  							  (last_periodic != NULL) ? (rpt[1] - last_periodic[1]) : 0,
> @@ -2796,7 +2796,7 @@ test_buffer_fill(void)
>  
>  		do_ioctl(stream_fd, I915_PERF_IOCTL_DISABLE, 0);
>  
> -		igt_debug("fill_duration = %luns, oa_exponent = %u\n",
> +		igt_debug("fill_duration = %"PRIu64"ns, oa_exponent = %u\n",
>  			  fill_duration, oa_exponent);
>  
>  		do_ioctl(stream_fd, I915_PERF_IOCTL_ENABLE, 0);
> @@ -2813,7 +2813,7 @@ test_buffer_fill(void)
>  		 */
>  		while (((last_timestamp - first_timestamp) * oa_period) < (fill_duration / 2)) {
>  
> -			igt_debug("dts=%u elapsed=%lu duration=%lu\n",
> +			igt_debug("dts=%u elapsed=%"PRIu64" duration=%"PRIu64"\n",
>  				  last_timestamp - first_timestamp,
>  				  (last_timestamp - first_timestamp) * oa_period,
>  				  fill_duration / 2);
> @@ -2881,7 +2881,7 @@ test_buffer_fill(void)
>  
>  		do_ioctl(stream_fd, I915_PERF_IOCTL_DISABLE, 0);
>  
> -		igt_debug("%f < %lu < %f\n",
> +		igt_debug("%f < %zu < %f\n",
>  			  report_size * n_full_oa_reports * 0.45,
>  			  n_periodic_reports * report_size,
>  			  report_size * n_full_oa_reports * 0.55);
> @@ -3032,7 +3032,7 @@ test_enable_disable(void)
>  
>  		do_ioctl(stream_fd, I915_PERF_IOCTL_DISABLE, 0);
>  
> -		igt_debug("%f < %lu < %f\n",
> +		igt_debug("%f < %zu < %f\n",
>  			  report_size * n_full_oa_reports * 0.45,
>  			  n_periodic_reports * report_size,
>  			  report_size * n_full_oa_reports * 0.55);
> @@ -3783,7 +3783,7 @@ gen8_test_single_ctx_render_target_writes_a_counter(void)
>  
>  			memset(accumulator.deltas, 0, sizeof(accumulator.deltas));
>  			accumulate_reports(&accumulator, report0_32, report1_32);
> -			igt_debug("total: A0 = %lu, A21 = %lu, A26 = %lu\n",
> +			igt_debug("total: A0 = %"PRIu64", A21 = %"PRIu64", A26 = %"PRIu64"\n",
>  				  accumulator.deltas[2 + 0], /* skip timestamp + clock cycles */
>  				  accumulator.deltas[2 + 21],
>  				  accumulator.deltas[2 + 26]);
> @@ -3905,7 +3905,7 @@ gen8_test_single_ctx_render_target_writes_a_counter(void)
>  				if (lprev) {
>  					memset(laccumulator.deltas, 0, sizeof(laccumulator.deltas));
>  					accumulate_reports(&laccumulator, lprev, report);
> -					igt_debug("    deltas: A0=%lu A21=%lu, A26=%lu\n",
> +					igt_debug("    deltas: A0=%"PRIu64" A21=%"PRIu64", A26=%"PRIu64"\n",
>  						  laccumulator.deltas[2 + 0], /* skip timestamp + clock cycles */
>  						  laccumulator.deltas[2 + 21],
>  						  laccumulator.deltas[2 + 26]);
> @@ -3946,7 +3946,7 @@ gen8_test_single_ctx_render_target_writes_a_counter(void)
>  
>  				if (!skip_reason) {
>  					accumulate_reports(&accumulator, prev, report);
> -					igt_debug(" -> Accumulated deltas A0=%lu A21=%lu, A26=%lu\n",
> +					igt_debug(" -> Accumulated deltas A0=%"PRIu64" A21=%"PRIu64", A26=%"PRIu64"\n",
>  						  accumulator.deltas[2 + 0], /* skip timestamp + clock cycles */
>  						  accumulator.deltas[2 + 21],
>  						  accumulator.deltas[2 + 26]);
> @@ -3974,7 +3974,7 @@ gen8_test_single_ctx_render_target_writes_a_counter(void)
>  				}
>  			}
>  
> -			igt_debug("n samples written = %ld/%lu (%ix%i)\n",
> +			igt_debug("n samples written = %"PRIu64"/%"PRIu64" (%ix%i)\n",
>  				  accumulator.deltas[2 + 21],/* skip timestamp + clock cycles */
>  				  accumulator.deltas[2 + 26],
>  				  width, height);
> -- 
> 2.14.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

      parent reply	other threads:[~2017-10-12 13:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-12 13:29 [PATCH i-g-t 1/7] tests/perf: Fix a bunch of warnings on 32-bit systems Thierry Reding
2017-10-12 13:29 ` [PATCH i-g-t 2/7] tools/aubdump: Avoid ISO C90 warning Thierry Reding
2017-10-12 13:29 ` [PATCH i-g-t 3/7] lib: Fix compilation on non-x86 Thierry Reding
2017-10-12 13:44   ` Ville Syrjälä
2017-10-12 13:56     ` [Intel-gfx] " Thierry Reding
2017-10-17 22:05   ` Chris Wilson
2017-10-12 13:29 ` [PATCH i-g-t 4/7] lib/drmtest: Fix typo Thierry Reding
2017-10-12 13:29 ` [PATCH i-g-t 5/7] lib/drmtest: Support nouveau Thierry Reding
2017-10-12 13:29 ` [PATCH i-g-t 6/7] lib/drmtest: Support Tegra Thierry Reding
2017-10-12 13:29 ` [PATCH i-g-t 7/7] lib/drmtest: Allow the test device to be overridden Thierry Reding
2017-10-12 13:38 ` [PATCH i-g-t 1/7] tests/perf: Fix a bunch of warnings on 32-bit systems Lionel Landwerlin
2017-10-12 13:42 ` Ville Syrjälä [this message]

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=20171012134240.GJ10981@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=thierry.reding@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).