Skip to documentation
SLOP

tiny.trace.ObjectEntry

Reference tiny.trace ObjectEntry

Defined in replay.

API (13)

Actions

Public operations.

Fields and members

Public fields and members.

No direct callersNo direct callsreplayObjectEntry
Static calls · unresolved targets: unknown · external targets: unknown.

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;
Called byCallsNo direct callsreplaywriteObjectsJsonlObjectEntryfromAllocationAlloc
Static calls · unresolved targets: 0 · external targets: 1.
Called byCallsNo direct callsreplaywriteObjectsJsonlObjectEntryfromFree
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callsObjectEntrywriteJsonLineObjectEntrystatus
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callersObjectEntrystatusprivate sourcelib.trace.src.replaywriteOptionalTimepointFieldObjectEntrywriteJsonLine
Static calls · unresolved targets: 0 · external targets: 4.

Audit

Definitions6
Public names12
Members8
Version26.7.0
Revisiondaab053ee433