We should make Simpletest report its total running time in the test summary. We'd be able to quantify certain performance improvements (eg. #320510-12: [DBTNG] revamp menu.inc with DBTNG syntax) and we'd be able to figure out who is using the fastest development machine ... ;-)
| Comment | File | Size | Author |
|---|---|---|---|
| #31 | batch_with_timer-1226896443_sec.patch | 4.11 KB | birdmanx35 |
| #30 | simpletest_message.jpeg | 7.26 KB | dawehner |
| #30 | batch_with_timer-1226896443_sec.patch | 4.11 KB | dawehner |
| #29 | elapsed-time.jpg | 22.62 KB | dries |
| #28 | batch_with_timer-1226896443.patch | 4.1 KB | dawehner |
Comments
Comment #1
damien tournoud commentedIn the same note, I would also love to add a "estimated time of arrival" in the Batch API progress report.
Comment #2
hswong3i commentedsubscript.
Comment #3
boombatower commentedEstimating would be very hard since each of the test cases takes very different amounts of time.
For instance the db tests take a long time, whereas the search test is virtually instant.
Total time is doable, but just depends on the implementation. Either a variable that records start time or something stored in the results table, or passed through batch API.
Comment #4
hswong3i commentedHow about the idea from HowTo: Benchmark Drupal code?
For sure that simpletest go though most cases for each modules, but seems it can't demonstrate the real-life situation.
Another idea for brainstorming: should we create another set of simpletest class for benchmarking, which will:
As I remember that there is an existing contribute module which try to implement the above idea within a single click, but I am not able to remember its name...
Comment #5
dries commentedI was suggesting the time it required for all the tests from beginning to end. The goal wasn't to build a benchmarking tool, just to give a rough estimation of the time it took to run all the tests. Like: "Run 8000 tests in 15 minutes. 0 errors, 12 exceptions".
Comment #6
boombatower commentedWhich could be easily done by assigning time() to a variable and just outputting the difference.
Comment #7
hswong3i commentedI love this idea too, and here is the patch for it. Patch detail:
$current_set['elapsed']variable.@elapsedand@estimatedfor customization.progress_messagein order to utilize above placeholders.Screenshot as reference:

Comment #8
hswong3i commentedUpdate estimation based on RAW percentage (in floating format), so able to report estimated time even percentage is now in zero.
This will happened when we have total tasks more than 100, e.g. running all simpletest at once (132 tasks). After first task complete, percentage < 1%; if estimate with percentage in integer format (i.e. float($percentage) == 0), the estimated time will report as zero, too (which shouldn't be).
Also update with some documentation and comment.
Comment #9
boombatower commentedThis is a neat feature when generalized to the batch API.
My guess is that the estimation portion will be fairly inaccurate as the tests take significantly different amounts of time to run, but in general it would be neat.
Comment #10
hswong3i commentedSome more update:
$batch_set['results']['elapsed'], so able to fetch out during hook_batch_finished().@remainingmeaning.I also give some study for "estimate simpletest running time" individually. The idea is similar as above: we need to collect enough data in order to estimate. For most ideal case, we should collect each testing class running time.
BTW, its coming with some drawback:
Finally, the logic seems to be too complicated. Implement estimation and elapsed time within batch API may benefit for more different cases :S
Screenshot as reference:


Comment #11
oriol_e9gI like the idea but I suggest to change the "Remaining time" by "Estimated remaining time".
Comment #12
dries commentedThe remaining time has no value for me and clutters the UI. Also, I want to see the running time on the result page. I don't really need it on the progress bar page.
Comment #13
hswong3i commentedIs that means the running time of each test, or the total running time of all tests?
Comment #14
dries commentedAll tests.
Comment #15
hswong3i commentedGet it. Patch reroll.
Remove the additional
$batch['progress_message']so no "Elapsed time... Remaining time..." message display on the progress bar page. "Display total running time on the result page" is already included in patch from #10, so keep it.Also keep the ability of batch API report "Elapsed time... Remaining time..." on-the-fly, unless we specify the placeholders within
$batch['progress_message']or$batch['init_message']. It is just a souvenir of total elapsed time, and maybe useful for some elsewhere?Comment #16
yched commented-1 on renaming variable $remaining to $operations : not needed, + less clear IMO
Also,
is dangerous, because 'results' is left entirely free for batch operations to use in whichever way they see fit.
If for some reason some batch process chooses to store it's 'results' as a string, this will cause errors.
Comment #17
yched commentedAlso note that the elapsed time computed here is the effective time spent in actual batch operations, not taking drupal bootstrap into account. What you get is not the actual time spent since batch processing was launched.
This is in fact probably OK for what Dries initially requested, but it can indeed hardly be used to compute an 'estimated end time'.
Comment #18
hswong3i commentedThis should looks better. Call "estimate remaining" as "@estimate". Add additional variable at tail for hook_batch_finished() so don't need to alter existing implementation. Most likely other should keep untouched.
Comment #19
cburschkaI get an elapsed time once the tests complete, but the batch operation shows no timer at all. Cleared all caches, browser and site. What am I missing?
Edit: Oh, it was taken out. I liked it, personally, but hey.
Comment #20
yched commentedThe 'estimate' value is still wrong - see my comment #17.
If you do want an estimate for remaining time, you'll need to base it on
(timetamp of the batch start) - time(), not on 'elapsed'.It might indeed be useful for some batch processes where 'operations' are more similar one to another, but precisely doesn't make sense for tests batches. Since this is outside of Dries original request, this could be left to a separate patch IMO.
Comment #21
catchI'd leave estimates to a separate patch - for downloads, installing windows, anything else - they're always wrong. Like progress bars that get to 99% then hang.
Reporting total time on the results page, +1.
Comment #22
dries commentedI was actually hoping to get the -actual- time, including bootstrap. IMO, it should match the wall clock time spent running the tests.
Comment #23
moshe weitzman commentedFYI, scripts/run-tests.sh already reports this - like a wall clock.
Comment #24
hswong3i commentedPatch reroll:
'Test run duration: @elapsed.Comment #26
boombatower commenteddue to: #74645: modify file_scan_directory to include a regex for the nomask.
Comment #27
hswong3i commentedAnyway... Just reroll the patch for testing.
Comment #28
dawehneri would really like to log/see how long a testcase needed to run,
so there could be performancetests on the testserver, before and after for certain patches
would it be possible to just write the starttime foreach tests, than we could get the difference between two testsCases and get running time
i attached a reroled patch
Comment #29
dries commentedCan we merge both status messages into one status message? See screenshot.
Comment #30
dawehnersure very easy
The output is "% sec", because of the use of format_interval, see the screenshot
Comment #31
birdmanx35 commentedI much prefer "The tests finished in @elapsed." I think (haven't made a patch for a while, worth double checking...) this patch reflects that change.
Comment #32
dries commentedCommitted to CVS HEAD. Thanks.