Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
27
Task/Time-a-function/REXX/time-a-function-1.rexx
Normal file
27
Task/Time-a-function/REXX/time-a-function-1.rexx
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/*REXX program displays the elapsed time for a REXX function (or subroutine). */
|
||||
arg reps . /*obtain an optional argument from C.L.*/
|
||||
if reps=='' then reps=100000 /*Not specified? No, then use default.*/
|
||||
call time 'Reset' /*only the 1st character is examined. */
|
||||
junk = silly(reps) /*invoke the SILLY function (below). */
|
||||
/*───► CALL SILLY REPS also works.*/
|
||||
|
||||
/* The E is for elapsed time.*/
|
||||
/* │ ─ */
|
||||
/* ┌────◄───┘ */
|
||||
/* │ */
|
||||
/* ↓ */
|
||||
say 'function SILLY took' format(time("E"),,2) 'seconds for' reps "iterations."
|
||||
/* ↑ */
|
||||
/* │ */
|
||||
/* ┌────────►───────┘ */
|
||||
/* │ */
|
||||
/* The above 2 for the FORMAT function displays the time with*/
|
||||
/* two decimal digits (rounded) past the decimal point). Using */
|
||||
/* a 0 (zero) would round the time to whole seconds. */
|
||||
exit /*stick a fork in it, we're all done. */
|
||||
/*────────────────────────────────────────────────────────────────────────────*/
|
||||
silly: procedure /*chew up some CPU time doing some silly stuff.*/
|
||||
do j=1 for arg(1) /*wash, apply, lather, rinse, repeat. ··· */
|
||||
@.j=random() date() time() digits() fuzz() form() xrange() queued()
|
||||
end /*j*/
|
||||
return j-1
|
||||
27
Task/Time-a-function/REXX/time-a-function-2.rexx
Normal file
27
Task/Time-a-function/REXX/time-a-function-2.rexx
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/*REXX program displays the elapsed time for a REXX function (or subroutine). */
|
||||
arg reps . /*obtain an optional argument from C.L.*/
|
||||
if reps=='' then reps=100000 /*Not specified? No, then use default.*/
|
||||
call time 'Reset' /*only the 1st character is examined. */
|
||||
junk = silly(reps) /*invoke the SILLY function (below). */
|
||||
/*───► CALL SILLY REPS also works.*/
|
||||
|
||||
/* The J is for the CPU time used */
|
||||
/* │ by the REXX program since */
|
||||
/* ┌───────┘ since the time was RESET. */
|
||||
/* │ This is a Regina extension.*/
|
||||
/* ↓ */
|
||||
say 'function SILLY took' format(time("J"),,2) 'seconds for' reps "iterations."
|
||||
/* ↑ */
|
||||
/* │ */
|
||||
/* ┌────────►───────┘ */
|
||||
/* │ */
|
||||
/* The above 2 for the FORMAT function displays the time with*/
|
||||
/* two decimal digits (rounded) past the decimal point). Using */
|
||||
/* a 0 (zero) would round the time to whole seconds. */
|
||||
exit /*stick a fork in it, we're all done. */
|
||||
/*────────────────────────────────────────────────────────────────────────────*/
|
||||
silly: procedure /*chew up some CPU time doing some silly stuff.*/
|
||||
do j=1 for arg(1) /*wash, apply, lather, rinse, repeat. ··· */
|
||||
@.j=random() date() time() digits() fuzz() form() xrange() queued()
|
||||
end /*j*/
|
||||
return j-1
|
||||
Loading…
Add table
Add a link
Reference in a new issue