BRL-CAD
timerhep.c
Go to the documentation of this file.
1 /* T I M E R H E P . C
2  * BRL-CAD
3  *
4  * Copyright (c) 2004-2014 United States Government as represented by
5  * the U.S. Army Research Laboratory.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License
9  * version 2.1 as published by the Free Software Foundation.
10  *
11  * This library is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this file; see the file named COPYING for more
18  * information.
19  */
20 
21 #include "common.h"
22 
23 #include <stdio.h>
24 
25 
26 /* Standard System V stuff */
27 extern long time(time_t *);
28 static long time0;
29 
30 
31 void
33 {
34  (void)time(&time0);
35  (void)intime_();
36 }
37 
38 
39 double
40 rt_read_timer(char *str, int len)
41 {
42  long now;
43  double usert;
44  long htime[6];
45  char line[132];
46 
47  (void)stats_(htime);
48  (void)time(&now);
49  usert = ((double)htime[0]) / 10000000.0;
50  if (usert < 0.00001) usert = 0.00001;
51  sprintf(line, "%f secs: %ld wave, %ld fp, %ld dmem, %ld other",
52  usert,
53  htime[0], htime[1], htime[2], htime[3], htime[4]);
54  bu_strlcpy(str, line, len);
55  return usert;
56 }
57 
58 
59 /*
60  * Local Variables:
61  * mode: C
62  * tab-width: 8
63  * indent-tabs-mode: t
64  * c-file-style: "stroustrup"
65  * End:
66  * ex: shiftwidth=4 tabstop=8
67  */
Header file for the BRL-CAD common definitions.
long time(time_t *)
double rt_read_timer(char *str, int len)
Definition: timerhep.c:40
#define bu_strlcpy(dst, src, size)
Definition: str.h:60
time_t time0
Definition: timer-nt.c:32
void rt_prep_timer(void)
Definition: timerhep.c:32