GRASS GIS 8 Programmer's Manual
8.5.0dev(2024)-f63024f571
rtimer.cpp
Go to the documentation of this file.
1
/****************************************************************************
2
*
3
* MODULE: iostream
4
*
5
6
* COPYRIGHT (C) 2007 Laura Toma
7
*
8
*
9
10
* Iostream is a library that implements streams, external memory
11
* sorting on streams, and an external memory priority queue on
12
* streams. These are the fundamental components used in external
13
* memory algorithms.
14
15
* Credits: The library was developed by Laura Toma. The kernel of
16
* class STREAM is based on the similar class existent in the GPL TPIE
17
* project developed at Duke University. The sorting and priority
18
* queue have been developed by Laura Toma based on communications
19
* with Rajiv Wickremesinghe. The library was developed as part of
20
* porting Terraflow to GRASS in 2001. PEARL upgrades in 2003 by
21
* Rajiv Wickremesinghe as part of the Terracost project.
22
23
*
24
* This program is free software; you can redistribute it and/or modify
25
* it under the terms of the GNU General Public License as published by
26
* the Free Software Foundation; either version 2 of the License, or
27
* (at your option) any later version.
28
*
29
30
* This program is distributed in the hope that it will be useful,
31
* but WITHOUT ANY WARRANTY; without even the implied warranty of
32
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
33
* General Public License for more details. *
34
* **************************************************************************/
35
36
#include <sys/time.h>
37
#include <stdio.h>
38
#include <string.h>
39
#include <strings.h>
40
41
#include <
grass/iostream/rtimer.h
>
42
43
#define BUFMAX 256
44
45
char
*
rt_sprint_safe
(
char
*buf,
Rtimer
rt)
46
{
47
if
(
rt_w_useconds
(rt) == 0) {
48
snprintf(buf,
BUFMAX
,
"[%4.2fu (%.0f%%) %4.2fs (%.0f%%) %4.2f %.1f%%]"
,
49
0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
50
}
51
else
{
52
snprintf(buf,
BUFMAX
,
"[%4.2fu (%.0f%%) %4.2fs (%.0f%%) %4.2f %.1f%%]"
,
53
rt_u_useconds
(rt) / 1000000,
54
100.0 *
rt_u_useconds
(rt) /
rt_w_useconds
(rt),
55
rt_s_useconds
(rt) / 1000000,
56
100.0 *
rt_s_useconds
(rt) /
rt_w_useconds
(rt),
57
rt_w_useconds
(rt) / 1000000,
58
100.0 * (
rt_u_useconds
(rt) +
rt_s_useconds
(rt)) /
59
rt_w_useconds
(rt));
60
}
61
return
buf;
62
}
BUFMAX
#define BUFMAX
Definition:
rtimer.cpp:43
rt_sprint_safe
char * rt_sprint_safe(char *buf, Rtimer rt)
Definition:
rtimer.cpp:45
rtimer.h
rt_s_useconds
#define rt_s_useconds(rt)
Definition:
rtimer.h:103
rt_w_useconds
#define rt_w_useconds(rt)
Definition:
rtimer.h:109
rt_u_useconds
#define rt_u_useconds(rt)
Definition:
rtimer.h:97
Rtimer
Definition:
rtimer.h:77
lib
iostream
rtimer.cpp
Generated on Fri Nov 22 2024 07:03:26 for GRASS GIS 8 Programmer's Manual by
1.9.1