-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add benchmark option -b
for test-avrdude
#1709
Conversation
This executes five tests for typical programming tasks: - Write/verify a "difficult" sketch to flash: two code sections and one data section separated by "holes" of different sizes - Dump all flash, eg, to make a backup - Write/verify a "difficult" eeprom data file with holes - Dump all eeprom, eg, to make a backup - Chip erase (bootloaders are expected to page erase flash apart from the bootloader itself) and spot check whether flash was erased The reported times are realistic times with overhead of starting avrdude, resetting the board via DTR/RTS, establishing comms, including erasing the flash before writing/verifying the sketch and disengaging the chip. $ test-avrdude -b -d 0 \ -p "u7.7/weu-jPrac -c urclock -P ch340 -p m328p -b 1000000" \ -p "u7.7/-eu-jPrac -c urclock -P ch340 -p m328p -b 1000000" Testing avrdude version 7.3-20240225 (2078871) Prepare "u7.7/weu-jPrac -c urclock -P ch340 -p m328p -b 1000000" and press 'enter' or 'space' to continue. Press any other key to skip ✅ 2.174 s: flash -U write/verify holes_rjmp_loops_32768B.hex ✅ 1.339 s: flash -U read all flash ✅ 1.415 s: eeprom -U write/verify holes_pack_my_box_1024B.hex ✅ 1.034 s: eeprom -U read all ✅ 1.604 s: chip erase and spot check flash is actually erased ✅ 7.566 s: benchmark for u7.7/weu-jPrac -c urclock -P ch340 -p m328p -b 1000000 Prepare "u7.7/-eu-jPrac -c urclock -P ch340 -p m328p -b 1000000" and press 'enter' or 'space' to continue. Press any other key to skip ✅ 2.001 s: flash -U write/verify holes_rjmp_loops_32768B.hex ✅ 1.333 s: flash -U read all flash ✅ 1.405 s: eeprom -U write/verify holes_pack_my_box_1024B.hex ✅ 1.029 s: eeprom -U read all ✅ 1.618 s: chip erase and spot check flash is actually erased ✅ 7.386 s: benchmark for u7.7/-eu-jPrac -c urclock -P ch340 -p m328p -b 1000000 Note the benchmark line with the cumulative time for all five tasks
This PR does not work too well under MSYS2 mingw64 (WIndows)
|
The above test is using avrdude 7.3 MSVC64 binary. Same results if I use the github action MSVC64 binary of this PR.
|
Hmm, strange, the github action MSVC64 binary (go to https://github.com/avrdudes/avrdude/actions/runs/8047336152, then click I download the other MSYS2 mingw64 binary and it has the same issue.
Edit -- this is normal.
|
This PR works very well under Linux. The following tests are carried out using an Arduino Uno clone with ATmega16U2 USB to Serial chip (same as the official Arduino Uno Rev 3 design), it can go to 2M baud. From the following test results, we can see the speed gain from 115200bps to 500kbps is significant. Then the jump from 500kbps to 1Mbps is less significant. The jump from 1Mbps to 2Mbps is even less important.
|
I agree. I will use this method once this PR is merged. Thanks for providing the nice improvements for avrdude. |
Uppercase names are typically used for environment variables in bash
A quick and dirty fix.
I think one way to fix is to use another command line option to specify the scratch file name to be used, at least for Windows, similar to |
The cumulative time for typical user tasks depends on the flash and EEPROM size of the part. This commit computes a size-normalised time. Lower is better. This avrbench number still depends on the part, but less so than the cumulative time of the tasks. The summary line is put in vertical bars to make creation of markdown tables easier.
Should be fixed now
I have no idea why this is so in MingW. This is probably a pre-existing problem?
Neat! The latest commit writes the summary line in markdown, so you can copy that line into a larger table. |
Not yet.
Hmm, then this must be the case. I actually do not know this feature and have never used until today. |
I suspect bash emulates /dev/null but as soon as you have a program that tries to r/w there then the OS fails... |
This "feature" relies on the observation that AVRDUDE simply ignores non-option arguments:
It could be that the MingW |
I see.
I tested both MSVC64 and mingw64 binaries from github action and both have the same results.
For MSVC, there is no |
I don't think it is worth our while to improve MingW parsing, but the /dev/null problem should be solved now. |
I agree. mingw/msvc option parsing does not need to be changed. I think very few people know the trick in reality. And yes
|
BTW, now we have the option Can we extend similar option to programmers as well?
|
We can drop that test altogether. The new avrbench figure next to the cumulative time
|
Good idea to drop to the test for
I see. Sounds good to me.
|
Test under Windows MSYS2 mingw64 build environment.
|
I was thinking about avrbench. I see two options.
I actually think maybe we should go for Option 2 because some people may not care about EEPROM at all. How do you like this idea? |
@mcuee Good shout. Let me think about this a bit. Invariably, whenever you have a benchmark, people try to sort everything according to a single number. This invariably is some sort of weighted average. We could try to create a table with five numbers and let the user select what they like and sort accordingly (the column caption affords two little triangles to sort up or down according to that triangle). So, we could have
Normalisation is always an issue; we have the choice of normalising by flash and eeprom size or we could decide to create tables only with 32k parts and show raw times. Thinking about it I have the ever so slight preference for ditching avrbench, go for four columns and do no normalisation (that's the most transparent and does not pass judgement on what people may or may not be interested in). It would be fabulous if we could create a sortable table in the wiki to give users the power to sort themselves. I could create markdown tables incl header automatically (in the test-avrdude order), but it would need the skills of someone like @mcuee to make them sortable |
@stefanrueger |
I did a Google search and it seems github does not support sortable markdown table. There are Chrome Extensions which can do that. I just tried the following and it seems to work wekk well. The extension is not pouplar though. On the other hand, it is not difficult for the users to import the table to their favorite spreadsheet program (eg: Excel or LibreOffice Calc) and sort the table. There are also shell scripts which can do that. Shell script example: |
OK, here is a mockup of how this could look like
The output of
to obtain the table including legend: Testing avrdude version 7.3-20240225 (2078871) The benchmark shows the wall clock time of avrdude carrying out the following tasks
The sketch and data payload is roughly one sixth of the respective memory size
|
Looks very nice. Thanks. |
OK, @mcuee have a look.
Testing avrdude version 7.3-20240225 (2078871) The benchmark shows the wall clock time of avrdude carrying out the following tasks
The sketch and data payload is roughly one sixth of the respective memory size
And here a more realistic example (you need to press enter and then again once you see the first result and have changed the board):
Testing avrdude version 7.3-20240225 (2078871) The benchmark shows the wall clock time of avrdude carrying out the following tasks
The sketch and data payload is roughly one sixth of the respective memory size
|
@mcuee I think the CI failure is spurious... other than that I am now finished with this PR. I would suggest closing the new benchmark discussion and either put a growing table into a locked new discussion item or into the wiki. Perhaps best to only report on existing programmers and published bootloaders that are in actual use. |
Yes, that is due to some repo download issues. I have restarted the failed Linux build jobs and now it is okay. |
I agree. I will create a new Wiki page first. If required, I will create a new locked discussion thread. |
This PR is nice. I think this PR can be merged. The following is with avrdude MSVC64 binary, Arduino Uno Rev 3 clone using ATmega16U2 as the USB to Serial chip (fastest USB to Serial chip so far).
Copy/paste the result -- it becomes a nice table.
|
One more result.
Table format.
|
A minor thing, maybe we want to remove the mentioning of
|
Good catch, pushed a commit directly on git main |
test-avrdude -b
executes five tests for typical programming tasks:The reported times are realistic times with overhead of starting avrdude, resetting the board via DTR/RTS, establishing comms, including erasing the flash before writing/verifying the sketch and disengaging the chip.
Note the benchmark line with the cumulative time for all five tasks