util/stats: use PRIdx/PRIux format constants

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35583>
This commit is contained in:
Rhys Perry 2025-06-17 16:22:39 +01:00 committed by Marge Bot
parent 3625ed36b7
commit ace17d0ea1

View file

@ -67,14 +67,14 @@ def safe_name(name):
return name
TYPE_MAP = {
'i8': ('int8_t', 'i64', 'd'),
'u8': ('uint8_t', 'u64', 'u'),
'i16': ('int16_t', 'i64', 'd'),
'u16': ('uint16_t', 'u64', 'u'),
'i32': ('int32_t', 'i64', 'd'),
'u32': ('uint32_t', 'u64', 'u'),
'i64': ('int64_t', 'i64', 'd'),
'u64': ('uint64_t', 'u64', 'u'),
'i8': ('int8_t', 'i64', '" PRId8 "'),
'u8': ('uint8_t', 'u64', '" PRIu8 "'),
'i16': ('int16_t', 'i64', '" PRId16 "'),
'u16': ('uint16_t', 'u64', '" PRIu16 "'),
'i32': ('int32_t', 'i64', '" PRId32 "'),
'u32': ('uint32_t', 'u64', '" PRIu32 "'),
'i64': ('int64_t', 'i64', '" PRId64 "'),
'u64': ('uint64_t', 'u64', '" PRIu64 "'),
'float': ('float', 'f64', 'f'),
'bool': ('bool', 'bool', 'u')
}
@ -107,7 +107,7 @@ class ISA:
# format. report.py has a weird special case for spills/fills, which we
# need to fix up here.
fmt = ', '.join([x for stat in self.stats for x in stat.format_strings])
self.format_string = fmt.replace('%u spills, %u fills', '%u:%u spills:fills')
self.format_string = fmt.replace('%" PRIu32 " spills, %" PRIu32 " fills', '%" PRIu32 ":%" PRIu32 " spills:fills')
self.format_args = ', '.join([x for stat in self.stats for x in stat.format_args])
class Family:
@ -142,6 +142,7 @@ families, isas = parse_file(root)
template = Template("""\
#ifndef __SHADER_STATS_H
#define __SHADER_STATS_H
#include <inttypes.h>
#include <stdio.h>
#include <stdint.h>
#include "util/u_debug.h"