libosmscout
1.1.1
Toggle main menu visibility
Loading...
Searching...
No Matches
libosmscout
include
osmscout
util
StopClock.h
Go to the documentation of this file.
1
#ifndef OSMSCOUT_UTIL_STOPCLOCK_H
2
#define OSMSCOUT_UTIL_STOPCLOCK_H
3
4
/*
5
This source is part of the libosmscout library
6
Copyright (C) 2009 Tim Teulings
7
8
This library is free software; you can redistribute it and/or
9
modify it under the terms of the GNU Lesser General Public
10
License as published by the Free Software Foundation; either
11
version 2.1 of the License, or (at your option) any later version.
12
13
This library is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
Lesser General Public License for more details.
17
18
You should have received a copy of the GNU Lesser General Public
19
License along with this library; if not, write to the Free Software
20
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
*/
22
23
#include <chrono>
24
#include <string>
25
26
#include <
osmscout/system/Compiler.h
>
27
28
#include <
osmscout/lib/CoreImportExport.h
>
29
30
namespace
osmscout
{
31
36
class
OSMSCOUT_API
StopClock
CLASS_FINAL
37
{
38
private
:
39
std::chrono::steady_clock::time_point start;
40
std::chrono::steady_clock::time_point stop;
41
42
public
:
43
StopClock
();
44
~StopClock
() =
default
;
45
46
StopClock
(
const
StopClock
&) =
delete
;
// We do not want you to make copies of a stop clock
47
StopClock
(
StopClock
&&) =
default
;
// moves are fine
48
49
StopClock
&
operator=
(
const
StopClock
&) =
delete
;
50
StopClock
&
operator=
(
StopClock
&&) =
default
;
51
52
void
Stop
();
53
54
double
GetMilliseconds
()
const
;
55
std::chrono::steady_clock::duration
GetDuration
()
const
;
56
57
bool
IsSignificant
()
const
;
58
59
std::string
ResultString
()
const
;
60
61
friend
OSMSCOUT_API
std::ostream&
operator<<
(std::ostream& stream,
const
StopClock
& stopClock);
62
};
63
64
extern
OSMSCOUT_API
std::ostream&
operator<<
(std::ostream& stream,
const
StopClock& stopClock);
65
70
class
OSMSCOUT_API
StopClockNano
CLASS_FINAL
71
{
72
private
:
73
std::chrono::high_resolution_clock::time_point start;
74
std::chrono::high_resolution_clock::time_point stop;
75
76
public
:
77
StopClockNano
();
78
~StopClockNano
() =
default
;
79
80
StopClockNano
(
const
StopClockNano
& other) =
delete
;
81
StopClockNano
(
StopClockNano
&&) =
default
;
// moves are fine
82
83
StopClockNano
&
operator=
(
const
StopClockNano
&) =
delete
;
84
StopClockNano
&
operator=
(
StopClockNano
&&) =
default
;
85
86
void
Stop
();
87
88
double
GetNanoseconds
()
const
;
89
90
std::string
ResultString
()
const
;
91
92
friend
OSMSCOUT_API
std::ostream&
operator<<
(std::ostream& stream,
const
StopClockNano
& stopClock);
93
};
94
95
extern
OSMSCOUT_API
std::ostream&
operator<<
(std::ostream& stream,
const
StopClockNano& stopClock);
96
97
}
98
99
#endif
Compiler.h
CoreImportExport.h
OSMSCOUT_API
#define OSMSCOUT_API
Definition
CoreImportExport.h:45
osmscout::CLASS_FINAL
Definition
Area.h:88
osmscout::CLASS_FINAL::StopClockNano
StopClockNano()
osmscout::CLASS_FINAL::~StopClockNano
~StopClockNano()=default
osmscout::CLASS_FINAL::StopClock
StopClock(const StopClock &)=delete
osmscout::CLASS_FINAL::operator=
StopClock & operator=(StopClock &&)=default
osmscout::CLASS_FINAL::operator=
StopClock & operator=(const StopClock &)=delete
osmscout::CLASS_FINAL::StopClockNano
StopClockNano(const StopClockNano &other)=delete
osmscout::CLASS_FINAL::StopClockNano
StopClockNano(StopClockNano &&)=default
osmscout::CLASS_FINAL::GetDuration
std::chrono::steady_clock::duration GetDuration() const
osmscout::CLASS_FINAL::StopClock
StopClock()
osmscout::CLASS_FINAL::operator<<
friend OSMSCOUT_API std::ostream & operator<<(std::ostream &stream, const StopClockNano &stopClock)
osmscout::CLASS_FINAL::IsSignificant
bool IsSignificant() const
osmscout::CLASS_FINAL::operator=
StopClockNano & operator=(StopClockNano &&)=default
osmscout::CLASS_FINAL::StopClock
StopClock(StopClock &&)=default
osmscout::CLASS_FINAL::Stop
void Stop()
osmscout::CLASS_FINAL::~StopClock
~StopClock()=default
osmscout::CLASS_FINAL::GetNanoseconds
double GetNanoseconds() const
osmscout::CLASS_FINAL::GetMilliseconds
double GetMilliseconds() const
osmscout::CLASS_FINAL::operator=
StopClockNano & operator=(const StopClockNano &)=delete
osmscout::CLASS_FINAL::operator<<
friend OSMSCOUT_API std::ostream & operator<<(std::ostream &stream, const StopClock &stopClock)
osmscout::CLASS_FINAL::ResultString
std::string ResultString() const
osmscout
Definition
Area.h:39
osmscout::operator<<
std::ostream & operator<<(std::ostream &stream, const DBId &o)
Definition
DBFileOffset.h:80
Generated by
1.17.0