Recipe to Measure the Performance of a Virtual Wiring System
This Recipe creates a digital inverter and makes it oscillate at its maximum frequency. It wires up an EventCounter to measure the frequency. All the Devices in this Recipe are Virtual Devices, so this Recipe will run on any system without adding additional hardware.
You can find the Script in your Virtual Wiring system's "Scripts/examples/virtual" subdirectory. The Script is called "performance_test.script". Click on its "Run" action to run it.
The Script is as follows:
# Builds an inverter and connects its input to its output, which
# causes it to oscillate. The oscillation frequency measures how many
# logic events per second the system can generate and monitor.
# An event counter is hooked to the output of the inverter, so
# you can see the output frequency. The higher the frequency, the
# more events per second your system can generate and monitor.
# When you run this Script, it will hog your CPU, so don't run it
# for long, or you may find your computer gets groggy. To stop it,
# either kill or restart the Virtual Wiring application, or delete the
# virtual wire between the inverter input and output.
run_script("Scripts/Device/Virtual/Logic/Combinational/Not", id:"inverter")
run_script("Scripts/Device/Virtual/EventCounter", id:"event_counter")
# connect the inverter to itself, so it oscillates
wire "inverter:out", "inverter:in"
# connect the event counter
wire "inverter:out", "event_counter:in"
# poke the inverter to get the oscillation started
poke "inverter:in", "on"
Running the Script
Run the Script above. It will not ask you for any parameters, because it requires none.
Device Explorer Display of Performance Measurer Recipe
(running on a Beagle Bone Black)
After starting the Script got to the Device Explorer page. Expand the 2 Devices you find there (the "inverter" and "event_counter"). Click the Refresh button at the bottom of the page, and you should see the values on the "event_counter" change. The frequency value gives a measure of your system's performance. The higher the value, the better your system performs.
|