Rev | Line | |
---|
[7] | 1 | |
---|
| 2 | /* |
---|
| 3 | Copyright 2013 Willem Vermin, SURFsara |
---|
| 4 | |
---|
| 5 | Licensed under the Apache License, Version 2.0 (the "License"); |
---|
| 6 | you may not use this file except in compliance with the License. |
---|
| 7 | You may obtain a copy of the License at |
---|
| 8 | |
---|
| 9 | http://www.apache.org/licenses/LICENSE-2.0 |
---|
| 10 | |
---|
| 11 | Unless required by applicable law or agreed to in writing, software |
---|
| 12 | distributed under the License is distributed on an "AS IS" BASIS, |
---|
| 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
---|
| 14 | See the License for the specific language governing permissions and |
---|
| 15 | limitations under the License. |
---|
| 16 | */ |
---|
| 17 | #include <sys/times.h> |
---|
| 18 | #include <sys/time.h> |
---|
| 19 | #include <time.h> |
---|
| 20 | #include <stdlib.h> |
---|
| 21 | #include "clocks.h" |
---|
| 22 | #include <unistd.h> |
---|
| 23 | double cputime() /* aix, xlf */ |
---|
| 24 | { struct tms b; |
---|
| 25 | clock_t r; |
---|
| 26 | times( &b); |
---|
| 27 | r = b.tms_utime + b.tms_stime; |
---|
| 28 | return ( (double) r/(double) sysconf(_SC_CLK_TCK)); |
---|
| 29 | } |
---|
| 30 | double CPUTIME() /* cray */ |
---|
| 31 | { |
---|
| 32 | return ( cputime()); |
---|
| 33 | } |
---|
| 34 | double cputime_() /* g77, gcc */ |
---|
| 35 | { |
---|
| 36 | return ( cputime()); |
---|
| 37 | } |
---|
| 38 | |
---|
| 39 | double wallclock() |
---|
| 40 | { |
---|
| 41 | struct timeval toot; |
---|
| 42 | double r; |
---|
| 43 | |
---|
| 44 | gettimeofday(&toot,0); |
---|
| 45 | r=toot.tv_sec+0.000001*(double)toot.tv_usec; |
---|
| 46 | return(r); |
---|
| 47 | } |
---|
| 48 | double WALLCLOCK() |
---|
| 49 | { |
---|
| 50 | return (wallclock()); |
---|
| 51 | } |
---|
| 52 | double wallclock_() |
---|
| 53 | { |
---|
| 54 | return wallclock(); |
---|
| 55 | } |
---|
| 56 | |
---|
| 57 | void fortransleep(int *i) |
---|
| 58 | { |
---|
| 59 | sleep(*i); |
---|
| 60 | } |
---|
| 61 | |
---|
| 62 | void FORTRANSLEEP(int *i) |
---|
| 63 | { |
---|
| 64 | sleep(*i); |
---|
| 65 | } |
---|
| 66 | |
---|
| 67 | void fortransleep_(int *i) |
---|
| 68 | { |
---|
| 69 | sleep(*i); |
---|
| 70 | } |
---|
| 71 | |
---|
Note: See
TracBrowser
for help on using the repository browser.