README

wcx789ll/moonsim/trace does not have a README file

#
EventCategory

pub(all) enum EventCategory {
Arrival
Departure
ResourceAcquire
ResourceRelease
StateChange
Annotation
DeadlineMiss
FaultInjection
} derive(Eq,
Debug
)

Categories of simulation events that can be traced.

#
EventRecord

pub(all) struct EventRecord {
time : Double
source : String
message : String
category : EventCategory
value : Double?
}

A single recorded simulation event.

#
EventRecord::to_csv_row

fn EventRecord::to_csv_row(self : EventRecord) -> String

#
Tracer

pub(all) struct Tracer {
name : String
enabled : Bool
record_count : Int
// private fields
}

The central event tracer. Attach it to a simulation and call record from event callbacks to accumulate a full audit trail.

#
Tracer::category_histogram

fn Tracer::category_histogram(self : Tracer) -> Array[(String, Int)]

Compute a simple histogram of event counts per category. Returns an array of (category_name, count) pairs in insertion order.

#
Tracer::clear

fn Tracer::clear(self : Tracer) -> Unit

Clear all stored records (does not reset the total_count counter).

#
Tracer::disable

fn Tracer::disable(self : Tracer) -> Unit

#
Tracer::enable

fn Tracer::enable(self : Tracer) -> Unit

#
Tracer::is_enabled

fn Tracer::is_enabled(self : Tracer) -> Bool

#
Tracer::new

fn Tracer::new(name : String) -> Tracer

#
Tracer::record

fn Tracer::record(self : Tracer, time : Double, source : String, category : EventCategory, message : String, value : Double?) -> Unit

#
Tracer::record_annotation

fn Tracer::record_annotation(self : Tracer, time : Double, source : String, message : String) -> Unit

#
Tracer::record_arrival

fn Tracer::record_arrival(self : Tracer, time : Double, source : String, message : String) -> Unit

#
Tracer::record_departure

fn Tracer::record_departure(self : Tracer, time : Double, source : String, message : String, sojourn_time : Double?) -> Unit

#
Tracer::record_state_change

fn Tracer::record_state_change(self : Tracer, time : Double, source : String, from_state : String, to_state : String) -> Unit

#
Tracer::records_by_category

fn Tracer::records_by_category(self : Tracer, category : EventCategory) -> Array[EventRecord]

Return all records matching a given category.

#
Tracer::records_by_source

fn Tracer::records_by_source(self : Tracer, source : String) -> Array[EventRecord]

Return all records from a specific source entity.

#
Tracer::records_in_window

fn Tracer::records_in_window(self : Tracer, from : Double, to : Double) -> Array[EventRecord]

Return records within the given time window [from, to] (inclusive).

#
Tracer::stored_count

fn Tracer::stored_count(self : Tracer) -> Int

Return the number of currently stored records (not cleared).

#
Tracer::to_csv

fn Tracer::to_csv(self : Tracer) -> String

Export the full trace as a CSV string. The header row is: time,source,category,message,value

#
Tracer::total_records

fn Tracer::total_records(self : Tracer) -> Int

Return the total number of records written (including while disabled).

#
Tracer::verify_monotonic

fn Tracer::verify_monotonic(self : Tracer) -> Bool

Verify that the trace is monotonically non-decreasing in time. Returns true if valid, false if any record has a timestamp earlier than the previous record.

Source Files

Powered by MoonBit

Site sourceReport issuePackagesBuild queueSkillsStatistics

© 2026 mooncakes.io