/[ascend]/trunk/base/generic/general/tm_time.h
ViewVC logotype

Annotation of /trunk/base/generic/general/tm_time.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 592 - (hide annotations) (download) (as text)
Fri May 12 09:50:57 2006 UTC (14 years, 10 months ago) by johnpye
File MIME type: text/x-chdr
File size: 4831 byte(s)
Working on adding some more export symbols, for purpose of getting Jerry's test suite to work with SCons build.
1 johnpye 485 /* ASCEND modelling environment
2     Copyright (C) 1997 Carnegie Mellon University
3     Copyright (C) 2006 Carnegie Mellon University
4 aw0a 1
5 johnpye 485 This program is free software; you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation; either version 2, or (at your option)
8     any later version.
9 jds 54
10 johnpye 485 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 License
16     along with this program; if not, write to the Free Software
17     Foundation, Inc., 59 Temple Place - Suite 330,
18     Boston, MA 02111-1307, USA.
19     *//**
20     @file
21     Time module
22    
23     Provide a function to monitor elapsed time during the
24     course of execution of a program and standard ANSI
25     primitives for performing calendar calculations.
26    
27     @TODO (Apology) We apologize for the existence of this file and for
28     its name being the same as an ANSI C header which is not
29     consistently available, unfortunately. We really
30     ought not to need this header.
31    
32     06/90 - original version
33     08/93 - removed CLOCKS_PER_SECOND which should be
34     provided by the standard library, eliminated
35     tm_TPS and changed tm_run_time() and
36     tm_cpu_time() to return number of seconds
37     06/94 - eliminated cute calendar functions for full
38     ANSI compatibility.
39    
40     Requires:
41     #include "utilities/ascConfig.h"
42     *//*
43     by Karl Westerberg and Joseph Zaher
44     Created: 6/90
45     Version: $Revision: 1.1 $
46     Version control file: $RCSfile: tm_time.h,v $
47     Date last modified: $Date: 2000/01/25 02:21:26 $
48     Last modified by: $Author: ballan $
49     */
50    
51 johnpye 67 #ifndef ASC_TM_TIME_H
52     #define ASC_TM_TIME_H
53 aw0a 1
54 johnpye 485 #include <utilities/ascConfig.h>
55    
56 aw0a 1 #ifndef CLOCKS_PER_SEC
57    
58 jds 54 /* case linux */
59 aw0a 1 #ifdef linux
60 jds 54 #define CLOCKS_PER_SEC 100 /**< Typical clock ticks per sec. */
61     #endif /* linux */
62 aw0a 1
63 jds 54 /* case windoze */
64 jds 59 #ifdef __WIN32__
65 jds 54 #define CLOCKS_PER_SEC 1000 /**< Typical clock ticks per sec. */
66     #endif /* windoze */
67 aw0a 1
68 jds 54 /* default */
69 aw0a 1 #ifndef CLOCKS_PER_SEC
70 jds 59 #define CLOCKS_PER_SEC 1000000
71     /**<
72     * Typical clock ticks per sec. Note that typically clocks
73     * have a minimum resolution of 16666, sigh.
74     */
75 jds 54 #endif /* default */
76 aw0a 1
77 jds 54 #endif /* CLOCKS_PER_SEC */
78 aw0a 1
79 johnpye 490 ASC_DLLSPEC(double) tm_cpu_time(void);
80 jds 59 /**<
81     * Returns elapsed CPU time in seconds since the first call
82     * to a timing function. The timing functions that, when
83     * initially called, set the start time for all others are:
84     * - tm_cpu_time()
85     * - tm_cpu_time_ftn_()
86     * - aftime_()
87     * - tm_cpu_time_ftn()
88     * - aftime()
89     * - TM_CPU_TIME_FTN()
90     * - AFTIME()
91     *
92     * Users timing portions of the process should maintain their
93     * own start time and work by difference as the solvers do.
94     *
95     * @return The elapsed CPU time since the 1st call to a timing function.
96 aw0a 1 */
97    
98 jds 59 extern double tm_reset_cpu_time(void);
99     /**<
100     * Resets the start time. Use with caution if there are
101     * multiple callers depending on a constant start time stamp.
102     * This function is primarily for testing purposes.
103     *
104     * @return The initiallized elapsed CPU time.
105     */
106    
107     extern void tm_cpu_time_ftn_(double *time);
108     /**<
109     * Stores elapsed CPU time in seconds since the first call
110     * to a timing function in *t*. The timing functions that, when
111     * initially called, set the start time for all others are:
112     * - tm_cpu_time()
113     * - tm_cpu_time_ftn_()
114     * - aftime_()
115     * - tm_cpu_time_ftn()
116     * - aftime()
117     * - TM_CPU_TIME_FTN()
118     * - AFTIME()
119     *
120     * This function takes a (double *) to satisfy FORTRAN's call
121     * by reference semantics.
122 jds 54 * <pre>
123 aw0a 1 * f77 usage: t is real*8 (double precision on most f77)
124 jds 59 * external aftime, tm_cpu_time_ftn
125     * call tm_cpu_time_ftn(t)
126     * call aftime(t)
127 jds 54 * </pre>
128 aw0a 1 * On return t will have a time value (sec) stored in a double.
129 jds 59 * The specified t may not be NULL (checked by assertion).<br><br>
130     *
131 aw0a 1 * If your F77 compiler doesn't morph all function calls to
132     * lower case (with or without trailing underbar), you will need
133     * to figure out its morphing convention and modify tm.[ch] so.
134 jds 59 *
135     * @param t Location to store the elapsed CPU time in seconds.
136 aw0a 1 */
137    
138 jds 59 extern void aftime_(double *time);
139     /**< Short name for tm_cpu_time_ftn_() to satisfy FORTRAN's 6 char restriction. */
140     extern void tm_cpu_time_ftn(double *time);
141     /**< Variant of tm_cpu_time_ftn_(). */
142     extern void aftime(double *time);
143     /**< Short name for tm_cpu_time_ftn() to satisfy FORTRAN's 6 char restriction. */
144     extern void TM_CPU_TIME_FTN(double *time);
145     /**< Variant of tm_cpu_time_ftn_(). */
146 johnpye 592
147     ASC_DLLSPEC(void) AFTIME(double *time);
148 jds 59 /**< Short name for TM_CPU_TIME_FTN() to satisfy FORTRAN's 6 char restriction. */
149    
150 johnpye 67 #endif /* ASC_TM_TIME_H */
151 jds 54

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22