~ubuntu-branches/debian/jessie/eso-midas/jessie

« back to all changes in this revision

Viewing changes to util/bench/linpack100/cetime.c

  • Committer: Package Import Robot
  • Author(s): Ole Streicher
  • Date: 2014-04-22 14:44:58 UTC
  • Revision ID: package-import@ubuntu.com-20140422144458-okiwi1assxkkiz39
Tags: upstream-13.09pl1.2+dfsg
ImportĀ upstreamĀ versionĀ 13.09pl1.2+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* @(#)cetime.c 19.1 (ES0-DMD) 02/25/03 14:35:47 */
 
2
/*===========================================================================
 
3
  Copyright (C) 1995 European Southern Observatory (ESO)
 
4
 
 
5
  This program is free software; you can redistribute it and/or 
 
6
  modify it under the terms of the GNU General Public License as 
 
7
  published by the Free Software Foundation; either version 2 of 
 
8
  the License, or (at your option) any later version.
 
9
 
 
10
  This program is distributed in the hope that it will be useful,
 
11
  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
  GNU General Public License for more details.
 
14
 
 
15
  You should have received a copy of the GNU General Public 
 
16
  License along with this program; if not, write to the Free 
 
17
  Software Foundation, Inc., 675 Massachusetss Ave, Cambridge, 
 
18
  MA 02139, USA.
 
19
 
 
20
  Corresponding concerning ESO-MIDAS should be addressed as follows:
 
21
        Internet e-mail: midas@eso.org
 
22
        Postal address: European Southern Observatory
 
23
                        Data Management Division 
 
24
                        Karl-Schwarzschild-Strasse 2
 
25
                        D 85748 Garching bei Muenchen 
 
26
                        GERMANY
 
27
===========================================================================*/
 
28
 
 
29
cetime(pa)   float *pa; { c_etime(pa); }
 
30
_cetime(pa)  float *pa; { c_etime(pa); }
 
31
cetime_(pa)  float *pa; { c_etime(pa); }
 
32
_cetime_(pa) float *pa; { c_etime(pa); }
 
33
CETIME(pa)   float *pa; { c_etime(pa); }
 
34
_CETIME(pa)  float *pa; { c_etime(pa); }
 
35
CETIME_(pa)  float *pa; { c_etime(pa); }
 
36
_CETIME_(pa) float *pa; { c_etime(pa); }
 
37
 
 
38
#ifdef SYSV_V2          /* For pure SYSTEM_V systems */
 
39
#include <sys/types.h>
 
40
#include <sys/times.h>
 
41
static struct tms buff;
 
42
#ifndef CLK_TCK
 
43
#define CLK_TCK 60
 
44
#endif
 
45
c_etime(pa) 
 
46
float *pa;
 
47
{
 
48
        times(&buff);
 
49
        pa[0] = (float)buff.tms_utime/(float)CLK_TCK;
 
50
        pa[1] = (float)buff.tms_stime/(float)CLK_TCK;
 
51
}
 
52
#else                   /* For BSD systems */
 
53
#include <sys/time.h>
 
54
#include <sys/resource.h>
 
55
static struct rusage rusage;
 
56
c_etime(pa) 
 
57
float *pa;
 
58
{
 
59
        getrusage(RUSAGE_SELF, &rusage);
 
60
        pa[0] = (float)rusage.ru_utime.tv_sec + (float)rusage.ru_utime.tv_usec/(float)1000000;
 
61
        pa[1] = (float)rusage.ru_stime.tv_sec + (float)rusage.ru_stime.tv_usec/(float)1000000;
 
62
}
 
63
#endif