mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 05:08:08 +02:00
venus: Add VkBuffer cache statistics for debug
Signed-off-by: Juston Li <justonli@google.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21324>
This commit is contained in:
parent
7d53d4d078
commit
cc3c97d8c9
2 changed files with 24 additions and 0 deletions
|
|
@ -105,11 +105,23 @@ vn_buffer_cache_init(struct vn_device *dev)
|
|||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
static void
|
||||
vn_buffer_cache_debug_dump(struct vn_buffer_cache *cache)
|
||||
{
|
||||
vn_log(NULL, "dumping buffer cache statistics");
|
||||
vn_log(NULL, " cache hit: %d", cache->debug.cache_hit_count);
|
||||
vn_log(NULL, " cache miss: %d", cache->debug.cache_miss_count);
|
||||
vn_log(NULL, " cache skip: %d", cache->debug.cache_skip_count);
|
||||
}
|
||||
|
||||
void
|
||||
vn_buffer_cache_fini(struct vn_device *dev)
|
||||
{
|
||||
util_sparse_array_finish(&dev->buffer_cache.entries);
|
||||
simple_mtx_destroy(&dev->buffer_cache.mutex);
|
||||
|
||||
if (VN_DEBUG(CACHE))
|
||||
vn_buffer_cache_debug_dump(&dev->buffer_cache);
|
||||
}
|
||||
|
||||
static struct vn_buffer_cache_entry *
|
||||
|
|
@ -146,11 +158,17 @@ vn_buffer_get_cached_memory_requirements(
|
|||
*/
|
||||
out->memory.memoryRequirements.size = align64(
|
||||
create_info->size, out->memory.memoryRequirements.alignment);
|
||||
|
||||
p_atomic_inc(&cache->debug.cache_hit_count);
|
||||
} else {
|
||||
p_atomic_inc(&cache->debug.cache_miss_count);
|
||||
}
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
p_atomic_inc(&cache->debug.cache_skip_count);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,12 @@ struct vn_buffer_cache {
|
|||
/* lazily cache memory requirements for native buffer infos */
|
||||
struct util_sparse_array entries;
|
||||
simple_mtx_t mutex;
|
||||
|
||||
struct {
|
||||
uint32_t cache_skip_count;
|
||||
uint32_t cache_hit_count;
|
||||
uint32_t cache_miss_count;
|
||||
} debug;
|
||||
};
|
||||
|
||||
struct vn_buffer {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue