2 Copyright (C) 2011-2013 Paul Davis
3 Author: Carl Hetherington <cth@carlh.net>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #include "canvas/debug.h"
26 uint64_t PBD::DEBUG::CanvasItems = PBD::new_debug_bit ("canvasitems");
27 uint64_t PBD::DEBUG::CanvasItemsDirtied = PBD::new_debug_bit ("canvasitemsdirtied");
28 uint64_t PBD::DEBUG::CanvasEvents = PBD::new_debug_bit ("canvasevents");
29 uint64_t PBD::DEBUG::CanvasRender = PBD::new_debug_bit ("canvasrender");
31 struct timeval ArdourCanvas::epoch;
32 map<string, struct timeval> ArdourCanvas::last_time;
33 int ArdourCanvas::render_count;
34 int ArdourCanvas::render_depth;
35 int ArdourCanvas::dump_depth;
38 ArdourCanvas::set_epoch ()
40 gettimeofday (&epoch, 0);
44 ArdourCanvas::checkpoint (string group, string message)
47 gettimeofday (&now, 0);
49 now.tv_sec -= epoch.tv_sec;
50 now.tv_usec -= epoch.tv_usec;
51 if (now.tv_usec < 0) {
56 map<string, struct timeval>::iterator last = last_time.find (group);
58 if (last != last_time.end ()) {
59 time_t seconds = now.tv_sec - last->second.tv_sec;
60 suseconds_t useconds = now.tv_usec - last->second.tv_usec;
65 cout << (now.tv_sec + ((double) now.tv_usec / 1e6)) << " [" << (seconds + ((double) useconds / 1e6)) << "]: " << message << "\n";
67 cout << message << "\n";
70 last_time[group] = now;