[Mesa-dev] [PATCH 1/6] gallium/hud: dump hud_driver_query values to files

Marek Olšák maraeo at gmail.com
Sat Dec 31 23:31:11 UTC 2016


FYI, I've pushed the series and squashed the first 2 patches.

Thanks,

Marek

On Sat, Dec 31, 2016 at 10:15 PM, Marek Olšák <maraeo at gmail.com> wrote:
> On Wed, Dec 21, 2016 at 10:58 PM, Edmondo Tommasina
> <edmondo.tommasina at gmail.com> wrote:
>> Dump values for every selected data source in GALLIUM_HUD.
>>
>> Every data source has its own file and the filename is
>> equal to the data source identifier.
>> ---
>>  src/gallium/auxiliary/hud/hud_context.c      | 6 ++++++
>>  src/gallium/auxiliary/hud/hud_driver_query.c | 2 ++
>>  src/gallium/auxiliary/hud/hud_private.h      | 1 +
>>  3 files changed, 9 insertions(+)
>>
>> diff --git a/src/gallium/auxiliary/hud/hud_context.c b/src/gallium/auxiliary/hud/hud_context.c
>> index ceb157a..edd831a 100644
>> --- a/src/gallium/auxiliary/hud/hud_context.c
>> +++ b/src/gallium/auxiliary/hud/hud_context.c
>> @@ -33,6 +33,7 @@
>>   * Set GALLIUM_HUD=help for more info.
>>   */
>>
>> +#include <inttypes.h>
>>  #include <signal.h>
>>  #include <stdio.h>
>>
>> @@ -829,6 +830,9 @@ hud_graph_add_value(struct hud_graph *gr, uint64_t value)
>>     gr->current_value = value;
>>     value = value > gr->pane->ceiling ? gr->pane->ceiling : value;
>>
>> +   if (gr->fd)
>> +      fprintf(gr->fd, "%" PRIu64 "\n", value);
>> +
>>     if (gr->index == gr->pane->max_num_vertices) {
>>        gr->vertices[0] = 0;
>>        gr->vertices[1] = gr->vertices[(gr->index-1)*2+1];
>> @@ -856,6 +860,8 @@ hud_graph_destroy(struct hud_graph *graph)
>>     FREE(graph->vertices);
>>     if (graph->free_query_data)
>>        graph->free_query_data(graph->query_data);
>> +   if (graph->fd)
>> +      fclose(graph->fd);
>>     FREE(graph);
>>  }
>>
>> diff --git a/src/gallium/auxiliary/hud/hud_driver_query.c b/src/gallium/auxiliary/hud/hud_driver_query.c
>> index 40ea120..bfde16a 100644
>> --- a/src/gallium/auxiliary/hud/hud_driver_query.c
>> +++ b/src/gallium/auxiliary/hud/hud_driver_query.c
>> @@ -378,6 +378,8 @@ hud_pipe_query_install(struct hud_batch_query_context **pbq,
>>        info->result_index = result_index;
>>     }
>>
>> +   gr->fd = fopen(gr->name, "w+");
>
> This opens the file unconditionally. Did you forget to check the env var here?
>
> Marek


More information about the mesa-dev mailing list