Expand description
Program-level resource profiler for grafOS.
Answers “where are my leases going?” — the grafOS equivalent of a CPU flame
graph, but for resource consumption. Produces resource flame graphs, lease
timelines, data-flow diagrams, and waste reports from grafos_observe::ResourceSpan
data.
§Quick start
use grafos_profile::{ProfileRecording, ProfileSummary, WasteReport};
use grafos_profile::span_json::SpanJson;
use grafos_observe::span::ResourceSpan;
use grafos_observe::trace::TraceContext;
use grafos_observe::event::ResourceType;
// Build a recording from in-memory spans
let random: [u8; 24] = [0x42; 24];
let ctx = TraceContext::new_root(&random);
let mut span = ResourceSpan::new("my_op", ctx);
span.start_time_unix_us = 1_000_000;
span.end_time_unix_us = 2_000_000;
span.lease_cost_byte_secs = 4096;
span.bytes_read = 1024;
span.record_op(ResourceType::Mem, grafos_observe::event::OpType::Read, 10);
span.add_lease_id(1);
let recording = ProfileRecording::from_spans(vec![span]);
let summary = ProfileSummary::from_recording(&recording);
assert_eq!(summary.span_count, 1);
let waste = WasteReport::from_recording(&recording);
assert!(waste.total_waste_byte_secs == 0 || waste.total_waste_byte_secs > 0);§Feature flags
| Feature | Default | Effect |
|---|---|---|
std | Yes | Enables file I/O, serde_json for recording persistence |
html | Yes | Enables HTML report generation (flame graph, timeline, etc.) |
Modules§
- span_
json - JSON serialization for
ResourceSpan.
Structs§
- Data
Flow Diagram - Data-flow diagram inferred from a recording.
- Data
Flow Edge - A directed edge in the data-flow diagram.
- Data
Flow Node - A node in the data-flow diagram.
- Dimension
Score - Sensitivity score for a single resource dimension.
- Flame
Frame - A single frame in the flame graph.
- Flame
Graph - Resource flame graph computed from a span tree.
- Lease
Timeline - Lease timeline (Gantt chart) computed from a recording.
- Lease
Timeline Entry - A single lease’s lifecycle entry for the timeline.
- Profile
Recorder - Records
ResourceSpandata from a running program. - Profile
Recording - An ordered sequence of
ResourceSpanrecords from a program run. - Profile
Summary - Aggregated profile statistics.
- Resource
Type Summary - Per-resource-type aggregated statistics.
- Span
Tree - Hierarchical reconstruction of spans from parent-child relationships.
- Span
Tree Node - A node in the hierarchical span tree.
- Waste
Entry - A single lease’s waste analysis.
- Waste
Report - Waste report computed from a recording.
- Workload
Profile - Workload sensitivity profile inferred from observed behavior.
Enums§
- Data
Flow Node Kind - Kind of node in the data-flow graph.
- Sensitivity
Level - Sensitivity level for a resource dimension.
- Waste
Classification - Waste classification for a lease.
Functions§
- infer_
sensitivity - Infer a sensitivity profile from a recording.