Mesa (master): gallium/hud: fix rounding error in nic bps computation
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Apr 4 14:13:00 UTC 2019
Module: Mesa
Branch: master
Commit: f6ceed205c23164b20d07d30dbd1a4d2451220ac
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f6ceed205c23164b20d07d30dbd1a4d2451220ac
Author: Eric Engestrom <eric.engestrom at intel.com>
Date: Tue Mar 19 14:15:35 2019 +0000
gallium/hud: fix rounding error in nic bps computation
While at it, fix typo in "rounding error" :P
Signed-off-by: Eric Engestrom <eric.engestrom at intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
---
src/gallium/auxiliary/hud/hud_nic.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/gallium/auxiliary/hud/hud_nic.c b/src/gallium/auxiliary/hud/hud_nic.c
index a294602b29e..519a1aaeb11 100644
--- a/src/gallium/auxiliary/hud/hud_nic.c
+++ b/src/gallium/auxiliary/hud/hud_nic.c
@@ -192,14 +192,14 @@ query_nic_load(struct hud_graph *gr, struct pipe_context *pipe)
((bytes - nic->last_nic_bytes) / 1000000) * 8;
float speedMbps = nic->speedMbps;
- float periodMs = gr->pane->period / 1000;
+ float periodMs = gr->pane->period / 1000.0;
float bits = nic_mbps;
float period_factor = periodMs / 1000;
float period_speed = speedMbps * period_factor;
float pct = (bits / period_speed) * 100;
/* Scaling bps with a narrow time period into a second,
- * potentially suffers from routing errors at higher
+ * potentially suffers from rounding errors at higher
* periods. Eg 104%. Compensate.
*/
if (pct > 100)
More information about the mesa-commit
mailing list