Commit Graph

19 Commits

Author SHA1 Message Date
Markus Hitter fa8ec35bc1 run-in-simulavr.sh: report LED on time in clocks instead of ns. 2015-08-04 23:03:51 +02:00
Markus Hitter b3ff59fca1 run-in-simulavr.sh: make it aware of USER_CONFIG.
Now one can build and run tests with a custom configuration.
2015-07-24 17:37:43 +02:00
Markus Hitter 6afddf5680 run-in-simulavr.sh: implement G-code sending handshaking.
Now it waits for an "ok" before sending the next line, like all
the G-code sending hosts do. This allows sending arbitrarily long
G-codes. The 60 seconds simulated time limit is still in place to
avoid endless simulations.

The standard performance simulation now runs more G-code and
results in slightly different numbers accordingly:

cd testcases
./run-in-simulavr.sh short-moves.gcode smooth-curves.gcode triangle-odd.gcode

    FLASH  : 20540 bytes         144%        67%        33%      16%
    RAM    :  2188 bytes         214%       107%        54%      27%
    EEPROM :    32 bytes           4%         2%         2%       1%

short-moves.gcode statistics:
LED on occurences: 888.
LED on time minimum: 304 clock cycles.
LED on time maximum: 720 clock cycles.
LED on time average: 313.256 clock cycles.

smooth-curves.gcode statistics:
LED on occurences: 36511.
LED on time minimum: 304 clock cycles.
LED on time maximum: 706 clock cycles.
LED on time average: 349.172 clock cycles.

triangle-odd.gcode statistics:
LED on occurences: 1636.
LED on time minimum: 304 clock cycles.
LED on time maximum: 710 clock cycles.
LED on time average: 332.32 clock cycles.
2015-04-21 02:51:32 +02:00
Markus Hitter 74c9924366 run-in-simulavr.sh: make stopping on "stop" working again.
It was so far unnoticed that the "simulavr" program is only a
script when run from within the build directory. Still killing it
by name worked, because bash's exec didn't terminate the initiating
script.

Apparently this week Ubuntu updated bash and the new version now
terminates the initiating script (which is a good idea), but now
the executable to kill by name has a different name. It's prefixed
with "lt-". As this "lt-" is hardcoded we can rely on it.
2015-04-21 02:51:31 +02:00
Erik Jonsson 0723b53c44 run-in-simulavr.sh: terminate simulation if stop recieved.
Note by Traumflug: this

  while read -r LINE; do
    some commands
  done << (some other command)

didn't work here (bash 4.3.11 on Ubuntu 14.04), so I had to swap
the sequence of these two commands for using a pipe. Anyways,
excellent idea, shortens some simulator runs drastically!
2014-08-31 19:12:43 +02:00
Markus Hitter ec937adde2 run-in-simulavr.sh: move statistics to the end.
This is more convenient for obvious reasons, you no longer have
to search all the output for these few lines.
2014-08-31 19:10:48 +02:00
Markus Hitter 157a5a966b run-in-simulavr.sh: clean up tracein file after being done. 2014-08-31 19:10:39 +02:00
Markus Hitter fdfd202e5d run-in-simulavr.sh: add statistics output for LED On Time.
As it's still a bit cumbersome to go through the whole .vcd file
to find the highest delay between On and Off, do this search
automatically and output an statistics. Can look like this:

  Statistics (assuming a 20 MHz clock):
  LED on occurences: 838.
  Sum of all LED on time: 262055 clock cycles.
  LED on time minimum: 306 clock cycles.
  LED on time maximum: 717 clock cycles.
  LED on time average: 312.715 clock cycles.

This should give an reasonable overview of wether and roughly
how much a particular code change makes your code slower or
faster. It should also show up showblockers, like occasionally
huge delays.

BTW., the above data was collected timing the step interrupt when
running short-moves.gcode with the current firmware.
2014-08-31 19:06:13 +02:00
Markus Hitter da08c35edd run-in-simulavr.sh: add support for timing measurements.
The idea is simple: if you want to time a portion of code
precisely, turn on the Debug LED (see config.h for
DEBUG_LED_PIN) at the start of sequence and turn it off when
done. Running this in SimulAVR, you have two flanges precise
to the clock cycle which exactly reflect the time taken to
run this code sequence. Ideally, you run this code n a loop
to get a number of samples, if it doesn't run in a loop anyways.

Time taken can then be measured in GTKWave. For convenience and
for a better overview, run-in-simulavr.sh also extracts all the
delays into it's own signal, so it can be viewed as an ongoing
number.
2014-08-31 19:06:05 +02:00
Markus Hitter 4389e670bd run-in-simulavr.sh: start signals undefined.
Also a few aesthetical corrections.
2014-08-31 19:05:56 +02:00
Markus Hitter 35c4949965 run-in-simulavr.sh: run SimulAVR a bit more verbose.
SimulAVR doesn't always work exactly the way it should, so looking
at the command line it's started with is a first debugging step.
2014-08-31 19:05:47 +02:00
Markus Hitter 06d496e8ca run-in-simulavr.sh: also output position in micrometers. 2013-12-06 19:24:58 +01:00
Markus Hitter f1873b4360 run-in-simulavr.sh: also record position.
So far only in steps.
2013-12-06 19:24:58 +01:00
Markus Hitter 3ad9ad5594 run-in-simulavr.sh: fix bitfield conversion.
No major thing, even numbers had the last bit set.
2013-12-06 19:24:58 +01:00
Markus Hitter fd5fe676f4 run-in-simulator.sh: express velocities in mm/min, too.
Uh, this bloats the resulting VCD file by 50% ... ;-)
2013-12-06 19:24:58 +01:00
Markus Hitter 5c0808732c run-in-simulator.sh: run (only) selected files. 2013-12-06 19:24:58 +01:00
Markus Hitter e559b59b54 run-in-simulator.sh: use stdin/stdout for the data file, too. 2013-12-06 19:24:58 +01:00
Markus Hitter 005a935adc run-in-simulavr.sh: also rewrite VCD file to add speed values.
This is quite handy, as you can see accurate speed ramps in
GTKWave now.
2013-12-06 19:24:58 +01:00
Markus Hitter 6e4bdc43ca Add a draft of a script running testcases in SimulAVR.
This script also asks SimulAVR to generate pin traces of the X
and Y axis and even processes this data into a data file with
time, position and current speed of each axis.

Missing:

- Acceleration calculation.

- LOTS of polish.
2013-12-06 19:24:58 +01:00