Audio Processing Framework (APF)
version 0.5.0
apf
stopwatch.h
Go to the documentation of this file.
1
/******************************************************************************
2
Copyright (c) 2012-2016 Institut für Nachrichtentechnik, Universität Rostock
3
Copyright (c) 2006-2012 Quality & Usability Lab
4
Deutsche Telekom Laboratories, TU Berlin
5
6
Permission is hereby granted, free of charge, to any person obtaining a copy
7
of this software and associated documentation files (the "Software"), to deal
8
in the Software without restriction, including without limitation the rights
9
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
copies of the Software, and to permit persons to whom the Software is
11
furnished to do so, subject to the following conditions:
12
13
The above copyright notice and this permission notice shall be included in
14
all copies or substantial portions of the Software.
15
16
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
THE SOFTWARE.
23
*******************************************************************************/
24
25
// https://AudioProcessingFramework.github.io/
26
29
30
// TODO: check C++11 timing tools:
31
// http://bstamour.ca/2012/05/13/timing-functions-with-chrono/
32
// http://solarianprogrammer.com/2012/10/14/cpp-11-timing-code-performance/
33
// http://ideone.com/clone/SCRI6
34
// http://kjellkod.wordpress.com/2012/02/06/exploring-c11-part-1-time/
35
36
#include <ctime>
37
#include <iostream>
38
39
namespace
apf
40
{
41
43
class
StopWatch
44
{
45
public
:
46
StopWatch
(
const
std::string& name =
"this activity"
) :
47
_start(std::clock()),
48
_name(name)
49
{}
50
51
~StopWatch
()
52
{
53
clock_t total = std::clock() - _start;
54
std::cout << _name <<
" took "
<< double(total)/CLOCKS_PER_SEC
55
<<
" seconds."
<< std::endl;
56
}
57
58
private
:
59
std::clock_t _start;
60
std::string _name;
61
};
62
63
}
// namespace apf
apf::StopWatch
A simple stopwatch.
Definition:
stopwatch.h:44
apf
Audio Processing Framework.
Definition:
iterator.h:61
Generated by
1.9.4