source: trunk/gsdl3/src/packages/mg/lib/timing.h@ 13654

Last change on this file since 13654 was 13654, checked in by kjdon, 17 years ago

tidied up the top comments, removed Ids, and old log messages

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 1.8 KB
Line 
1/**************************************************************************
2 *
3 * timing.h -- Program timing routines
4 * Copyright (C) 1994 Neil Sharman
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 *
20 **************************************************************************/
21
22#ifndef H_TIMING
23#define H_TIMING
24
25
26#ifdef HAVE_TIMES
27# if TIME_WITH_SYS_TIME
28# include <sys/times.h>
29# include <time.h>
30# ifndef CLK_TCK
31# define CLK_TCK sysconf(_SC_CLK_TCK)
32# endif
33# else
34# if HAVE_SYS_TIME_H
35# include <sys/time.h>
36# else
37# include <time.h>
38# endif
39# endif
40#else
41/* [RPAP - Feb 97: WIN32 Port] */
42# ifdef __WIN32__
43 struct timeval { long tv_sec, tv_usec; };
44# else
45# include <sys/time.h>
46# include <sys/resource.h>
47# endif
48#endif
49
50
51typedef struct
52 {
53 double RealTime, CPUTime;
54 }
55ProgTime;
56
57double RealTime (void);
58
59double CPUTime (double *user, double *sys);
60
61void GetTime (ProgTime * StartTime);
62
63/* FinishTime may be NULL */
64char *ElapsedTime (ProgTime * StartTime, ProgTime * FinishTime);
65
66#ifdef HAVE_TIMES
67char *cputime_string (clock_t clk);
68#else
69void time_normalise (struct timeval *t);
70char *cputime_string (struct timeval *t);
71#endif
72
73#endif
Note: See TracBrowser for help on using the repository browser.