summaryrefslogtreecommitdiffstats
path: root/Modules/timing.h
blob: af26f1a6cb623e2a9294d76a9443990b2b662db6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
 * Copyright (c) 1993 George V. Neville-Neil
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *	This product includes software developed by George V. Neville-Neil
 * 4. The name, George Neville-Neil may not be used to endorse or promote 
 *    products derived from this software without specific prior 
 *    written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 */

#ifndef _TIMING_H_
#define _TIMING_H_

#ifdef TIME_WITH_SYS_TIME
#include <sys/time.h>
#include <time.h>
#else /* !TIME_WITH_SYS_TIME */
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#else /* !HAVE_SYS_TIME_H */
#include <time.h>
#endif /* !HAVE_SYS_TIME_H */
#endif /* !TIME_WITH_SYS_TIME */

static struct timeval aftertp, beforetp;

#define BEGINTIMING gettimeofday(&beforetp, NULL)

#define ENDTIMING gettimeofday(&aftertp, NULL); \
    if(beforetp.tv_usec > aftertp.tv_usec) \
    {  \
         aftertp.tv_usec += 1000000;  \
         aftertp.tv_sec--; \
    }

#define TIMINGUS (((aftertp.tv_sec - beforetp.tv_sec) * 1000000) + \
		  (aftertp.tv_usec - beforetp.tv_usec))

#define TIMINGMS (((aftertp.tv_sec - beforetp.tv_sec) * 1000) + \
		  ((aftertp.tv_usec - beforetp.tv_usec) / 1000))

#define TIMINGS  ((aftertp.tv_sec - beforetp.tv_sec) + \
		  (aftertp.tv_usec - beforetp.tv_usec) / 1000000)

#endif /* _TIMING_H_ */
> Tcl is a high-level, general-purpose, interpreted, dynamic programming language. It was designed with the goal of being very simple but powerful.
summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* | * library/tcltest/tcltest.tcl: Corrected parsing of singledgp2004-02-033-4/+15
| | | | | | | | | | command line argument (option with missing value) [Bug 833910] * library/tcltest/pkgIndex.tcl: Bump to version 2.2.5.
* | minor formatting and some commentary.davygrvy2004-02-021-9/+11
| |
* | no messagedavygrvy2004-02-021-0/+5
| |
* | * generic/tclIO.c (Tcl_Ungets): fixed improper filling of the channel buffer.davygrvy2004-02-021-3/+2
| | | | | | | | [Bug 405995]
* | * tests/winPipe.test: Six more cases added.davygrvy2004-02-022-12/+26
| | | | | | | | | | * win/tclWinPipe.c: Fixed BuildCommandLine() to pass the new cases.
* | * tests/winPipe.test: more cases with the "N backslashesdavygrvy2004-02-021-6/+9
| | | | | | | | | | followed a quote -> insert N * 2 + 1 backslashes then a quote" rule needed for the crt's parse_cmdline().
* | no messagedavygrvy2004-02-021-0/+8
| |
* | * tests/winPipe.test: Added proof that BuildCommandLine() is notdavygrvy2004-02-021-8/+12
| | | | | | | | | | | | | | | | doing the "N backslashes followed a quote -> insert N * 2 + 1 backslashes then a quote" rule needed for the crt's parse_cmdline(). * win/tclWinPipe.c: Fixed BuildCommandLine() to pass the new cases.
* | * tests/winPipe.test: Added proof that BuildCommandLine() is not doing thedavygrvy2004-02-011-18/+42
| | | | | | | | | | "N backslashes followed a quote -> insert N * 2 + 1 backslashes then a quote" rule needed for the crt's parse_cmdline().
* | no messagedavygrvy2004-02-011-2/+2
| |
* | * win/nmakehlp.c: defensive techniques to avoid static bufferdavygrvy2004-02-012-14/+22
| | | | | | | | | | overflows and a couple envars upsetting invokations of cl.exe and link.exe.
* | * tests/winPipe.test: more pass-thru commandline verifications.davygrvy2004-02-014-156/+92
| | | | | | | | | | | | | | * win/tclWinPipe.c (BuildCommandLine): Special case quoting for '{' not required by the c-runtimes's _setargv(). * win/tclAppInit.c: Removed our custom setargv() in favor of the one provided by the c-runtime. [Bug 672938]
* | no messagedavygrvy2004-01-301-0/+7
| |
* | * win/makefile.vc: Use the -GZ compiler switch when building fordavygrvy2004-01-301-3/+3
| | | | | | | | | | | | symbols. This is supposed to emulate the release build better to avoid hiding problems that would only show themselves in a release build.
* | fix to file normalization with linksvincentdarley2004-01-292-11/+47
| |
* | fix to test and commentvincentdarley2004-01-291-2/+11
| |
* | filesystem fixes for '-force' consistency and picky compilersvincentdarley2004-01-2912-102/+322
| |
* | Speed improvements to SetBooleanFromAny's string handlingdkf2004-01-282-153/+210
| | | | | | | | whitespace/style policing
* | no messagedavygrvy2004-01-281-0/+8
| |
* | * win/nmakehlp.c: Use '.\nul' as the sourcefile name instead ofdavygrvy2004-01-281-3/+6
| | | | | | | | | | | | | | 'nul' so VC 5.2 doesn't try searching the path for it and failing with a possible dialogbox popping up about having to add a CD to an empty drive. Also added a SetErrorMode() call to disable any dialogs. [Bug 885537]
* | filesystem documentation and testsvincentdarley2004-01-263-13/+19
| |
* | file normalize bug fixes for .. and .vincentdarley2004-01-236-18/+112
| |
* | no messagedavygrvy2004-01-221-0/+5
| |
* | mentions of 'panic' and 'panicVA' removed from the documentation.davygrvy2004-01-221-13/+3
| |
* | filesystem optimisation -- Three main issues accomplished: (1) cleaned up ↵vincentdarley2004-01-21