source: trunk/indexers/mg/lib/timing.h@ 3745

Last change on this file since 3745 was 3745, checked in by mdewsnip, 21 years ago

Addition of MG package for search and retrieval

  • 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 * $Id: timing.h 3745 2003-02-20 21:20:24Z mdewsnip $
21 *
22 **************************************************************************/
23
24#ifndef H_TIMING
25#define H_TIMING
26
27
28#ifdef HAVE_TIMES
29# if TIME_WITH_SYS_TIME
30# include <sys/times.h>
31# include <time.h>
32# ifndef CLK_TCK
33# define CLK_TCK sysconf(_SC_CLK_TCK)
34# endif
35# else
36# if HAVE_SYS_TIME_H
37# include <sys/time.h>
38# else
39# include <time.h>
40# endif
41# endif
42#else
43/* [RPAP - Feb 97: WIN32 Port] */
44# ifdef __WIN32__
45 struct timeval { long tv_sec, tv_usec; };
46# else
47# include <sys/time.h>
48# include <sys/resource.h>
49# endif
50#endif
51
52
53typedef struct
54 {
55 double RealTime, CPUTime;
56 }
57ProgTime;
58
59double RealTime (void);
60
61double CPUTime (double *user, double *sys);
62
63void GetTime (ProgTime * StartTime);
64
65/* FinishTime may be NULL */
66char *ElapsedTime (ProgTime * StartTime, ProgTime * FinishTime);
67
68#ifdef HAVE_TIMES
69char *cputime_string (clock_t clk);
70#else
71void time_normalise (struct timeval *t);
72char *cputime_string (struct timeval *t);
73#endif
74
75#endif
Note: See TracBrowser for help on using the repository browser.