Graphviz
13.0.0~dev.20241220.2304
Loading...
Searching...
No Matches
timing.c
Go to the documentation of this file.
1
3
/*************************************************************************
4
* Copyright (c) 2011 AT&T Intellectual Property
5
* All rights reserved. This program and the accompanying materials
6
* are made available under the terms of the Eclipse Public License v1.0
7
* which accompanies this distribution, and is available at
8
* https://www.eclipse.org/legal/epl-v10.html
9
*
10
* Contributors: Details at https://graphviz.org
11
*************************************************************************/
12
13
#ifndef _WIN32
14
15
#include <sys/types.h>
16
#include <sys/times.h>
17
#include <sys/param.h>
18
19
20
21
#ifndef HZ
22
#define HZ 60
23
#endif
24
typedef
struct
tms
mytime_t
;
25
#define GET_TIME(S) times(&(S))
26
#define DIFF_IN_SECS(S,T) ((S.tms_utime + S.tms_stime - T.tms_utime - T.tms_stime)/(double)HZ)
27
28
#else
29
30
#include <time.h>
31
32
typedef
clock_t
mytime_t
;
33
#define GET_TIME(S) S = clock()
34
#define DIFF_IN_SECS(S,T) ((S - T) / (double)CLOCKS_PER_SEC)
35
36
#endif
37
38
#include <
common/types.h
>
39
#include <
common/utils.h
>
40
41
static
mytime_t
T
;
42
43
void
start_timer
(
void
)
44
{
45
GET_TIME
(
T
);
46
}
47
48
double
elapsed_sec
(
void
)
49
{
50
mytime_t
S
;
51
double
rv;
52
53
GET_TIME
(
S
);
54
rv =
DIFF_IN_SECS
(
S
,
T
);
55
return
rv;
56
}
S
#define S
Definition
expr.h:72
mytime_t
struct tms mytime_t
Definition
timing.c:24
DIFF_IN_SECS
#define DIFF_IN_SECS(S, T)
Definition
timing.c:26
elapsed_sec
double elapsed_sec(void)
Definition
timing.c:48
start_timer
void start_timer(void)
Definition
timing.c:43
T
static mytime_t T
Definition
timing.c:41
GET_TIME
#define GET_TIME(S)
Definition
timing.c:25
types.h
graphs, nodes and edges info: Agraphinfo_t, Agnodeinfo_t and Agedgeinfo_t
utils.h
lib
common
timing.c
Generated by
1.9.8