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.
23 #include "canvas/debug.h"
27 uint64_t PBD::DEBUG::CanvasItems = PBD::new_debug_bit ("canvasitems");
28 uint64_t PBD::DEBUG::CanvasItemsDirtied = PBD::new_debug_bit ("canvasitemsdirtied");
29 uint64_t PBD::DEBUG::CanvasEvents = PBD::new_debug_bit ("canvasevents");
30 uint64_t PBD::DEBUG::CanvasRender = PBD::new_debug_bit ("canvasrender");
31 uint64_t PBD::DEBUG::CanvasEnterLeave = PBD::new_debug_bit ("canvasenterleave");
33 struct timeval ArdourCanvas::epoch;
34 map<string, struct timeval> ArdourCanvas::last_time;
35 int ArdourCanvas::render_count;
36 int ArdourCanvas::render_depth;
37 int ArdourCanvas::dump_depth;
40 ArdourCanvas::set_epoch ()
42 gettimeofday (&epoch, 0);
46 ArdourCanvas::checkpoint (string group, string message)
49 gettimeofday (&now, 0);
51 now.tv_sec -= epoch.tv_sec;
52 now.tv_usec -= epoch.tv_usec;
53 if (now.tv_usec < 0) {
58 map<string, struct timeval>::iterator last = last_time.find (group);
60 if (last != last_time.end ()) {
61 time_t seconds = now.tv_sec - last->second.tv_sec;
62 suseconds_t useconds = now.tv_usec - last->second.tv_usec;
67 cout << (now.tv_sec + ((double) now.tv_usec / 1e6)) << " [" << (seconds + ((double) useconds / 1e6)) << "]: " << message << "\n";
69 cout << message << "\n";
72 last_time[group] = now;
76 ArdourCanvas::event_type_string (int event_type)
87 case GDK_MOTION_NOTIFY:
88 return "motion_notify";
89 case GDK_BUTTON_PRESS:
90 return "button_press";
91 case GDK_2BUTTON_PRESS:
92 return "2button_press";
93 case GDK_3BUTTON_PRESS:
94 return "3button_press";
95 case GDK_BUTTON_RELEASE:
96 return "button_release";
100 return "key_release";
101 case GDK_ENTER_NOTIFY:
102 return "enter_notify";
103 case GDK_LEAVE_NOTIFY:
104 return "leave_notify";
105 case GDK_FOCUS_CHANGE:
106 return "focus_change";
113 case GDK_PROPERTY_NOTIFY:
114 return "property_notify";
115 case GDK_SELECTION_CLEAR:
116 return "selection_clear";
117 case GDK_SELECTION_REQUEST:
118 return "selection_request";
119 case GDK_SELECTION_NOTIFY:
120 return "selection_notify";
121 case GDK_PROXIMITY_IN:
122 return "proximity_in";
123 case GDK_PROXIMITY_OUT:
124 return "proximity_out";
129 case GDK_DRAG_MOTION:
130 return "drag_motion";
131 case GDK_DRAG_STATUS:
132 return "drag_status";
135 case GDK_DROP_FINISHED:
136 return "drop_finished";
137 case GDK_CLIENT_EVENT:
138 return "client_event";
139 case GDK_VISIBILITY_NOTIFY:
140 return "visibility_notify";
145 case GDK_WINDOW_STATE:
146 return "window_state";
149 case GDK_OWNER_CHANGE:
150 return "owner_change";
151 case GDK_GRAB_BROKEN:
152 return "grab_broken";