Just another update
This commit is contained in:
parent
a25938f123
commit
00a190b0a6
6591 changed files with 94363 additions and 23227 deletions
|
|
@ -1,5 +1,13 @@
|
|||
Write a program which uses a timer (with the least granularity available on your system) to time how long a function takes to execute.
|
||||
{{omit from|Batch File|No way to programmatically retrieving the current or elapsed time. Only human-readable formats available, which can't be parsed accurately.}}
|
||||
{{omit from|GUISS}}
|
||||
{{omit from|ML/I}}
|
||||
|
||||
Whenever possible, use methods which measure only the processing time used by the current process; instead of the difference in [[system time]] between start and finish, which could include time used by other processes on the computer.
|
||||
Write a program which uses a timer (with the least granularity available
|
||||
on your system) to time how long a function takes to execute.
|
||||
|
||||
Whenever possible, use methods which measure only the processing time used
|
||||
by the current process; instead of the difference in [[system time]]
|
||||
between start and finish, which could include time used by
|
||||
other processes on the computer.
|
||||
|
||||
This task is intended as a subtask for [[Measure relative performance of sorting algorithms implementations]].
|
||||
|
|
|
|||
|
|
@ -1,2 +1,4 @@
|
|||
---
|
||||
category:
|
||||
- Date and time
|
||||
note: Programming environment operations
|
||||
|
|
|
|||
14
Task/Time-a-function/Bracmat/time-a-function.bracmat
Normal file
14
Task/Time-a-function/Bracmat/time-a-function.bracmat
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
( ( time
|
||||
= fun funarg t0 ret
|
||||
. !arg:(?fun.?funarg)
|
||||
& clk$:?t0
|
||||
& !fun$!funarg:?ret
|
||||
& (!ret.flt$(clk$+-1*!t0,3) s)
|
||||
)
|
||||
& ( fib
|
||||
=
|
||||
. !arg:<2&1
|
||||
| fib$(!arg+-1)+fib$(!arg+-2)
|
||||
)
|
||||
& time$(fib.30)
|
||||
)
|
||||
|
|
@ -7,11 +7,12 @@ c For testing we just do nothing for 3 seconds
|
|||
|
||||
c Main Program
|
||||
program timing
|
||||
integer(kind=8) start,finish,rate,max
|
||||
call system_clock(start,rate,max)
|
||||
integer(kind=8) start,finish,rate
|
||||
call system_clock(count_rate=rate)
|
||||
call system_clock(start)
|
||||
c Here comes the function we want to time
|
||||
call do_something()
|
||||
call system_clock(finish,rate,max)
|
||||
write(6,*) 'Elapsed Time in seconds:',(finish-start)/rate
|
||||
call system_clock(finish)
|
||||
write(6,*) 'Elapsed Time in seconds:',float(finish-start)/rate
|
||||
return
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue