|
The Sparta Modeling Framework
|
This page describes report descriptor files: YAML files that instantiate one or more reports in a single place. A descriptor file states where in the device tree each report is created, which report definition file supplies its content, where and how it is written, and when it starts, stops and updates.
A descriptor file is not the same thing as a report definition file:
See 3.2 Report Generation for an overview of the report system and the --report and --report-all command line options.
trigger block described here lives in a descriptor file and controls the lifetime of an entire report. Report definition files can also place a trigger block inside a subreport to control just that subreport (see example/CoreModel/SubreportTriggers.txt). Both use the same expression syntax (Trigger Expressions), and tags defined in either place can be referenced by later triggers. Note that name is valid in both file kinds: in a descriptor it names the report being instantiated, in a definition it names the report or subreport it appears in.A descriptor file is passed to the simulator with the single-argument form of --report:
simulator --report all_report_descriptions.yaml
This is equivalent to many --report PATTERN DEF_FILE DEST [FORMAT] options, but is the only way to use report triggers (warmup, update intervals, etc.). Relative def_file paths are resolved against the descriptor file's location and the directories given by --report-search-dir.
A descriptor file has a top-level content block containing one or more report entries. Entries can be written either as repeated report: keys or as a YAML list; both forms are equivalent.
Nested report blocks are an error, as is any key the parser does not recognize.
The following keys are valid directly inside a report block.
| Key | Required | Default | Description |
|---|---|---|---|
def_file | yes | Report definition file (Report Definition Format (.rrep,.yaml)) supplying the report content. | |
dest_file | yes | Output file. May contain the substitution variables listed in Destination File Variables. | |
pattern | no | _global | Device tree location(s) at which the report is created. Glob wildcards (*, ?) are allowed; one report is created per matching node. _global is the global search scope, which includes the scheduler tree. The definition file's node paths are resolved relative to this node. |
format | no | text | Output format name (e.g. txt, csv, json, html). See Report Output Formats. |
name | no | empty | Name of the report, used by formatters that display or store it. |
trigger | no | Block controlling when the report starts, stops and updates. See Triggers. | |
header_metadata | no | Block of arbitrary key/value pairs written to the report header. See Header Metadata. | |
expand-cc | no | false | When true (or 1), ContextCounter statistics are expanded into their individual internal counters in addition to the aggregate. |
skip | no | false | When true or 1, the entry is parsed but no report is created. Handy for temporarily disabling a report without deleting it. |
roi_region | no | 0 | Positive integer used to tell apart reports belonging to different regions of interest. Must be greater than zero when given. |
Notes:
pattern is technically optional, but the definition file must then be valid when interpreted from the global scope.def_file is used with several pattern values (or a wildcard), use l or i in dest_file to keep the outputs apart.dest_file may contain the following variables, which are expanded when the report is created:
| Variable | Meaning |
|---|---|
%l | Location in the device tree where the report was instantiated |
%i | Index of the report instantiation |
%p | Host process ID |
%t | Timestamp |
%s | Simulator name |
The special names 1 (stdout) and 2 (stderr) may be used as destinations; the format should then be omitted or be txt.
If a sprintf-notif trigger is used (see below), the destination is instead a printf-style template whose arguments come from the notification payload.
The trigger block controls the lifetime of a report. Its keys are all optional and may be combined where it makes sense.
| Key | Value | Meaning |
|---|---|---|
tag | name | Names this report's trigger so other triggers can refer to it as name.start / name.stop. A tag must be defined above the entry that references it. |
start | expression | Report begins collecting when the expression becomes true (e.g. warmup). |
stop | expression | Report stops collecting when the expression becomes true. |
whenever | expression | Report is active only while the expression holds. |
update-count | COUNTER_PATH N | Write a report row each time the counter advances by N. |
update-cycles | N | Write a report row every N cycles. |
update-time | N UNIT | Write a report row every N units of simulated time (e.g. 100 ps, 2 ns). |
update-whenever | expression | Write a report row each time the expression becomes true (on-demand updates). |
sprintf-notif | notification path | Write a new report file each time the named notification fires; dest_file is treated as a format string. |
Use at most one of update-count, update-cycles, update-time and update-whenever per report. Update triggers produce time-series output, so choose a format that supports updates (e.g. csv, csv_cumulative); formats that do not will simply be written once at the end of simulation.
Nested trigger blocks are not supported.
start, stop, whenever and update-whenever take an expression made of:
path.to.counter >= value. Only >= is allowed for counters.notif.<channel> OP value where OP is one of == != >= <= > <.tag.start or tag.stop, referring to a trigger defined earlier in the file.&& or ||. Both operators may not be mixed in a single expression.Quote expressions that contain characters YAML treats specially (&&, ||, <, >, :).
See also example/CoreModel/ReportTriggers.txt and example/CoreModel/SubreportTriggers.txt.
The header_metadata block attaches arbitrary string key/value pairs to the report, which formatters that support headers will emit.
The keys start_counter, stop_counter and update_counter are reserved by the framework and may not be used; doing so raises an exception.
With expand-cc: true, a statistic named ctx_count that refers to a ContextCounter yields ctx_count (the aggregate) plus one ctx_count.<name> entry per internal counter.
Both descriptor and definition files may contain %PLACEHOLDER% tokens. Values are given either on the command line:
simulator --report-yaml-replacements START_TIME 1000 END_TIME 9000 \
--report foo_descriptor.yaml
or per-file, by pairing a descriptor with a definition file that supplies the values as top-level YAML scalars (for example, a foo.yaml containing START_TIME: 1000 and END_TIME: 9000), used as –report foo_descriptor.yaml foo.yaml. This keeps the replacements of different descriptors from clashing.
Each report section must contain a 'def_file' entry / 'dest_file' entry: a required key is missing.Unrecognized key in report definition file: 'xyz': a misspelled or unsupported key inside a report block.Nested report definitions are not supported / Nested trigger definitions are not supported.Metadata key "..." is reserved: see Header Metadata.pattern that matches no node in the device tree, or a definition file whose paths do not exist below the pattern, fails when the report is instantiated.Working examples live in example/CoreModel:
multireport_as_yaml_list.yaml - list-style entriesmultireport_independent_triggers.yaml - tagged, combined triggersall_update_triggers.yaml, update_report_on_demand.yaml - update triggersall_report_formats.yaml - every output formatsprintf_notif_test.yaml - per-notification output filescontext_counters.yaml - expand-ccfoo_descriptor.yaml, bar_descriptor.yaml - placeholders