source: trunk/clocks.cpp

Last change on this file was 4, checked in by willem, 11 years ago

willem

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