[Mesa-dev] [PATCH 4/4] gallium/hud: handle a thread switch for API-thread-busy monitoring
Nicolai Hähnle
nhaehnle at gmail.com
Tue Feb 21 08:33:49 UTC 2017
Some comments on patches 1 & 3. Apart from that:
Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
On 20.02.2017 18:44, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> ---
> src/gallium/auxiliary/hud/hud_cpu.c | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/src/gallium/auxiliary/hud/hud_cpu.c b/src/gallium/auxiliary/hud/hud_cpu.c
> index 1cba353..302445d 100644
> --- a/src/gallium/auxiliary/hud/hud_cpu.c
> +++ b/src/gallium/auxiliary/hud/hud_cpu.c
> @@ -237,24 +237,30 @@ struct thread_info {
>
> static void
> query_api_thread_busy_status(struct hud_graph *gr)
> {
> struct thread_info *info = gr->query_data;
> int64_t now = os_time_get_nano();
>
> if (info->last_time) {
> if (info->last_time + gr->pane->period*1000 <= now) {
> int64_t thread_now = pipe_current_thread_get_time_nano();
> -
> - hud_graph_add_value(gr,
> - (thread_now - info->last_thread_time) * 100 /
> - (now - info->last_time));
> + unsigned percent = (thread_now - info->last_thread_time) * 100 /
> + (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;
> + hud_graph_add_value(gr, percent);
>
> info->last_thread_time = thread_now;
> info->last_time = now;
> }
> } else {
> /* initialize */
> info->last_time = now;
> info->last_thread_time = pipe_current_thread_get_time_nano();
> }
> }
>
More information about the mesa-dev
mailing list