gallium/hud: fix rounding error in nic bps computation
authorEric Engestrom <eric.engestrom@intel.com>
Tue, 19 Mar 2019 14:15:35 +0000 (14:15 +0000)
committerEric Engestrom <eric@engestrom.ch>
Thu, 4 Apr 2019 13:59:24 +0000 (13:59 +0000)
While at it, fix typo in "rounding error" :P

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/auxiliary/hud/hud_nic.c

index a294602b29ec5a2342da0896c4c0b30376ff9db7..519a1aaeb11e64aef3f3f9635b750e478e033c8e 100644 (file)
@@ -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)