Debian Codegraph @

debian/external_deps/fetk/punc/tools/tests/pmg/secd.c

raw
1 /* ///////////////////////////////////////////////////////////////////////////
2 // @file secd.c
3 // @author Michael Holst
4 // @brief Timing routines.
5 // @version $Id: secd.c,v 1.2 2010/08/12 05:53:10 fetk Exp $
6 // @attention
7 // @verbatim
8 //
9 // PMG -- Parallel algebraic MultiGrid
10 // Copyright (C) 1994-- Michael Holst.
11 //
12 // Michael Holst <[email protected]>
13 // University of California, San Diego
14 // Department of Mathematics, 5739 AP&M
15 // 9500 Gilman Drive, Dept. 0112
16 // La Jolla, CA 92093-0112 USA
17 // http://math.ucsd.edu/~mholst
18 //
19 // This file is part of PMG.
20 //
21 // PMG is free software; you can redistribute it and/or modify
22 // it under the terms of the GNU General Public License as published by
23 // the Free Software Foundation; either version 2 of the License, or
24 // (at your option) any later version.
25 //
26 // PMG is distributed in the hope that it will be useful,
27 // but WITHOUT ANY WARRANTY; without even the implied warranty of
28 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 // GNU General Public License for more details.
30 //
31 // You should have received a copy of the GNU General Public License
32 // along with PMG; if not, write to the Free Software
33 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
34 //
35 // Linking PMG statically or dynamically with other modules is making a
36 // combined work based on PMG. Thus, the terms and conditions of the GNU
37 // General Public License cover the whole combination.
38 //
39 // SPECIAL GPL EXCEPTION
40 // In addition, as a special exception, the copyright holders of PMG
41 // give you permission to combine the PMG program with free software
42 // programs and libraries that are released under the GNU LGPL or with
43 // code included in releases of ISIM, PMV, PyMOL, SMOL, VMD, and Vision.
44 // Such combined software may be linked with PMG and redistributed together
45 // in original or modified form as mere aggregation without requirement that
46 // the entire work be under the scope of the GNU General Public License.
47 // This special exception permission is also extended to any software listed
48 // in the SPECIAL GPL EXCEPTION clauses by the FEtk and APBS libraries.
49 //
50 // Note that people who make modified versions of PMG are not obligated
51 // to grant this special exception for their modified versions; it is
52 // their choice whether to do so. The GNU General Public License gives
53 // permission to release a modified version without this exception; this
54 // exception also makes it possible to release a modified version which
55 // carries forward this exception.
56 //
57 // @endverbatim
58 // //////////////////////////////////////////////////////////////////////// */
59
60 /* ******************************************************************* */
61 /* purpose: */
62 /* */
63 /* Returns the time in seconds used by the process. */
64 /* The system call is "getrusage", which returns a */
65 /* struct containing various pieces of resource usage information. */
66 /* */
67 /* Machine: */
68 /* */
69 /* most UNIX machines */
70 /* */
71 /* author: michael holst */
72 /* ******************************************************************* */
73 #include <stdio.h>
74 #include <sys/time.h>
75 #include <sys/types.h>
76 #include <sys/resource.h>
77 double tsecnd_()
78 {
79 static struct rusage temp;
80 long foo, foo1;
81
82 getrusage(RUSAGE_SELF,&temp) ; /* get clock */
83 foo = temp.ru_utime.tv_sec ; /* seconds */
84 foo1 = temp.ru_utime.tv_usec ; /* uSecs */
85 return ((double)foo + (double)foo1*0.000001) ; /* milliseconds */
86 }