* [PATCH i-g-t] benchmarks: Use labs() for abs(long)
@ 2019-08-27 16:14 Chris Wilson
2019-08-28 7:35 ` [igt-dev] " Ser, Simon
0 siblings, 1 reply; 2+ messages in thread
From: Chris Wilson @ 2019-08-27 16:14 UTC (permalink / raw)
To: intel-gfx; +Cc: igt-dev
e.g. benchmarks/gem_wsim.c:2936:4: warning: absolute value function ‘abs’ given an argument of type ‘long int’ but has parameter of type ‘int’ which may cause truncation of value [-Wabsolute-value]
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
benchmarks/gem_syslatency.c | 2 +-
benchmarks/gem_wsim.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/benchmarks/gem_syslatency.c b/benchmarks/gem_syslatency.c
index 7671dc43e..d7cf0ed49 100644
--- a/benchmarks/gem_syslatency.c
+++ b/benchmarks/gem_syslatency.c
@@ -343,7 +343,7 @@ static unsigned long calibrate_nop(unsigned int target_us,
sz = loops * sz / elapsed(&t_start, &t_end) * 1e3 * target_us;
sz = ALIGN(sz, sizeof(uint32_t));
} while (elapsed(&t_0, &t_end) < 5 ||
- abs(sz - prev) > (sz * tolerance_pct / 100));
+ labs(sz - prev) > (sz * tolerance_pct / 100));
close(fd);
diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c
index a76fdbfe2..b8e22b3f6 100644
--- a/benchmarks/gem_wsim.c
+++ b/benchmarks/gem_wsim.c
@@ -2933,7 +2933,7 @@ static unsigned long calibrate_nop(unsigned int tolerance_pct)
size = loops * size / elapsed(&t_start, &t_end) / 1e6 * usecs;
size = ALIGN(size, sizeof(uint32_t));
} while (elapsed(&t_0, &t_end) < 5 ||
- abs(size - last_size) > (size * tolerance_pct / 100));
+ labs(size - last_size) > (size * tolerance_pct / 100));
return size / sizeof(uint32_t);
}
--
2.23.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [igt-dev] [PATCH i-g-t] benchmarks: Use labs() for abs(long)
2019-08-27 16:14 [PATCH i-g-t] benchmarks: Use labs() for abs(long) Chris Wilson
@ 2019-08-28 7:35 ` Ser, Simon
0 siblings, 0 replies; 2+ messages in thread
From: Ser, Simon @ 2019-08-28 7:35 UTC (permalink / raw)
To: intel-gfx@lists.freedesktop.org, chris@chris-wilson.co.uk
Cc: igt-dev@lists.freedesktop.org
On Tue, 2019-08-27 at 17:14 +0100, Chris Wilson wrote:
> e.g. benchmarks/gem_wsim.c:2936:4: warning: absolute value function ‘abs’ given an argument of type ‘long int’ but has parameter of type ‘int’ which may cause truncation of value [-Wabsolute-value]
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Simon Ser <simon.ser@intel.com>
> ---
> benchmarks/gem_syslatency.c | 2 +-
> benchmarks/gem_wsim.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/benchmarks/gem_syslatency.c b/benchmarks/gem_syslatency.c
> index 7671dc43e..d7cf0ed49 100644
> --- a/benchmarks/gem_syslatency.c
> +++ b/benchmarks/gem_syslatency.c
> @@ -343,7 +343,7 @@ static unsigned long calibrate_nop(unsigned int target_us,
> sz = loops * sz / elapsed(&t_start, &t_end) * 1e3 * target_us;
> sz = ALIGN(sz, sizeof(uint32_t));
> } while (elapsed(&t_0, &t_end) < 5 ||
> - abs(sz - prev) > (sz * tolerance_pct / 100));
> + labs(sz - prev) > (sz * tolerance_pct / 100));
>
> close(fd);
>
> diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c
> index a76fdbfe2..b8e22b3f6 100644
> --- a/benchmarks/gem_wsim.c
> +++ b/benchmarks/gem_wsim.c
> @@ -2933,7 +2933,7 @@ static unsigned long calibrate_nop(unsigned int tolerance_pct)
> size = loops * size / elapsed(&t_start, &t_end) / 1e6 * usecs;
> size = ALIGN(size, sizeof(uint32_t));
> } while (elapsed(&t_0, &t_end) < 5 ||
> - abs(size - last_size) > (size * tolerance_pct / 100));
> + labs(size - last_size) > (size * tolerance_pct / 100));
>
> return size / sizeof(uint32_t);
> }
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-08-28 7:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-27 16:14 [PATCH i-g-t] benchmarks: Use labs() for abs(long) Chris Wilson
2019-08-28 7:35 ` [igt-dev] " Ser, Simon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox