+#if TDEBUG
+/* Timing */
+static struct {
+ struct timeval total;
+ struct timeval gtkbits;
+ struct timeval menuupdate;
+ struct timeval new_widgets;
+ struct timeval undisplay;
+ struct timeval colors;
+ struct timeval markers;
+ struct timeval location;
+ struct timeval selection;
+} times;
+
+#define BEGIN(WHAT) do { \
+ struct timeval started##WHAT, finished##WHAT; \
+ xgettimeofday(&started##WHAT, 0)
+
+#define END(WHAT) \
+ xgettimeofday(&finished##WHAT, 0); \
+ times.WHAT = tvadd(times.WHAT, tvsub(finished##WHAT, started##WHAT)); \
+} while(0)
+
+#define INIT() memset(×, 0, sizeof times)
+
+#define REPORT() do { \
+ fprintf(stderr, "total=%g\n" \
+ "gtkbits=%g\n" \
+ "menuupdate=%g\n" \
+ "new_widgets=%g\n" \
+ "undisplay=%g\n" \
+ "colors=%g\n" \
+ "markers=%g\n" \
+ "location=%g\n" \
+ "selection=%g\n" \
+ "accumulation=%g\n" \
+ "\n", \
+ tvdouble(times.total), \
+ tvdouble(times.gtkbits), \
+ tvdouble(times.menuupdate), \
+ tvdouble(times.new_widgets), \
+ tvdouble(times.undisplay), \
+ tvdouble(times.colors), \
+ tvdouble(times.markers), \
+ tvdouble(times.location), \
+ tvdouble(times.selection), \
+ (tvdouble(times.gtkbits) \
+ + tvdouble(times.menuupdate) \
+ + tvdouble(times.new_widgets) \
+ + tvdouble(times.undisplay) \
+ + tvdouble(times.colors) \
+ + tvdouble(times.markers) \
+ + tvdouble(times.location) \
+ + tvdouble(times.selection))); \
+} while(0)
+#else
+#define BEGIN(WHAT) do {
+#define END(WHAT) } while(0)
+#define INIT() ((void)0)
+#define REPORT() ((void)0)
+#endif
+
+WT(label);
+WT(event_box);
+WT(menu);
+WT(menu_item);
+WT(layout);
+WT(vbox);
+WT(arrow);
+WT(hbox);
+WT(button);
+WT(image);
+WT(entry);