use -r argument with JACK if realtime is not requested in engine dialog (also applied...
[ArdourMidi.git] / libs / rubberband / src / Profiler.h
blob616a553ecb2d10fc8e96354044985fca277f5591
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
3 /*
4 Rubber Band
5 An audio time-stretching and pitch-shifting library.
6 Copyright 2007-2008 Chris Cannam.
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License as
10 published by the Free Software Foundation; either version 2 of the
11 License, or (at your option) any later version. See the file
12 COPYING included with this distribution for more information.
15 #ifndef _PROFILER_H_
16 #define _PROFILER_H_
18 #define NO_TIMING 1
20 //#define WANT_TIMING 1
21 //#define PROFILE_CLOCKS 1
23 #ifdef NDEBUG
24 #ifndef WANT_TIMING
25 #define NO_TIMING 1
26 #endif
27 #endif
29 #ifndef NO_TIMING
30 #ifdef PROFILE_CLOCKS
31 #include <time.h>
32 #else
33 #include "sysutils.h"
34 #ifndef _WIN32
35 #include <sys/time.h>
36 #endif
37 #endif
38 #endif
40 #include <map>
42 namespace RubberBand {
44 #ifndef NO_TIMING
46 class Profiler
48 public:
49 Profiler(const char *name);
50 ~Profiler();
52 void end(); // same action as dtor
54 static void dump();
56 protected:
57 const char* m_c;
58 #ifdef PROFILE_CLOCKS
59 clock_t m_start;
60 #else
61 struct timeval m_start;
62 #endif
63 bool m_showOnDestruct;
64 bool m_ended;
66 typedef std::pair<int, float> TimePair;
67 typedef std::map<const char *, TimePair> ProfileMap;
68 typedef std::map<const char *, float> WorstCallMap;
69 static ProfileMap m_profiles;
70 static WorstCallMap m_worstCalls;
71 static void add(const char *, float);
74 #else
76 class Profiler
78 public:
79 Profiler(const char *) { }
80 ~Profiler() { }
82 void update() const { }
83 void end() { }
84 static void dump() { }
87 #endif
91 #endif