Runtime Statistics¶
Each VmSession object records runtime statistics (in the form of a beast::VmSession::RuntimeStatistics object) for the program that is currently being executed in its context. These statistics include data about the Virtual Machine’s execution behavior, and the termination status of the program:
- How many steps were executed in total?
- Was the program terminated?
- Was the program termination abnormal (i.e., was an exception thrown)?
- What was the program’s return code?
- Which operator was executed how many times?
These statistics can be used to analyze the quality of the program, the fitness for any particular use-case that depends on this metadata, or simply for statistical purposes.
The statistics object can be retrieved from the executing code outside of a program any time, independent from whether the program has terminated or not. It will contain the most up to date information about the execution. The relevant struct and calls can be found in the beast::VmSession class:
-
struct
RuntimeStatistics¶ Contains statistical information and metadata about an executed program.
When a program is executed by a VirtualMachine instance, that VM is supposed to inform the session of any operators that were executed. The usage count for each operator is recorded in the session, alongside the overall number of steps executed, whether the program has terminated, whether the termination was abnormal (an exception throw), and what the program’s return code was.