blob: 557334fea86af9f0427c1b9ced4df97a41be1343 [file] [log] [blame]
Jim Cownie18d84732014-05-10 17:02:09 +00001<ompts:test>
2<ompts:testdescription>Test which checks the omp_get_wtime function. It compares the time with which is called a sleep function with the time it took by messuring the difference between the call of the sleep function and its end.</ompts:testdescription>
3<ompts:ompversion>2.0</ompts:ompversion>
4<ompts:directive>omp_get_wtime</ompts:directive>
5<ompts:testcode>
6 INTEGER FUNCTION <ompts:testcode:functionname>omp_wtime</ompts:testcode:functionname>()
7 IMPLICIT NONE
8 <ompts:orphan:vars>
9 DOUBLE PRECISION start
10 DOUBLE PRECISION endtime
11 COMMON start, endtime
12 include "omp_lib.h"
13 </ompts:orphan:vars>
14 INTEGER wait_time
15 DOUBLE PRECISION measured_time
16 INTEGER fileunit
17 wait_time=1
18
19 start = 0;
20 endtime = 0;
21
22 <ompts:orphan>
23 <ompts:check>
24 start=omp_get_wtime()
25 </ompts:check>
26 </ompts:orphan>
27 CALL sleep(wait_time)
28 <ompts:orphan>
29 <ompts:check>
30 endtime=omp_get_wtime()
31 </ompts:check>
32 </ompts:orphan>
33 measured_time=endtime-start
34 WRITE(1,*) "work took",measured_time,"sec. time."
35 IF(measured_time.GT.0.99*wait_time .AND.
36 & measured_time .LT. 1.01*wait_time) THEN
37 <testfunctionname></testfunctionname>=1
38 ELSE
39 <testfunctionname></testfunctionname>=0
40 END IF
41 END
42</ompts:testcode>
43</ompts:test>