tiny.profiling.ingest.model
Defined in ingest.
API (21)
Actions
Public operations.
Facts.eqlIdentity.fromStatLimits.inspectPaths.sourcesSourceFacts.eqlSourceKind.isAllocationSourceKind.name
Types and contracts
Public types and contracts.
Values and defaults
Public values and defaults.
Source
Source: src/profiling/ingest/model.zig
zig
const std = @import("std");pub const schema = "tiny.profiling.structured/v1";pub const max_source_bytes: usize = 128 * 1024 * 1024;pub const allocation_reader_bytes: usize = 64 * 1024;pub const source_count: usize = 7;pub const ordinary_source_count: usize = source_count - 1;pub const Digest = [std.crypto.hash.sha2.Sha256.digest_length]u8;comptime { std.debug.assert(source_count == 7); std.debug.assert(ordinary_source_count + 1 == source_count); std.debug.assert(std.math.isPowerOfTwo(max_source_bytes)); std.debug.assert(std.math.isPowerOfTwo(allocation_reader_bytes)); std.debug.assert(max_source_bytes > allocation_reader_bytes); std.debug.assert(@sizeOf(Digest) == 32); std.debug.assert(schema.len > 0); std.debug.assert(@sizeOf(SourceKind) == 1);}pub const Paths = struct { stdout: []const u8, stderr: []const u8, bench_jsonl: []const u8, coz_jsonl: []const u8, coz_analysis: []const u8, tracy_summary: []const u8, allocations: []const u8, structured: []const u8, pub fn sources(self: Paths) [source_count]Source { const result = [source_count]Source{ .{ .kind = .stdout, .path = self.stdout }, .{ .kind = .stderr, .path = self.stderr }, .{ .kind = .bench_jsonl, .path = self.bench_jsonl }, .{ .kind = .coz_jsonl, .path = self.coz_jsonl }, .{ .kind = .coz_analysis, .path = self.coz_analysis }, .{ .kind = .tracy_summary, .path = self.tracy_summary }, .{ .kind = .allocations, .path = self.allocations }, }; std.debug.assert(result[0].path.ptr == self.stdout.ptr); std.debug.assert(result[1].path.ptr == self.stderr.ptr); std.debug.assert(result[2].path.ptr == self.bench_jsonl.ptr); std.debug.assert(result[3].path.ptr == self.coz_jsonl.ptr); std.debug.assert(result[4].path.ptr == self.coz_analysis.ptr); std.debug.assert(result[5].path.ptr == self.tracy_summary.ptr); std.debug.assert(result[6].path.ptr == self.allocations.ptr); return result; }};pub const Summary = struct { rows: usize, parse_errors: usize, sources: usize, max_benchmark_allocated_bytes: ?u64 = null,};pub const SourceKind = enum(u8) { stdout, stderr, bench_jsonl, coz_jsonl, coz_analysis, tracy_summary, allocations, pub fn name(self: SourceKind) []const u8 { const result = @tagName(self); std.debug.assert(result.len > 0); return result; } pub fn isAllocation(self: SourceKind) bool { const result = self == .allocations; if (result) std.debug.assert(std.mem.eql(u8, self.name(), "allocations")); return result; }};pub const Source = struct { kind: SourceKind, path: []const u8,};pub const Identity = struct { inode: u128, size: u64, mtime_ns: i128, ctime_ns: i128, pub fn fromStat(stat: std.Io.File.Stat) Identity { const result = Identity{ .inode = @intCast(stat.inode), .size = stat.size, .mtime_ns = stat.mtime.nanoseconds, .ctime_ns = stat.ctime.nanoseconds, }; std.debug.assert(result.size == stat.size); std.debug.assert(result.mtime_ns == stat.mtime.nanoseconds); return result; }};pub const SourceFacts = struct { present: bool = false, identity: Identity = .{ .inode = 0, .size = 0, .mtime_ns = 0, .ctime_ns = 0 }, digest: Digest = @splat(0), bytes: usize = 0, lines: usize = 0, candidates: usize = 0, max_line_bytes: usize = 0, max_json_depth: usize = 0, max_key_count: usize = 0, pub fn eql(self: SourceFacts, other: SourceFacts) bool { if (self.present) std.debug.assert(self.candidates <= self.lines); if (other.present) std.debug.assert(other.candidates <= other.lines); return std.meta.eql(self, other); }};pub const Facts = struct { sources: [source_count]SourceFacts, pub fn eql(self: Facts, other: Facts) bool { std.debug.assert(self.sources.len == source_count); std.debug.assert(other.sources.len == source_count); for (self.sources, other.sources) |left, right| { if (!left.eql(right)) return false; } return true; }};pub const Limits = struct { paths: Paths, facts: Facts, pub fn inspect(paths: Paths) !Limits { const ingest = @import("root.zig"); return ingest.inspection.inspect(paths); }};Source: src/profiling/ingest/root.zig:1
zig
pub const model = @import("model.zig");Audit
| Definitions | 22 |
|---|---|
| Public names | 36 |
| Members | 37 |
| Version | 26.7.0 |
| Revision | daab053ee433 |