Graphviz 12.1.1~dev.20240814.0213
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
24typedef 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
32typedef 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
41static mytime_t T;
42
43void start_timer(void)
44{
45 GET_TIME(T);
46}
47
48double 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}
#define S
Definition expr.h:72
struct tms mytime_t
Definition timing.c:24
#define DIFF_IN_SECS(S, T)
Definition timing.c:26
double elapsed_sec(void)
Definition timing.c:48
void start_timer(void)
Definition timing.c:43
static mytime_t T
Definition timing.c:41
#define GET_TIME(S)
Definition timing.c:25
graphs, nodes and edges info: Agraphinfo_t, Agnodeinfo_t and Agedgeinfo_t