mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-24 04:36:10 +03:00
renderer/metal: log some cache info
This commit is contained in:
@ -16,6 +16,8 @@ const Allocator = std.mem.Allocator;
|
||||
const font = @import("../main.zig");
|
||||
const lru = @import("../../lru.zig");
|
||||
|
||||
const log = std.log.scoped(.font_shaper_cache);
|
||||
|
||||
/// Our LRU is the run hash to the shaped cells.
|
||||
const LRU = lru.AutoHashMap(u64, []font.shape.Cell);
|
||||
|
||||
@ -53,10 +55,17 @@ pub fn put(
|
||||
) Allocator.Error!void {
|
||||
const copy = try alloc.dupe(font.shape.Cell, cells);
|
||||
const gop = try self.map.getOrPut(alloc, run.hash);
|
||||
if (gop.evicted) |evicted| alloc.free(evicted.value);
|
||||
if (gop.evicted) |evicted| {
|
||||
log.debug("evicted shaped cells for text run hash={}", .{run.hash});
|
||||
alloc.free(evicted.value);
|
||||
}
|
||||
gop.value_ptr.* = copy;
|
||||
}
|
||||
|
||||
pub fn count(self: *const Cache) usize {
|
||||
return self.map.map.count();
|
||||
}
|
||||
|
||||
test Cache {
|
||||
const testing = std.testing;
|
||||
const alloc = testing.allocator;
|
||||
|
@ -1849,6 +1849,11 @@ fn rebuildCells(
|
||||
x += if (cp.wide) 2 else 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Log some things
|
||||
log.debug("rebuildCells complete cached_runs={}", .{
|
||||
self.font_shaper_cache.count(),
|
||||
});
|
||||
}
|
||||
|
||||
fn updateCell(
|
||||
|
Reference in New Issue
Block a user