intel/measure: track batch buffer sizes

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24628>
This commit is contained in:
Lionel Landwerlin 2023-08-11 12:19:28 +03:00 committed by Marge Bot
parent 2108742257
commit 40d7cb4000
4 changed files with 26 additions and 9 deletions

View file

@ -187,6 +187,7 @@ measure_start_snapshot(struct iris_context *ice,
if(config->cpu_measure) {
intel_measure_print_cpu_result(measure_batch->frame,
measure_batch->batch_count,
measure_batch->batch_size,
index/2,
measure_batch->event_count,
count,
@ -394,6 +395,15 @@ iris_measure_batch_end(struct iris_context *ice, struct iris_batch *batch)
if (measure_batch->index == 0)
return;
/* At this point, total_chained_batch_size is not yet updated because the
* batch_end measurement is within the batch and the batch is not quite
* ended yet (it'll be just after this function call). So combined the
* already summed total_chained_batch_size with whatever was written in the
* current batch BO.
*/
measure_batch->batch_size = batch->total_chained_batch_size +
iris_batch_bytes_used(batch);
/* enqueue snapshot for gathering */
pthread_mutex_lock(&measure_device->mutex);
list_addtail(&iris_measure_batch->base.link, &measure_device->queued_snapshots);

View file

@ -215,12 +215,12 @@ intel_measure_init(struct intel_measure_device *device)
}
if (!config.cpu_measure)
fputs("draw_start,draw_end,frame,batch,renderpass,"
fputs("draw_start,draw_end,frame,batch,batch_size,renderpass,"
"event_index,event_count,type,count,vs,tcs,tes,"
"gs,fs,cs,ms,ts,idle_us,time_us\n",
config.file);
else
fputs("draw_start,frame,batch,event_index,event_count,"
fputs("draw_start,frame,batch,batch_size,event_index,event_count,"
"type,count\n",
config.file);
}
@ -435,6 +435,7 @@ intel_measure_push_result(struct intel_measure_device *device,
if (begin->type == INTEL_SNAPSHOT_SECONDARY_BATCH) {
assert(begin->secondary != NULL);
begin->secondary->batch_count = batch->batch_count;
begin->secondary->batch_size = 0;
begin->secondary->primary_renderpass = batch->renderpass;
intel_measure_push_result(device, begin->secondary);
continue;
@ -470,6 +471,7 @@ intel_measure_push_result(struct intel_measure_device *device,
raw_timestamp_delta(prev_end_ts, buffered_result->start_ts);
buffered_result->frame = batch->frame;
buffered_result->batch_count = batch->batch_count;
buffered_result->batch_size = batch->batch_size;
buffered_result->primary_renderpass = batch->primary_renderpass;
buffered_result->event_index = i / 2;
buffered_result->snapshot.event_count = end->event_count;
@ -622,10 +624,11 @@ print_combined_results(struct intel_measure_device *measure_device,
const struct intel_measure_snapshot *begin = &start_result->snapshot;
uint32_t renderpass = (start_result->primary_renderpass)
? start_result->primary_renderpass : begin->renderpass;
fprintf(config.file, "%"PRIu64",%"PRIu64",%u,%u,%u,%u,%u,%s,%u,"
fprintf(config.file, "%"PRIu64",%"PRIu64",%u,%u,%"PRIu64",%u,%u,%u,%s,%u,"
"0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,%.3lf,%.3lf\n",
start_result->start_ts, current_result->end_ts,
start_result->frame, start_result->batch_count,
start_result->frame,
start_result->batch_count, start_result->batch_size,
renderpass, start_result->event_index, event_count,
begin->event_name, begin->count,
begin->vs, begin->tcs, begin->tes, begin->gs,
@ -640,6 +643,7 @@ print_combined_results(struct intel_measure_device *measure_device,
void
intel_measure_print_cpu_result(unsigned int frame,
unsigned int batch_count,
uint64_t batch_size,
unsigned int event_index,
unsigned int event_count,
unsigned int count,
@ -648,9 +652,9 @@ intel_measure_print_cpu_result(unsigned int frame,
assert(config.cpu_measure);
uint64_t start_ns = os_time_get_nano();
fprintf(config.file, "%"PRIu64",%u,%3u,%3u,%u,%s,%u\n",
start_ns, frame, batch_count, event_index, event_count,
event_name, count);
fprintf(config.file, "%"PRIu64",%u,%3u,%"PRIu64",%3u,%u,%s,%u\n",
start_ns, frame, batch_count, batch_size,
event_index, event_count, event_name, count);
}
/**
@ -708,4 +712,3 @@ intel_measure_gather(struct intel_measure_device *measure_device,
intel_measure_print(measure_device, info);
pthread_mutex_unlock(&measure_device->mutex);
}

View file

@ -120,7 +120,7 @@ struct intel_measure_snapshot {
struct intel_measure_buffered_result {
struct intel_measure_snapshot snapshot;
uint64_t start_ts, end_ts, idle_duration;
uint64_t start_ts, end_ts, idle_duration, batch_size;
unsigned frame, batch_count, event_index, primary_renderpass;
;
};
@ -155,6 +155,7 @@ struct intel_measure_batch {
struct list_head link;
unsigned index;
unsigned frame, batch_count, event_count;
uint64_t batch_size;
uint32_t renderpass, primary_renderpass;
uint64_t *timestamps;
struct intel_measure_snapshot snapshots[0];
@ -173,6 +174,7 @@ bool intel_measure_ready(struct intel_measure_batch *batch);
struct intel_device_info;
void intel_measure_print_cpu_result(unsigned int frame,
unsigned int batch_count,
uint64_t batch_size,
unsigned int event_index,
unsigned int event_count,
unsigned int count,

View file

@ -128,6 +128,7 @@ anv_measure_start_snapshot(struct anv_cmd_buffer *cmd_buffer,
if (config->cpu_measure) {
intel_measure_print_cpu_result(measure->base.frame,
measure->base.batch_count,
measure->base.batch_size,
index/2,
measure->base.event_count,
count,
@ -386,6 +387,7 @@ _anv_measure_submit(struct anv_cmd_buffer *cmd_buffer)
/* finalize snapshots and enqueue them */
static unsigned cmd_buffer_count = 0;
base->batch_count = p_atomic_inc_return(&cmd_buffer_count);
base->batch_size = cmd_buffer->total_batch_size;
if (base->index %2 == 1) {
anv_measure_end_snapshot(cmd_buffer, base->event_count);