The Sparta Modeling Framework
Loading...
Searching...
No Matches
Report Descriptor Files (Multi-Report Definitions)

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:

  • A report definition file (Report Definition Format (.rrep,.yaml)) lists the counters and statistics that make up the content of a report.
  • A report descriptor file (this page) binds definition files to device tree locations, destinations, formats and triggers.

See 3.2 Report Generation for an overview of the report system and the --report and --report-all command line options.

Descriptor triggers vs. subreport triggers
The 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.

Using a Descriptor File

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.

File Structure

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.

content:
report:
pattern: top.cpu.core0
def_file: core_stats.yaml
dest_file: core0_stats.txt
report:
pattern: top.cpu.core1
def_file: core_stats.yaml
dest_file: core1_stats.txt
content:
- report:
pattern: top.cpu.core0
def_file: core_stats.yaml
dest_file: core0_stats.txt
- report:
pattern: top.cpu.core1
def_file: core_stats.yaml
dest_file: core1_stats.txt

Nested report blocks are an error, as is any key the parser does not recognize.

Report Keys

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:

  • Keys are not case-translated; spell them exactly as shown.
  • Only the key names above (plus the trigger and metadata keys described below) are accepted. Anything else raises an exception that names the offending key.
  • pattern is technically optional, but the definition file must then be valid when interpreted from the global scope.
  • When the same def_file is used with several pattern values (or a wildcard), use l or i in dest_file to keep the outputs apart.

Destination File Variables

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.

Triggers

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.

Trigger Expressions

start, stop, whenever and update-whenever take an expression made of:

  1. Counter threshold: path.to.counter >= value. Only >= is allowed for counters.
  2. Notification: notif.<channel> OP value where OP is one of == != >= <= > <.
  3. Tag reference: tag.start or tag.stop, referring to a trigger defined earlier in the file.
  4. Compound: terms joined with && or ||. Both operators may not be mixed in a single expression.

Quote expressions that contain characters YAML treats specially (&&, ||, <, >, :).

content:
report:
pattern: top.cpu.core0
def_file: core_stats.yaml
dest_file: solo_stats_core0.txt
trigger:
tag: t0
start: "rob.stats.total_number_retired >= 1500"
stop: "rob.stats.total_number_retired >= 9000"
report:
pattern: top.cpu.core1
def_file: core_stats.yaml
dest_file: solo_stats_core1.txt
trigger:
tag: t1
start: "rob.stats.total_number_retired >= 2200"
stop: "rob.stats.total_number_retired >= 9400"
report: # Overlap of both windows
pattern: top
def_file: top_stats.yaml
dest_file: overlap_report.html
format: html
trigger:
start: "t0.start && t1.start"
stop: "t0.stop || t1.stop"

See also example/CoreModel/ReportTriggers.txt and example/CoreModel/SubreportTriggers.txt.

Update Trigger Examples

content:
report:
pattern: _global
def_file: autopop_all.yaml
dest_file: all_stats_update_count.csv
format: csv
trigger:
update-count: top.cpu.core0.rob.stats.total_number_retired 75
report:
pattern: _global
def_file: autopop_all.yaml
dest_file: all_stats_update_cycles.csv
format: csv
trigger:
update-cycles: 500
report:
pattern: _global
def_file: autopop_rob.yaml
dest_file: rob_stats_update_time.csv
format: csv
trigger:
update-time: 100 ps
report:
pattern: _global
def_file: simple_stats.yaml
dest_file: update_on_demand.csv
format: csv
trigger:
start: top.cpu.core0.rob.stats.total_number_retired >= 2500
update-whenever: notif.stats_profiler == 1
stop: top.cpu.core0.rob.stats.total_number_retired >= 8800

Per-Notification Output Files

content:
report:
pattern: _global
def_file: simple_stats.yaml
dest_file: "%s_%i.json"
format: json_reduced
trigger:
sprintf-notif: top.cpu.core0.rob.sprintf_notif_channel

Header Metadata

The header_metadata block attaches arbitrary string key/value pairs to the report, which formatters that support headers will emit.

content:
report:
pattern: _global
def_file: simple_stats.yaml
dest_file: out.csv
format: csv
header_metadata:
workload: dhrystone
config: baseline

The keys start_counter, stop_counter and update_counter are reserved by the framework and may not be used; doing so raises an exception.

Expanding ContextCounters

content:
report:
pattern: _global
def_file: cc_simple_stats.yaml
dest_file: internal_counters.json
format: json
expand-cc: true

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.

Placeholders

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.

content:
report:
pattern: _global
def_file: simple_stats.yaml
dest_file: foo.json
format: json_reduced
trigger:
start: top.cpu.core0.rob.stats.total_number_retired >= %START_TIME%
stop: top.cpu.core0.rob.stats.total_number_retired >= %END_TIME%

Common Errors

  • 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.
  • A 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.

Example Files

Working examples live in example/CoreModel:

  • multireport_as_yaml_list.yaml - list-style entries
  • multireport_independent_triggers.yaml - tagged, combined triggers
  • all_update_triggers.yaml, update_report_on_demand.yaml - update triggers
  • all_report_formats.yaml - every output format
  • sprintf_notif_test.yaml - per-notification output files
  • context_counters.yaml - expand-cc
  • foo_descriptor.yaml, bar_descriptor.yaml - placeholders