tiny.trace.ObjectEntry
Defined in replay.
API (13)
Actions
Public operations.
Fields and members
Public fields and members.
Source
Source: lib/trace/src/replay.zig:375
zig
pub const ObjectEntry = struct { object_id: u64, allocation_index: ?usize = null, free_index: ?usize = null, allocated_at: ?event.Timepoint = null, freed_at: ?event.Timepoint = null, size: u64 = 0, alignment: u32 = 0, label: ?[]const u8 = null, pub fn fromAllocationAlloc(allocator: std.mem.Allocator, index: usize, item: event.Event) !ObjectEntry { return .{ .object_id = item.object_id, .allocation_index = index, .allocated_at = item.timepoint, .size = item.size, .alignment = item.alignment, .label = if (item.label) |label| try allocator.dupe(u8, label) else null, }; } pub fn fromFree(index: usize, item: event.Event) ObjectEntry { return .{ .object_id = item.object_id, .free_index = index, .freed_at = item.timepoint, }; } pub fn status(self: ObjectEntry) []const u8 { if (self.allocated_at == null) return "free_without_allocation"; if (self.freed_at != null) return "freed"; return "live"; } pub fn deinit(self: *ObjectEntry, allocator: std.mem.Allocator) void { if (self.label) |label| allocator.free(label); self.* = undefined; } pub fn writeJsonLine(self: ObjectEntry, writer: *std.Io.Writer) !void { var stream = pretty_json.Writer.init(writer, .minified); const object = try stream.object(); try object.field("event", "object"); try object.field("object_id", self.object_id); try object.field("status", self.status()); try object.field("allocation_index", self.allocation_index); try object.field("free_index", self.free_index); try writeOptionalTimepointField(object, "allocated_at", self.allocated_at); try writeOptionalTimepointField(object, "freed_at", self.freed_at); try object.field("size", self.size); try object.field("alignment", self.alignment); if (self.label) |label| try object.field("label", label); try object.endLine(); }};Source: lib/trace/src/root.zig:50
zig
pub const ObjectEntry = replay.ObjectEntry;Audit
| Definitions | 6 |
|---|---|
| Public names | 12 |
| Members | 8 |
| Version | 26.7.0 |
| Revision | daab053ee433 |