diff options
author | Bill Haneman <billh@src.gnome.org> | 2006-02-14 14:05:04 +0000 |
---|---|---|
committer | Bill Haneman <billh@src.gnome.org> | 2006-02-14 14:05:04 +0000 |
commit | 2813bc305caa57eefb59b79a7f6b4e6533243618 (patch) | |
tree | 32eea7520eda76a4476952525872a92665c76cbe | |
parent | ff69fc128cf9aebc4af3db698efaeebfa60dc0d7 (diff) |
Patch from Carlos Eduardo Diogenes, replace timeofday with g_timers,gnome-2-14-0GNOME_MAG_0_12_4GNOME_2_14_0
update MAINTAINERS.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | MAINTAINERS | 1 | ||||
-rw-r--r-- | magnifier/magnifier-main.c | 4 | ||||
-rw-r--r-- | magnifier/magnifier.c | 8 | ||||
-rw-r--r-- | magnifier/magnifier.h | 76 | ||||
-rw-r--r-- | magnifier/zoom-region.c | 138 |
6 files changed, 125 insertions, 107 deletions
@@ -1,3 +1,8 @@ +2006-02-14 Bill Haneman <bill.haneman@sun.com> + + * docs/reference/Makefile.am: + Make doxygen optional (bug #330720, thanks to Sylvain Bertrand). + 2006-01-19 Bill Haneman <bill.haneman@sun.com> * configure.in: Revved to 0.12.3. diff --git a/MAINTAINERS b/MAINTAINERS index d69814c..bd832f0 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1 +1,2 @@ Bill Haneman <bill.haneman@sun.com> +Carlos Eduardo Rodrigues Diógenes <cerdiogenes@yahoo.com.br> diff --git a/magnifier/magnifier-main.c b/magnifier/magnifier-main.c index 237484c..9639e60 100644 --- a/magnifier/magnifier-main.c +++ b/magnifier/magnifier-main.c @@ -368,6 +368,8 @@ main (int argc, char** argv) while (poptGetNextOpt (ctx) >= 0) /**/; + poptFreeContext (ctx); + /** * slight hack, we set $DISPLAY if --target-display is set. * this is because I don't think GTK+ works well with across multiple @@ -569,6 +571,6 @@ main (int argc, char** argv) if (pan_handle) g_source_remove (pan_handle); - + return 0; } diff --git a/magnifier/magnifier.c b/magnifier/magnifier.c index 68b68e4..4196413 100644 --- a/magnifier/magnifier.c +++ b/magnifier/magnifier.c @@ -673,7 +673,8 @@ magnifier_get_display_rect_bounds (Magnifier *magnifier, GNOME_Magnifier_RectBou } } -static void magnifier_adjust_source_size (Magnifier *magnifier) +static void +magnifier_adjust_source_size (Magnifier *magnifier) { GNOME_Magnifier_RectBounds rect_bounds; gdouble vfract_top, vfract_bottom, hfract_left, hfract_right; @@ -1885,6 +1886,11 @@ magnifier_init (Magnifier *magnifier) gdk_display_get_screen (magnifier->target_display, magnifier->target_screen_num)); magnifier_init_cursor_set (magnifier, "default"); + + mag_timing.process = g_timer_new (); + mag_timing.frame = g_timer_new (); + mag_timing.scale = g_timer_new (); + mag_timing.idle = g_timer_new (); #ifdef DEBUG_CLIENT_CALLS client_debug = (g_getenv ("MAG_CLIENT_DEBUG") != NULL); #endif diff --git a/magnifier/magnifier.h b/magnifier/magnifier.h index 5df3b66..71b4e5b 100644 --- a/magnifier/magnifier.h +++ b/magnifier/magnifier.h @@ -33,6 +33,7 @@ extern "C" { #include <bonobo/bonobo-object.h> #include <bonobo/bonobo-property-bag.h> #include <login-helper/login-helper.h> +#include <glib.h> #include "GNOME_Magnifier.h" #define MAGNIFIER_TYPE (magnifier_get_type ()) @@ -75,6 +76,81 @@ typedef struct { POA_GNOME_Magnifier_Magnifier__epv epv; } MagnifierClass; +/* + * When running the magnifier in timing test mode (--timing-pan-rate and/or + * --timing-iterations), then the following output is displayed: + * + * Pan Rate = 200 + * Frames Processed = 1225 + * Width/Height/Depth = 640/1024/8 + * Zoom Factor (x/y) = 3.000000/3.000000 + * Update Duration = (avg. 0.010232) (max. 0.002685) (tot. 1.084589) seconds + * Update Pixels = (avg. 3046) pixels/frame + * Update Rate = (avg. 97.732909) (max. 372.439485) updates/second + * Net Update Rate = (avg. 0.297724) (max. 0.457741) Mpex/second + * Pan Latency = (avg. 0.008229) (max. 0.562326) seconds + * Tot Frame Duration = (avg. 0.008363) (max. 0.562485) (tot. 10.235981)seconds + * Frame Rate = (avg. 119.578189) (max. 4854.369141) frames/second + * Scroll Delta (x) = (avg. 0.000000) (tot. 0) lines + * Scroll Delta (y) = (avg. 5.019608) (tot. 6144) lines + * Scroll Rate (x) = (avg. 0.000000) lines/second + * Scroll Rate (y) = (avg. 600.235657) lines/second + * Net Render Rate = (avg. 8.685322) (max. 3181.359360) Mpex/second + * + * Pan Rate - Displays the pan rate specified on the command line. + * Only displayed if --timing-pan-rate is used. + * Frames Processed - Number of frames displayed + * Width/Height/Depth - The width/height/depth of magnifier display. + * Zoom Factor (x/y) - The zoom factor used. + * Update Duration - Average and total time spent updating new sections of + * the screen. + * Update Pixels - Number of pixels updated + * Update Rate - Number of updates possible per second. + * Net Update Rate - Number of Megapixels updated per second. + * Pan Latency - Time spent from the beginning of the setROI request + * until GTK+ has finished processing the update (in + * GDK's gdk_window_update_idle idle handler. + * Total Frame Duration - Average and total time processing frames. + * Frame Rate - Number of frames per second. + * Scroll Delta - Average and total number of lines scrolled. + * Scroll Rate - Number of lines scrolled per second. Note that this + * value will be equal to the --timing-pan-rate value + * times the y zoom factor. + * Net Render Rate - Number of Megapixels processed per second. + * + * When running with the --timing-output argument, similar information is + * displayed for each frame plus timing information for the frame. Update + * information is not displayed for frames where updates do not occur. Pan + * Rate, Frames Processed, and Width/Height/Depth is not displayed for each + * frame, only when displaying summary information. + */ + +typedef struct timing { + GTimer *process; + GTimer *frame; + GTimer *scale; + GTimer *idle; + gdouble scale_val; + gdouble idle_val; + gdouble frame_val; + int dx; + int dy; + gdouble scale_total; + gdouble idle_total; + gdouble frame_total; + int dx_total; + int dy_total; + long update_pixels_total; + long num_scale_samples; + long num_idle_samples; + long num_frame_samples; + long num_line_samples; + gdouble last_frame_val; + int last_dy; +} TimingStruct; + +TimingStruct mag_timing; + GdkDrawable *magnifier_get_cursor (Magnifier *magnifier); GType magnifier_get_type (void); GdkWindow *magnifier_get_root (Magnifier *magnifier); diff --git a/magnifier/zoom-region.c b/magnifier/zoom-region.c index b3dabfc..a3b426c 100644 --- a/magnifier/zoom-region.c +++ b/magnifier/zoom-region.c @@ -23,7 +23,6 @@ #include <stdlib.h> #include <string.h> #include <popt.h> -#include <sys/time.h> /* TODO: replace timeofday with g_timers */ #include <gdk/gdkwindow.h> #include <gtk/gtk.h> #ifdef USE_GDKPIXBUF_RENDER_TO_DRAWABLE @@ -107,82 +106,6 @@ typedef enum { ZOOM_REGION_ERROR_TOO_BIG } ZoomRegionPixmapCreationError; -/* - * When running the magnifier in timing test mode (--timing-pan-rate and/or --timing-iterations), - * then the following output is displayed: - * - * Pan Rate = 200 - * Frames Processed = 1225 - * Width/Height/Depth = 640/1024/8 - * Zoom Factor (x/y) = 3.000000/3.000000 - * Update Duration = (avg. 0.010232) (max. 0.002685) (tot. 1.084589) seconds - * Update Pixels = (avg. 3046) pixels/frame - * Update Rate = (avg. 97.732909) (max. 372.439485) updates/second - * Net Update Rate = (avg. 0.297724) (max. 0.457741) Mpex/second - * Pan Latency = (avg. 0.008229) (max. 0.562326) seconds - * Total Frame Duration = (avg. 0.008363) (max. 0.562485) (tot. 10.235981) seconds - * Frame Rate = (avg. 119.578189) (max. 4854.369141) frames/second - * Scroll Delta (x) = (avg. 0.000000) (tot. 0) lines - * Scroll Delta (y) = (avg. 5.019608) (tot. 6144) lines - * Scroll Rate (x) = (avg. 0.000000) lines/second - * Scroll Rate (y) = (avg. 600.235657) lines/second - * Net Render Rate = (avg. 8.685322) (max. 3181.359360) Mpex/second - * - * Pan Rate - Displays the pan rate specified on the command line. - * Only displayed if --timing-pan-rate is used. - * Frames Processed - Number of frames displayed - * Width/Height/Depth - The width/height/depth of magnifier display. - * Zoom Factor (x/y) - The zoom factor used. - * Update Duration - Average and total time spent updating new sections of the screen. - * Update Pixels - Number of pixels updated - * Update Rate - Number of updates possible per second. - * Net Update Rate - Number of Megapixels updated per second. - * Pan Latency - Time spent from the beginning of the setROI request until GTK+ - * has finished processing the update (in GDK's - * gdk_window_update_idle idle handler. - * Total Frame Duration - Average and total time processing frames. - * Frame Rate - Number of frames per second. - * Scroll Delta - Average and total number of lines scrolled. - * Scroll Rate - Number of lines scrolled per second. Note that this value - * will be equal to the --timing-pan-rate value times the - * y zoom factor. - * Net Render Rate - Number of Megapixels processed per second. - * - * When running with the --timing-output argument, similar information is displayed for - * each frame plus timing information for the frame. Update information is not - * displayed for frames where updates do not occur. Pan Rate, Frames Processed, - * and Width/Height/Depth is not displayed for each frame, only when displaying - * summary information. - */ - -typedef struct timing { - struct timeval process_start; - struct timeval process_end; - struct timeval frame_start; - struct timeval frame_end; - struct timeval scale_start; - struct timeval scale_end; - struct timeval idle_start; - struct timeval idle_end; - float scale_val; - float idle_val; - float frame_val; - int dx; - int dy; - float scale_total; - float idle_total; - float frame_total; - int dx_total; - int dy_total; - long update_pixels_total; - long num_scale_samples; - long num_idle_samples; - long num_frame_samples; - long num_line_samples; - float last_frame_val; - int last_dy; -} TimingStruct; - static float timing_scale_max = 0; static float timing_idle_max = 0; static float timing_frame_max = 0; @@ -193,7 +116,6 @@ static gboolean reset_timing = FALSE; static gboolean timing_test = FALSE; static guint pending_idle_handler = 0; -static TimingStruct mag_timing; static gboolean processing_updates = FALSE; static gboolean timing_start = FALSE; @@ -243,7 +165,7 @@ reset_timing_stats() mag_timing.dy_total = 0; mag_timing.last_frame_val = 0; mag_timing.last_dy = 0; - gettimeofday(&mag_timing.process_start, NULL); + g_timer_start (mag_timing.process); } /** DEBUG STUFF **/ @@ -863,7 +785,6 @@ zoom_region_paint_crosswire_cursor (ZoomRegion *zoom_region, GdkRectangle *clip_ GdkRectangle rect; GdkDrawable *cursor; GdkColor color = {0, 0, 0, 0}; - GdkColor tmp_color; int x_left_clip = 0, x_right_clip = 0, y_top_clip = 0, y_bottom_clip = 0; int csize = 0; @@ -1283,8 +1204,9 @@ zoom_region_expose_handler (GtkWindow * w, zoom_region_paint (zoom_region, &event->area); } -static void zoom_region_update_cursor (ZoomRegion *zoom_region, int dx, int dy, - GdkRectangle *clip_rect) +static void +zoom_region_update_cursor (ZoomRegion *zoom_region, int dx, int dy, + GdkRectangle *clip_rect) { #ifdef ZOOM_REGION_DEBUG g_assert (zoom_region->alive); @@ -1805,7 +1727,7 @@ zoom_region_update (ZoomRegion *zoom_region, if (subimage && zoom_region->priv->w && zoom_region->priv->w->window) { GdkRectangle paint_rect; - gettimeofday(&mag_timing.scale_start, NULL); + g_timer_start (mag_timing.scale); DEBUG_RECT ("source rect", source_rect); paint_rect = zoom_region_view_rect_from_source_rect (zoom_region, source_rect); /* paint_rect = zoom_region_clip_to_scaled_pixmap (zoom_region, paint_rect); */ @@ -1814,8 +1736,8 @@ zoom_region_update (ZoomRegion *zoom_region, _zoom_region_invert_pixbuf (subimage); /** - * XXX: We seem to be breaking with the original intention here, which was to - * keep a fullscreen scaled pixbuf in-sync. + * XXX: We seem to be breaking with the original intention + * here, which was to keep a fullscreen scaled pixbuf in-sync. **/ gdk_pixbuf_scale (subimage, zoom_region->priv->scaled_pixbuf, @@ -1870,13 +1792,15 @@ zoom_region_update (ZoomRegion *zoom_region, gdk_window_begin_paint_rect (zoom_region->priv->w->window, &paint_rect); zoom_region_paint (zoom_region, &paint_rect); gdk_window_end_paint (zoom_region->priv->w->window); - gettimeofday(&mag_timing.scale_end, NULL); + g_timer_stop (mag_timing.scale); if (timing_test) { mag_timing.num_scale_samples++; + + gulong microseconds; + mag_timing.scale_val = - (mag_timing.scale_end.tv_sec - mag_timing.scale_start.tv_sec) + - ((float)(mag_timing.scale_end.tv_usec - mag_timing.scale_start.tv_usec) / - 1000000.0); + g_timer_elapsed (mag_timing.scale, + µseconds); mag_timing.scale_total += mag_timing.scale_val; if (mag_timing.scale_val != 0 && (timing_scale_max == 0 || @@ -2049,10 +1973,12 @@ zoom_region_time_frame(ZoomRegion *zoom_region, Magnifier *magnifier) int height = magnifier->target_bounds.y2 - magnifier->target_bounds.y1; mag_timing.num_frame_samples++; - gettimeofday(&mag_timing.frame_end, NULL); - mag_timing.frame_val = (mag_timing.frame_end.tv_sec - mag_timing.frame_start.tv_sec) + - ((float)(mag_timing.frame_end.tv_usec - mag_timing.frame_start.tv_usec) / - 1000000.0); + g_timer_stop (mag_timing.frame); + + gulong microseconds; + + mag_timing.frame_val = g_timer_elapsed (mag_timing.frame, + µseconds); mag_timing.frame_total += mag_timing.frame_val; if (mag_timing.frame_val > timing_frame_max) @@ -2165,14 +2091,15 @@ gdk_timing_idle (gpointer data) /* Now update has finished, reset processing_updates */ processing_updates = FALSE; - gettimeofday(&mag_timing.idle_end, NULL); + g_timer_stop (mag_timing.idle); if (timing_test) { mag_timing.num_idle_samples++; - mag_timing.idle_val = - (mag_timing.idle_end.tv_sec - mag_timing.idle_start.tv_sec) + - ((float)(mag_timing.idle_end.tv_usec - mag_timing.idle_start.tv_usec) / - 1000000.0); + + gulong microseconds; + + mag_timing.idle_val = g_timer_elapsed (mag_timing.idle, + µseconds); mag_timing.idle_total += mag_timing.idle_val; if (mag_timing.idle_val > timing_idle_max) @@ -2199,7 +2126,7 @@ zoom_region_align (ZoomRegion *zoom_region) zoom_region_time_frame(zoom_region, magnifier); if (timing_test) { - gettimeofday(&mag_timing.frame_start, NULL); + g_timer_start (mag_timing.frame); if (zoom_region->timing_output) { gint x, y; @@ -2221,12 +2148,12 @@ zoom_region_align (ZoomRegion *zoom_region) * until we have processed an entire frame. */ if (!timing_start) - gettimeofday(&mag_timing.process_start, NULL); + g_timer_start (mag_timing.process); timing_start = TRUE; } - gettimeofday(&mag_timing.idle_start, NULL); + g_timer_start (mag_timing.idle); /* * zoom_region_align calls @@ -2556,10 +2483,11 @@ zoom_region_pan_test (gpointer data) roi.x1 = zoom_region->roi.x1; roi.x2 = zoom_region->roi.x2; - gettimeofday(&mag_timing.process_end, NULL); - total_time = (mag_timing.process_end.tv_sec - mag_timing.process_start.tv_sec) + - ((float)(mag_timing.process_end.tv_usec - mag_timing.process_start.tv_usec) / - 1000000.0); + g_timer_stop (mag_timing.process); + + gulong microseconds; + + total_time = g_timer_elapsed (mag_timing.process, µseconds); if (mag_timing.frame_total != 0.0) pixels_at_speed = total_time * zoom_region->timing_pan_rate; |