summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2015-06-12 18:14:09 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2015-06-12 18:14:09 -0400
commitcc543280d9869d4a7b800d547c53e38b13d02cea (patch)
treeaa26b29a02fa43ff24e5c9c777cb5294bf67e8e9
parent10643779b6f039a7458bd0c970ef40ac80ea0568 (diff)
We were 2 more debug "bits" away from overflow, so recast PBD::DEBUG mechanism away from a 64bit integer and toward std::bitset.
Clean up a few minor related PBD::DEBUG issues along the way
-rw-r--r--gtk2_ardour/debug.cc8
-rw-r--r--gtk2_ardour/debug.h8
-rw-r--r--libs/ardour/ardour/cycle_timer.h4
-rw-r--r--libs/ardour/ardour/debug.h80
-rw-r--r--libs/ardour/debug.cc80
-rw-r--r--libs/ardour/midi_buffer.cc2
-rw-r--r--libs/ardour/midi_diskstream.cc2
-rw-r--r--libs/ardour/midi_port.cc24
-rw-r--r--libs/ardour/midi_ring_buffer.cc2
-rw-r--r--libs/ardour/session_events.cc11
-rw-r--r--libs/canvas/canvas/debug.h12
-rw-r--r--libs/canvas/debug.cc12
-rw-r--r--libs/evoral/evoral/types.hpp8
-rw-r--r--libs/evoral/src/debug.cpp6
-rw-r--r--libs/gtkmm2ext/debug.cc4
-rw-r--r--libs/gtkmm2ext/gtkmm2ext/debug.h12
-rw-r--r--libs/pbd/debug.cc53
-rw-r--r--libs/pbd/pbd/debug.h35
18 files changed, 178 insertions, 185 deletions
diff --git a/gtk2_ardour/debug.cc b/gtk2_ardour/debug.cc
index a75a102a8c..7065e6a9b6 100644
--- a/gtk2_ardour/debug.cc
+++ b/gtk2_ardour/debug.cc
@@ -25,7 +25,7 @@
using namespace std;
-uint64_t PBD::DEBUG::Drags = PBD::new_debug_bit ("drags");
-uint64_t PBD::DEBUG::CutNPaste = PBD::new_debug_bit ("cutnpaste");
-uint64_t PBD::DEBUG::Accelerators = PBD::new_debug_bit ("accelerators");
-uint64_t PBD::DEBUG::GUITiming = PBD::new_debug_bit ("guitiming");
+PBD::DebugBits PBD::DEBUG::Drags = PBD::new_debug_bit ("drags");
+PBD::DebugBits PBD::DEBUG::CutNPaste = PBD::new_debug_bit ("cutnpaste");
+PBD::DebugBits PBD::DEBUG::Accelerators = PBD::new_debug_bit ("accelerators");
+PBD::DebugBits PBD::DEBUG::GUITiming = PBD::new_debug_bit ("guitiming");
diff --git a/gtk2_ardour/debug.h b/gtk2_ardour/debug.h
index db0b3c123f..660e674a4a 100644
--- a/gtk2_ardour/debug.h
+++ b/gtk2_ardour/debug.h
@@ -26,10 +26,10 @@
namespace PBD {
namespace DEBUG {
- extern uint64_t Drags;
- extern uint64_t CutNPaste;
- extern uint64_t Accelerators;
- extern uint64_t GUITiming;
+ extern DebugBits Drags;
+ extern DebugBits CutNPaste;
+ extern DebugBits Accelerators;
+ extern DebugBits GUITiming;
}
}
diff --git a/libs/ardour/ardour/cycle_timer.h b/libs/ardour/ardour/cycle_timer.h
index cab389ee69..ac19abda1e 100644
--- a/libs/ardour/ardour/cycle_timer.h
+++ b/libs/ardour/ardour/cycle_timer.h
@@ -42,7 +42,7 @@ class LIBARDOUR_API CycleTimer {
public:
CycleTimer(const std::string& name) {
#ifndef NDEBUG
- if (PBD::debug_bits & PBD::DEBUG::CycleTimers) {
+ if (DEBUG_ENABLED (PBD::DEBUG::CycleTimers)) {
_name = name;
if (cycles_per_usec == 0) {
cycles_per_usec = get_mhz ();
@@ -56,7 +56,7 @@ class LIBARDOUR_API CycleTimer {
~CycleTimer() {
#ifndef NDEBUG
- if (PBD::debug_bits & PBD::DEBUG::CycleTimers) {
+ if (DEBUG_ENABLED (PBD::DEBUG::CycleTimers)) {
_exit = get_cycles();
std::cerr << _name << ": " << (float) (_exit - _entry) / cycles_per_usec << " (" << _entry << ", " << _exit << ')' << std::endl;
}
diff --git a/libs/ardour/ardour/debug.h b/libs/ardour/ardour/debug.h
index 8f4b562905..1c19d855bc 100644
--- a/libs/ardour/ardour/debug.h
+++ b/libs/ardour/ardour/debug.h
@@ -29,46 +29,46 @@
namespace PBD {
namespace DEBUG {
- LIBARDOUR_API extern uint64_t MidiSourceIO;
- LIBARDOUR_API extern uint64_t MidiPlaylistIO;
- LIBARDOUR_API extern uint64_t MidiDiskstreamIO;
- LIBARDOUR_API extern uint64_t SnapBBT;
- LIBARDOUR_API extern uint64_t Latency;
- LIBARDOUR_API extern uint64_t LatencyCompensation;
- LIBARDOUR_API extern uint64_t Peaks;
- LIBARDOUR_API extern uint64_t Processors;
- LIBARDOUR_API extern uint64_t ProcessThreads;
- LIBARDOUR_API extern uint64_t Graph;
- LIBARDOUR_API extern uint64_t Destruction;
- LIBARDOUR_API extern uint64_t MTC;
- LIBARDOUR_API extern uint64_t LTC;
- LIBARDOUR_API extern uint64_t Transport;
- LIBARDOUR_API extern uint64_t Slave;
- LIBARDOUR_API extern uint64_t SessionEvents;
- LIBARDOUR_API extern uint64_t MidiIO;
- LIBARDOUR_API extern uint64_t MackieControl;
- LIBARDOUR_API extern uint64_t MidiClock;
- LIBARDOUR_API extern uint64_t Monitor;
- LIBARDOUR_API extern uint64_t Solo;
- LIBARDOUR_API extern uint64_t AudioPlayback;
- LIBARDOUR_API extern uint64_t Panning;
- LIBARDOUR_API extern uint64_t LV2;
- LIBARDOUR_API extern uint64_t CaptureAlignment;
- LIBARDOUR_API extern uint64_t PluginManager;
- LIBARDOUR_API extern uint64_t AudioUnits;
- LIBARDOUR_API extern uint64_t ControlProtocols;
- LIBARDOUR_API extern uint64_t CycleTimers;
- LIBARDOUR_API extern uint64_t MidiTrackers;
- LIBARDOUR_API extern uint64_t Layering;
- LIBARDOUR_API extern uint64_t TempoMath;
- LIBARDOUR_API extern uint64_t TempoMap;
- LIBARDOUR_API extern uint64_t OrderKeys;
- LIBARDOUR_API extern uint64_t Automation;
- LIBARDOUR_API extern uint64_t WiimoteControl;
- LIBARDOUR_API extern uint64_t Ports;
- LIBARDOUR_API extern uint64_t AudioEngine;
- LIBARDOUR_API extern uint64_t Soundcloud;
- LIBARDOUR_API extern uint64_t Butler;
+ LIBARDOUR_API extern DebugBits MidiSourceIO;
+ LIBARDOUR_API extern DebugBits MidiPlaylistIO;
+ LIBARDOUR_API extern DebugBits MidiDiskstreamIO;
+ LIBARDOUR_API extern DebugBits SnapBBT;
+ LIBARDOUR_API extern DebugBits Latency;
+ LIBARDOUR_API extern DebugBits LatencyCompensation;
+ LIBARDOUR_API extern DebugBits Peaks;
+ LIBARDOUR_API extern DebugBits Processors;
+ LIBARDOUR_API extern DebugBits ProcessThreads;
+ LIBARDOUR_API extern DebugBits Graph;
+ LIBARDOUR_API extern DebugBits Destruction;
+ LIBARDOUR_API extern DebugBits MTC;
+ LIBARDOUR_API extern DebugBits LTC;
+ LIBARDOUR_API extern DebugBits Transport;
+ LIBARDOUR_API extern DebugBits Slave;
+ LIBARDOUR_API extern DebugBits SessionEvents;
+ LIBARDOUR_API extern DebugBits MidiIO;
+ LIBARDOUR_API extern DebugBits MackieControl;
+ LIBARDOUR_API extern DebugBits MidiClock;
+ LIBARDOUR_API extern DebugBits Monitor;
+ LIBARDOUR_API extern DebugBits Solo;
+ LIBARDOUR_API extern DebugBits AudioPlayback;
+ LIBARDOUR_API extern DebugBits Panning;
+ LIBARDOUR_API extern DebugBits LV2;
+ LIBARDOUR_API extern DebugBits CaptureAlignment;
+ LIBARDOUR_API extern DebugBits PluginManager;
+ LIBARDOUR_API extern DebugBits AudioUnits;
+ LIBARDOUR_API extern DebugBits ControlProtocols;
+ LIBARDOUR_API extern DebugBits CycleTimers;
+ LIBARDOUR_API extern DebugBits MidiTrackers;
+ LIBARDOUR_API extern DebugBits Layering;
+ LIBARDOUR_API extern DebugBits TempoMath;
+ LIBARDOUR_API extern DebugBits TempoMap;
+ LIBARDOUR_API extern DebugBits OrderKeys;
+ LIBARDOUR_API extern DebugBits Automation;
+ LIBARDOUR_API extern DebugBits WiimoteControl;
+ LIBARDOUR_API extern DebugBits Ports;
+ LIBARDOUR_API extern DebugBits AudioEngine;
+ LIBARDOUR_API extern DebugBits Soundcloud;
+ LIBARDOUR_API extern DebugBits Butler;
}
}
diff --git a/libs/ardour/debug.cc b/libs/ardour/debug.cc
index c0993e9da6..0a00e896d9 100644
--- a/libs/ardour/debug.cc
+++ b/libs/ardour/debug.cc
@@ -25,45 +25,45 @@
using namespace std;
-uint64_t PBD::DEBUG::MidiSourceIO = PBD::new_debug_bit ("midisourceio");
-uint64_t PBD::DEBUG::MidiPlaylistIO = PBD::new_debug_bit ("midiplaylistio");
-uint64_t PBD::DEBUG::MidiDiskstreamIO = PBD::new_debug_bit ("mididiskstreamio");
-uint64_t PBD::DEBUG::SnapBBT = PBD::new_debug_bit ("snapbbt");
-uint64_t PBD::DEBUG::Latency = PBD::new_debug_bit ("latency");
-uint64_t PBD::DEBUG::LatencyCompensation = PBD::new_debug_bit ("latencycompensation");
-uint64_t PBD::DEBUG::Peaks = PBD::new_debug_bit ("peaks");
-uint64_t PBD::DEBUG::Processors = PBD::new_debug_bit ("processors");
-uint64_t PBD::DEBUG::ProcessThreads = PBD::new_debug_bit ("processthreads");
-uint64_t PBD::DEBUG::Graph = PBD::new_debug_bit ("graph");
-uint64_t PBD::DEBUG::Destruction = PBD::new_debug_bit ("destruction");
-uint64_t PBD::DEBUG::MTC = PBD::new_debug_bit ("mtc");
-uint64_t PBD::DEBUG::LTC = PBD::new_debug_bit ("ltc");
-uint64_t PBD::DEBUG::Transport = PBD::new_debug_bit ("transport");
-uint64_t PBD::DEBUG::Slave = PBD::new_debug_bit ("slave");
-uint64_t PBD::DEBUG::SessionEvents = PBD::new_debug_bit ("sessionevents");
-uint64_t PBD::DEBUG::MidiIO = PBD::new_debug_bit ("midiio");
-uint64_t PBD::DEBUG::MackieControl = PBD::new_debug_bit ("mackiecontrol");
-uint64_t PBD::DEBUG::MidiClock = PBD::new_debug_bit ("midiclock");
-uint64_t PBD::DEBUG::Monitor = PBD::new_debug_bit ("monitor");
-uint64_t PBD::DEBUG::Solo = PBD::new_debug_bit ("solo");
-uint64_t PBD::DEBUG::AudioPlayback = PBD::new_debug_bit ("audioplayback");
-uint64_t PBD::DEBUG::Panning = PBD::new_debug_bit ("panning");
-uint64_t PBD::DEBUG::LV2 = PBD::new_debug_bit ("lv2");
-uint64_t PBD::DEBUG::CaptureAlignment = PBD::new_debug_bit ("capturealignment");
-uint64_t PBD::DEBUG::PluginManager = PBD::new_debug_bit ("pluginmanager");
-uint64_t PBD::DEBUG::AudioUnits = PBD::new_debug_bit ("audiounits");
-uint64_t PBD::DEBUG::ControlProtocols = PBD::new_debug_bit ("controlprotocols");
-uint64_t PBD::DEBUG::CycleTimers = PBD::new_debug_bit ("cycletimers");
-uint64_t PBD::DEBUG::MidiTrackers = PBD::new_debug_bit ("miditrackers");
-uint64_t PBD::DEBUG::Layering = PBD::new_debug_bit ("layering");
-uint64_t PBD::DEBUG::TempoMath = PBD::new_debug_bit ("tempomath");
-uint64_t PBD::DEBUG::TempoMap = PBD::new_debug_bit ("tempomap");
-uint64_t PBD::DEBUG::OrderKeys = PBD::new_debug_bit ("orderkeys");
-uint64_t PBD::DEBUG::Automation = PBD::new_debug_bit ("automation");
-uint64_t PBD::DEBUG::WiimoteControl = PBD::new_debug_bit ("wiimotecontrol");
-uint64_t PBD::DEBUG::Ports = PBD::new_debug_bit ("Ports");
-uint64_t PBD::DEBUG::AudioEngine = PBD::new_debug_bit ("AudioEngine");
-uint64_t PBD::DEBUG::Soundcloud = PBD::new_debug_bit ("Soundcloud");
-uint64_t PBD::DEBUG::Butler = PBD::new_debug_bit ("Butler");
+PBD::DebugBits PBD::DEBUG::MidiSourceIO = PBD::new_debug_bit ("midisourceio");
+PBD::DebugBits PBD::DEBUG::MidiPlaylistIO = PBD::new_debug_bit ("midiplaylistio");
+PBD::DebugBits PBD::DEBUG::MidiDiskstreamIO = PBD::new_debug_bit ("mididiskstreamio");
+PBD::DebugBits PBD::DEBUG::SnapBBT = PBD::new_debug_bit ("snapbbt");
+PBD::DebugBits PBD::DEBUG::Latency = PBD::new_debug_bit ("latency");
+PBD::DebugBits PBD::DEBUG::LatencyCompensation = PBD::new_debug_bit ("latencycompensation");
+PBD::DebugBits PBD::DEBUG::Peaks = PBD::new_debug_bit ("peaks");
+PBD::DebugBits PBD::DEBUG::Processors = PBD::new_debug_bit ("processors");
+PBD::DebugBits PBD::DEBUG::ProcessThreads = PBD::new_debug_bit ("processthreads");
+PBD::DebugBits PBD::DEBUG::Graph = PBD::new_debug_bit ("graph");
+PBD::DebugBits PBD::DEBUG::Destruction = PBD::new_debug_bit ("destruction");
+PBD::DebugBits PBD::DEBUG::MTC = PBD::new_debug_bit ("mtc");
+PBD::DebugBits PBD::DEBUG::LTC = PBD::new_debug_bit ("ltc");
+PBD::DebugBits PBD::DEBUG::Transport = PBD::new_debug_bit ("transport");
+PBD::DebugBits PBD::DEBUG::Slave = PBD::new_debug_bit ("slave");
+PBD::DebugBits PBD::DEBUG::SessionEvents = PBD::new_debug_bit ("sessionevents");
+PBD::DebugBits PBD::DEBUG::MidiIO = PBD::new_debug_bit ("midiio");
+PBD::DebugBits PBD::DEBUG::MackieControl = PBD::new_debug_bit ("mackiecontrol");
+PBD::DebugBits PBD::DEBUG::MidiClock = PBD::new_debug_bit ("midiclock");
+PBD::DebugBits PBD::DEBUG::Monitor = PBD::new_debug_bit ("monitor");
+PBD::DebugBits PBD::DEBUG::Solo = PBD::new_debug_bit ("solo");
+PBD::DebugBits PBD::DEBUG::AudioPlayback = PBD::new_debug_bit ("audioplayback");
+PBD::DebugBits PBD::DEBUG::Panning = PBD::new_debug_bit ("panning");
+PBD::DebugBits PBD::DEBUG::LV2 = PBD::new_debug_bit ("lv2");
+PBD::DebugBits PBD::DEBUG::CaptureAlignment = PBD::new_debug_bit ("capturealignment");
+PBD::DebugBits PBD::DEBUG::PluginManager = PBD::new_debug_bit ("pluginmanager");
+PBD::DebugBits PBD::DEBUG::AudioUnits = PBD::new_debug_bit ("audiounits");
+PBD::DebugBits PBD::DEBUG::ControlProtocols = PBD::new_debug_bit ("controlprotocols");
+PBD::DebugBits PBD::DEBUG::CycleTimers = PBD::new_debug_bit ("cycletimers");
+PBD::DebugBits PBD::DEBUG::MidiTrackers = PBD::new_debug_bit ("miditrackers");
+PBD::DebugBits PBD::DEBUG::Layering = PBD::new_debug_bit ("layering");
+PBD::DebugBits PBD::DEBUG::TempoMath = PBD::new_debug_bit ("tempomath");
+PBD::DebugBits PBD::DEBUG::TempoMap = PBD::new_debug_bit ("tempomap");
+PBD::DebugBits PBD::DEBUG::OrderKeys = PBD::new_debug_bit ("orderkeys");
+PBD::DebugBits PBD::DEBUG::Automation = PBD::new_debug_bit ("automation");
+PBD::DebugBits PBD::DEBUG::WiimoteControl = PBD::new_debug_bit ("wiimotecontrol");
+PBD::DebugBits PBD::DEBUG::Ports = PBD::new_debug_bit ("Ports");
+PBD::DebugBits PBD::DEBUG::AudioEngine = PBD::new_debug_bit ("AudioEngine");
+PBD::DebugBits PBD::DEBUG::Soundcloud = PBD::new_debug_bit ("Soundcloud");
+PBD::DebugBits PBD::DEBUG::Butler = PBD::new_debug_bit ("Butler");
diff --git a/libs/ardour/midi_buffer.cc b/libs/ardour/midi_buffer.cc
index ee6bd13d51..b1b09e4c98 100644
--- a/libs/ardour/midi_buffer.cc
+++ b/libs/ardour/midi_buffer.cc
@@ -163,7 +163,7 @@ MidiBuffer::push_back(TimeType time, size_t size, const uint8_t* data)
const size_t stamp_size = sizeof(TimeType);
#ifndef NDEBUG
- if (DEBUG::MidiIO & PBD::debug_bits) {
+ if (DEBUG_ENABLED(DEBUG::MidiIO)) {
DEBUG_STR_DECL(a);
DEBUG_STR_APPEND(a, string_compose ("midibuffer %1 push event @ %2 sz %3 ", this, time, size));
for (size_t i=0; i < size; ++i) {
diff --git a/libs/ardour/midi_diskstream.cc b/libs/ardour/midi_diskstream.cc
index e8b23b3431..f17b38d7ea 100644
--- a/libs/ardour/midi_diskstream.cc
+++ b/libs/ardour/midi_diskstream.cc
@@ -414,7 +414,7 @@ MidiDiskstream::process (BufferSet& bufs, framepos_t transport_frame, pframes_t
break;
}
#ifndef NDEBUG
- if (DEBUG::MidiIO & PBD::debug_bits) {
+ if (DEBUG_ENABLED(DEBUG::MidiIO)) {
const uint8_t* __data = ev.buffer();
DEBUG_STR_DECL(a);
DEBUG_STR_APPEND(a, string_compose ("mididiskstream %1 capture event @ %2 + %3 sz %4 ", this, ev.time(), transport_frame, ev.size()));
diff --git a/libs/ardour/midi_port.cc b/libs/ardour/midi_port.cc
index 615abede1c..f7a0d0fadb 100644
--- a/libs/ardour/midi_port.cc
+++ b/libs/ardour/midi_port.cc
@@ -231,18 +231,18 @@ MidiPort::flush_buffers (pframes_t nframes)
// event times are in frames, relative to cycle start
#ifndef NDEBUG
- if (DEBUG::MidiIO & PBD::debug_bits) {
- DEBUG_STR_DECL(a);
- DEBUG_STR_APPEND(a, string_compose ("MidiPort %1 pop event @ %2 sz %3 ", _buffer, ev.time(), ev.size()));
- for (size_t i=0; i < ev.size(); ++i) {
- DEBUG_STR_APPEND(a,hex);
- DEBUG_STR_APPEND(a,"0x");
- DEBUG_STR_APPEND(a,(int)(ev.buffer()[i]));
- DEBUG_STR_APPEND(a,' ');
- }
- DEBUG_STR_APPEND(a,'\n');
- DEBUG_TRACE (DEBUG::MidiIO, DEBUG_STR(a).str());
- }
+ if (DEBUG_ENABLED (DEBUG::MidiIO)) {
+ DEBUG_STR_DECL(a);
+ DEBUG_STR_APPEND(a, string_compose ("MidiPort %1 pop event @ %2 sz %3 ", _buffer, ev.time(), ev.size()));
+ for (size_t i=0; i < ev.size(); ++i) {
+ DEBUG_STR_APPEND(a,hex);
+ DEBUG_STR_APPEND(a,"0x");
+ DEBUG_STR_APPEND(a,(int)(ev.buffer()[i]));
+ DEBUG_STR_APPEND(a,' ');
+ }
+ DEBUG_STR_APPEND(a,'\n');
+ DEBUG_TRACE (DEBUG::MidiIO, DEBUG_STR(a).str());
+ }
#endif
assert (ev.time() < (nframes + _global_port_buffer_offset + _port_buffer_offset));
diff --git a/libs/ardour/midi_ring_buffer.cc b/libs/ardour/midi_ring_buffer.cc
index 7e88f5ff45..3923e5306a 100644
--- a/libs/ardour/midi_ring_buffer.cc
+++ b/libs/ardour/midi_ring_buffer.cc
@@ -103,7 +103,7 @@ MidiRingBuffer<T>::read(MidiBuffer& dst, framepos_t start, framepos_t end, frame
bool success = read_contents (ev_size, write_loc);
#ifndef NDEBUG
- if (DEBUG::MidiDiskstreamIO && PBD::debug_bits) {
+ if (DEBUG_ENABLED (DEBUG::MidiDiskstreamIO)) {
DEBUG_STR_DECL(a);
DEBUG_STR_APPEND(a, string_compose ("wrote MidiEvent to Buffer (time=%1, start=%2 offset=%3)", ev_time, start, offset));
for (size_t i=0; i < ev_size; ++i) {
diff --git a/libs/ardour/session_events.cc b/libs/ardour/session_events.cc
index d41b9c5002..53a26363b0 100644
--- a/libs/ardour/session_events.cc
+++ b/libs/ardour/session_events.cc
@@ -74,11 +74,6 @@ SessionEvent::operator new (size_t)
DEBUG_TRACE (DEBUG::SessionEvents, string_compose ("%1 Allocating SessionEvent from %2 ev @ %3 pool size %4 free %5 used %6\n", pthread_name(), p->name(), ev,
p->total(), p->available(), p->used()));
-#ifndef NDEBUG
- if (DEBUG::SessionEvents & PBD::debug_bits) {
- // stacktrace (cerr, 40);
- }
-#endif
ev->own_pool = p;
return ev;
}
@@ -94,12 +89,6 @@ SessionEvent::operator delete (void *ptr, size_t /*size*/)
pthread_name(), ev, enum_2_string (ev->type), enum_2_string (ev->action), p->name(), ev->own_pool->name(), ev->own_pool->total(), ev->own_pool->available(), ev->own_pool->used()
));
-#ifndef NDEBUG
- if (DEBUG::SessionEvents & PBD::debug_bits) {
- // stacktrace (cerr, 40);
- }
-#endif
-
if (p && p == ev->own_pool) {
p->release (ptr);
} else {
diff --git a/libs/canvas/canvas/debug.h b/libs/canvas/canvas/debug.h
index b12e337244..ecf7eee46f 100644
--- a/libs/canvas/canvas/debug.h
+++ b/libs/canvas/canvas/debug.h
@@ -28,12 +28,12 @@
namespace PBD {
namespace DEBUG {
- LIBCANVAS_API extern uint64_t CanvasItems;
- LIBCANVAS_API extern uint64_t CanvasItemsDirtied;
- LIBCANVAS_API extern uint64_t CanvasEvents;
- LIBCANVAS_API extern uint64_t CanvasRender;
- LIBCANVAS_API extern uint64_t CanvasEnterLeave;
- LIBCANVAS_API extern uint64_t WaveView;
+ LIBCANVAS_API extern DebugBits CanvasItems;
+ LIBCANVAS_API extern DebugBits CanvasItemsDirtied;
+ LIBCANVAS_API extern DebugBits CanvasEvents;
+ LIBCANVAS_API extern DebugBits CanvasRender;
+ LIBCANVAS_API extern DebugBits CanvasEnterLeave;
+ LIBCANVAS_API extern DebugBits WaveView;
}
}
diff --git a/libs/canvas/debug.cc b/libs/canvas/debug.cc
index a7edbfbe54..be5b3a033d 100644
--- a/libs/canvas/debug.cc
+++ b/libs/canvas/debug.cc
@@ -24,12 +24,12 @@
using namespace std;
-uint64_t PBD::DEBUG::CanvasItems = PBD::new_debug_bit ("canvasitems");
-uint64_t PBD::DEBUG::CanvasItemsDirtied = PBD::new_debug_bit ("canvasitemsdirtied");
-uint64_t PBD::DEBUG::CanvasEvents = PBD::new_debug_bit ("canvasevents");
-uint64_t PBD::DEBUG::CanvasRender = PBD::new_debug_bit ("canvasrender");
-uint64_t PBD::DEBUG::CanvasEnterLeave = PBD::new_debug_bit ("canvasenterleave");
-uint64_t PBD::DEBUG::WaveView = PBD::new_debug_bit ("waveview");
+PBD::DebugBits PBD::DEBUG::CanvasItems = PBD::new_debug_bit ("canvasitems");
+PBD::DebugBits PBD::DEBUG::CanvasItemsDirtied = PBD::new_debug_bit ("canvasitemsdirtied");
+PBD::DebugBits PBD::DEBUG::CanvasEvents = PBD::new_debug_bit ("canvasevents");
+PBD::DebugBits PBD::DEBUG::CanvasRender = PBD::new_debug_bit ("canvasrender");
+PBD::DebugBits PBD::DEBUG::CanvasEnterLeave = PBD::new_debug_bit ("canvasenterleave");
+PBD::DebugBits PBD::DEBUG::WaveView = PBD::new_debug_bit ("waveview");
struct timeval ArdourCanvas::epoch;
map<string, struct timeval> ArdourCanvas::last_time;
diff --git a/libs/evoral/evoral/types.hpp b/libs/evoral/evoral/types.hpp
index 1951fb8ba6..7d3f415142 100644
--- a/libs/evoral/evoral/types.hpp
+++ b/libs/evoral/evoral/types.hpp
@@ -27,6 +27,8 @@
#include <limits>
#include <list>
+#include "pbd/debug.h"
+
#include "evoral/Beats.hpp"
#include "evoral/visibility.h"
@@ -46,9 +48,9 @@ typedef uint32_t EventType;
namespace PBD {
namespace DEBUG {
- LIBEVORAL_API extern uint64_t Sequence;
- LIBEVORAL_API extern uint64_t Note;
- LIBEVORAL_API extern uint64_t ControlList;
+ LIBEVORAL_API extern DebugBits Sequence;
+ LIBEVORAL_API extern DebugBits Note;
+ LIBEVORAL_API extern DebugBits ControlList;
}
}
diff --git a/libs/evoral/src/debug.cpp b/libs/evoral/src/debug.cpp
index 9e82b93d1b..785c33bf1b 100644
--- a/libs/evoral/src/debug.cpp
+++ b/libs/evoral/src/debug.cpp
@@ -1,6 +1,6 @@
#include "evoral/types.hpp"
-uint64_t PBD::DEBUG::Sequence = PBD::new_debug_bit ("sequence");
-uint64_t PBD::DEBUG::Note = PBD::new_debug_bit ("note");
-uint64_t PBD::DEBUG::ControlList = PBD::new_debug_bit ("controllist");
+PBD::DebugBits PBD::DEBUG::Sequence = PBD::new_debug_bit ("sequence");
+PBD::DebugBits PBD::DEBUG::Note = PBD::new_debug_bit ("note");
+PBD::DebugBits PBD::DEBUG::ControlList = PBD::new_debug_bit ("controllist");
diff --git a/libs/gtkmm2ext/debug.cc b/libs/gtkmm2ext/debug.cc
index 899c553469..33262fdcf5 100644
--- a/libs/gtkmm2ext/debug.cc
+++ b/libs/gtkmm2ext/debug.cc
@@ -20,5 +20,5 @@
#include "gtkmm2ext/debug.h"
#include "pbd/debug.h"
-uint64_t Gtkmm2ext::DEBUG::Keyboard = PBD::new_debug_bit ("keyboard");
-uint64_t Gtkmm2ext::DEBUG::Bindings = PBD::new_debug_bit ("bindings");
+PBD::DebugBits PBD::DEBUG::Keyboard = PBD::new_debug_bit ("keyboard");
+PBD::DebugBits PBD::DEBUG::Bindings = PBD::new_debug_bit ("bindings");
diff --git a/libs/gtkmm2ext/gtkmm2ext/debug.h b/libs/gtkmm2ext/gtkmm2ext/debug.h
index 8012742e6c..1cb69be6cd 100644
--- a/libs/gtkmm2ext/gtkmm2ext/debug.h
+++ b/libs/gtkmm2ext/gtkmm2ext/debug.h
@@ -20,14 +20,16 @@
#ifndef __libgtkmm2ext_debug_h__
#define __libgtkmm2ext_debug_h__
-#include "gtkmm2ext/visibility.h"
-
#include <stdint.h>
-namespace Gtkmm2ext {
+#include "pbd/debug.h"
+
+#include "gtkmm2ext/visibility.h"
+
+namespace PBD {
namespace DEBUG {
- LIBGTKMM2EXT_API extern uint64_t Keyboard;
- LIBGTKMM2EXT_API extern uint64_t Bindings;
+ LIBGTKMM2EXT_API extern DebugBits Keyboard;
+ LIBGTKMM2EXT_API extern DebugBits Bindings;
}
}
diff --git a/libs/pbd/debug.cc b/libs/pbd/debug.cc
index dfa189002f..25ebb64850 100644
--- a/libs/pbd/debug.cc
+++ b/libs/pbd/debug.cc
@@ -31,9 +31,11 @@
#include "i18n.h"
using namespace std;
-static uint64_t _debug_bit = 1;
+using PBD::DebugBits;
-typedef std::map<const char*,uint64_t> DebugMap;
+static uint64_t _debug_bit = 0;
+
+typedef std::map<const char*,DebugBits> DebugMap;
namespace PBD {
DebugMap & _debug_bit_map()
@@ -43,24 +45,23 @@ namespace PBD {
}
}
-uint64_t PBD::DEBUG::Stateful = PBD::new_debug_bit ("stateful");
-uint64_t PBD::DEBUG::Properties = PBD::new_debug_bit ("properties");
-uint64_t PBD::DEBUG::FileManager = PBD::new_debug_bit ("filemanager");
-uint64_t PBD::DEBUG::Pool = PBD::new_debug_bit ("pool");
-uint64_t PBD::DEBUG::EventLoop = PBD::new_debug_bit ("eventloop");
-uint64_t PBD::DEBUG::AbstractUI = PBD::new_debug_bit ("abstractui");
-uint64_t PBD::DEBUG::FileUtils = PBD::new_debug_bit ("fileutils");
-uint64_t PBD::DEBUG::Configuration = PBD::new_debug_bit ("configuration");
+DebugBits PBD::DEBUG::Stateful = PBD::new_debug_bit ("stateful");
+DebugBits PBD::DEBUG::Properties = PBD::new_debug_bit ("properties");
+DebugBits PBD::DEBUG::FileManager = PBD::new_debug_bit ("filemanager");
+DebugBits PBD::DEBUG::Pool = PBD::new_debug_bit ("pool");
+DebugBits PBD::DEBUG::EventLoop = PBD::new_debug_bit ("eventloop");
+DebugBits PBD::DEBUG::AbstractUI = PBD::new_debug_bit ("abstractui");
+DebugBits PBD::DEBUG::FileUtils = PBD::new_debug_bit ("fileutils");
+DebugBits PBD::DEBUG::Configuration = PBD::new_debug_bit ("configuration");
-uint64_t PBD::debug_bits = 0x0;
+DebugBits PBD::debug_bits;
-uint64_t
+DebugBits
PBD::new_debug_bit (const char* name)
{
- uint64_t ret;
- _debug_bit_map().insert (make_pair (name, _debug_bit));
- ret = _debug_bit;
- _debug_bit <<= 1;
+ DebugBits ret;
+ ret.set (_debug_bit++, 1);
+ _debug_bit_map().insert (make_pair (name, ret));
return ret;
}
@@ -70,12 +71,6 @@ PBD::debug_print (const char* prefix, string str)
cerr << prefix << ": " << str;
}
-void
-PBD::set_debug_bits (uint64_t bits)
-{
- debug_bits = bits;
-}
-
int
PBD::parse_debug_options (const char* str)
{
@@ -83,7 +78,7 @@ PBD::parse_debug_options (const char* str)
typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
boost::char_separator<char> sep (",");
tokenizer tokens (in_str, sep);
- uint64_t bits = 0;
+ DebugBits bits;
for (tokenizer::iterator tok_iter = tokens.begin(); tok_iter != tokens.end(); ++tok_iter) {
if (*tok_iter == "list") {
@@ -92,20 +87,22 @@ PBD::parse_debug_options (const char* str)
}
if (*tok_iter == "all") {
- PBD::set_debug_bits (~0ULL);
+ debug_bits.set (); /* sets all bits */
return 0;
}
- for (map<const char*,uint64_t>::iterator i = _debug_bit_map().begin(); i != _debug_bit_map().end(); ++i) {
+ for (map<const char*,DebugBits>::iterator i = _debug_bit_map().begin(); i != _debug_bit_map().end(); ++i) {
const char* cstr = (*tok_iter).c_str();
if (strncasecmp (cstr, i->first, strlen (cstr)) == 0) {
- bits |= i->second;
+ bits |= i->second;
+ cerr << i->first << " set ... debug bits now set to " << bits << " using " << i->second << endl;
}
}
}
- PBD::set_debug_bits (bits);
+ debug_bits = bits;
+
return 0;
}
@@ -117,7 +114,7 @@ PBD::list_debug_options ()
vector<string> options;
- for (map<const char*,uint64_t>::iterator i = _debug_bit_map().begin(); i != _debug_bit_map().end(); ++i) {
+ for (map<const char*,DebugBits>::iterator i = _debug_bit_map().begin(); i != _debug_bit_map().end(); ++i) {
options.push_back (i->first);
}
diff --git a/libs/pbd/pbd/debug.h b/libs/pbd/pbd/debug.h
index f1776a254c..e4fa525481 100644
--- a/libs/pbd/pbd/debug.h
+++ b/libs/pbd/pbd/debug.h
@@ -20,6 +20,7 @@
#ifndef __libpbd_debug_h__
#define __libpbd_debug_h__
+#include <bitset>
#include <stdint.h>
#include <sstream>
@@ -29,10 +30,12 @@
namespace PBD {
- LIBPBD_API extern uint64_t debug_bits;
- LIBPBD_API uint64_t new_debug_bit (const char* name);
+ typedef std::bitset<64> DebugBits;
+
+ LIBPBD_API extern DebugBits debug_bits;
+ LIBPBD_API DebugBits new_debug_bit (const char* name);
LIBPBD_API void debug_print (const char* prefix, std::string str);
- LIBPBD_API void set_debug_bits (uint64_t bits);
+ LIBPBD_API void set_debug_bits (DebugBits bits);
LIBPBD_API int parse_debug_options (const char* str);
LIBPBD_API void list_debug_options ();
@@ -40,32 +43,32 @@ namespace PBD {
/* this namespace is so that we can write DEBUG::bit_name */
- LIBPBD_API extern uint64_t Stateful;
- LIBPBD_API extern uint64_t Properties;
- LIBPBD_API extern uint64_t FileManager;
- LIBPBD_API extern uint64_t Pool;
- LIBPBD_API extern uint64_t EventLoop;
- LIBPBD_API extern uint64_t AbstractUI;
- LIBPBD_API extern uint64_t Configuration;
- extern uint64_t FileUtils;
+ LIBPBD_API extern DebugBits Stateful;
+ LIBPBD_API extern DebugBits Properties;
+ LIBPBD_API extern DebugBits FileManager;
+ LIBPBD_API extern DebugBits Pool;
+ LIBPBD_API extern DebugBits EventLoop;
+ LIBPBD_API extern DebugBits AbstractUI;
+ LIBPBD_API extern DebugBits Configuration;
+ LIBPBD_API extern DebugBits FileUtils;
}
}
#ifndef NDEBUG
-#define DEBUG_TRACE(bits,str) if ((bits) & PBD::debug_bits) { PBD::debug_print (# bits, str); }
+#define DEBUG_TRACE(bits,str) if (((bits) & PBD::debug_bits).any()) { PBD::debug_print (# bits, str); }
#define DEBUG_STR_DECL(id) std::stringstream __debug_str ## id;
#define DEBUG_STR(id) __debug_str ## id
#define DEBUG_STR_APPEND(id,s) __debug_str ## id << s;
-#define DEBUG_ENABLED(bits) ((bits) & PBD::debug_bits)
+#define DEBUG_ENABLED(bits) (((bits) & PBD::debug_bits).any())
#ifdef PTW32_VERSION
#define DEBUG_THREAD_SELF pthread_self().p
#else
#define DEBUG_THREAD_SELF pthread_self()
#endif
-#define DEBUG_TIMING_START(bits,td) if ((bits) & PBD::debug_bits) { td.start_timing (); }
-#define DEBUG_TIMING_ADD_ELAPSED(bits,td) if ((bits) & PBD::debug_bits) { td.add_elapsed (); }
-#define DEBUG_TIMING_RESET(bits,td) if ((bits) & PBD::debug_bits) { td.reset (); }
+#define DEBUG_TIMING_START(bits,td) if (DEBUG_ENABLED (bits)) { td.start_timing (); }
+#define DEBUG_TIMING_ADD_ELAPSED(bits,td) if (DEBUG_ENABLED (bits)) { td.add_elapsed (); }
+#define DEBUG_TIMING_RESET(bits,td) if (DEBUG_ENABLED (bits)) { td.reset (); }
#else
#define DEBUG_TRACE(bits,fmt,...) /*empty*/