aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2018-01-11 09:56:12 -0700
committerBrian Paul <[email protected]>2018-01-17 11:17:56 -0700
commitf774f2b52f56cb10fd7e4354e7c3861d370a58a8 (patch)
tree6e9d10fd52763748e482741a7b88389963280b74 /src/gallium
parent541f569a193e6a8b426c7d0f4f6b7533db571305 (diff)
gallium/hud: compute cpu load, percent with doubles
The hud_graph_add_value() function takes a double precision value, so compute it that way. Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/auxiliary/hud/hud_cpu.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/gallium/auxiliary/hud/hud_cpu.c b/src/gallium/auxiliary/hud/hud_cpu.c
index 259bb837639..b7a524330bf 100644
--- a/src/gallium/auxiliary/hud/hud_cpu.c
+++ b/src/gallium/auxiliary/hud/hud_cpu.c
@@ -151,7 +151,8 @@ query_cpu_load(struct hud_graph *gr, struct pipe_context *pipe)
if (info->last_time) {
if (info->last_time + gr->pane->period <= now) {
- uint64_t cpu_busy, cpu_total, cpu_load;
+ uint64_t cpu_busy, cpu_total;
+ double cpu_load;
get_cpu_stats(info->cpu_index, &cpu_busy, &cpu_total);
@@ -258,15 +259,15 @@ query_api_thread_busy_status(struct hud_graph *gr, struct pipe_context *pipe)
thread_now = 0;
}
- unsigned percent = (thread_now - info->last_thread_time) * 100 /
+ double percent = (thread_now - info->last_thread_time) * 100.0 /
(now - info->last_time);
/* Check if the context changed a thread, so that we don't show
* a random value. When a thread is changed, the new thread clock
* is different, which can result in "percent" being very high.
*/
- if (percent > 100)
- percent = 0;
+ if (percent > 100.0)
+ percent = 0.0;
hud_graph_add_value(gr, percent);
info->last_thread_time = thread_now;