diff options
Diffstat (limited to 'tools/benchmark.c')
-rw-r--r-- | tools/benchmark.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/tools/benchmark.c b/tools/benchmark.c index bff8b50..0939d78 100644 --- a/tools/benchmark.c +++ b/tools/benchmark.c @@ -100,7 +100,8 @@ grab_frames_sync (UcaCamera *camera, gpointer buffer, guint n_frames) uca_camera_start_recording (camera, &error); for (guint i = 0; i < n_frames; i++) { - uca_camera_grab(camera, &buffer, &error); + if (!uca_camera_grab (camera, buffer, &error)) + g_warning ("Data stream ended"); if (error != NULL) { g_warning ("Error grabbing frame %02i/%i: `%s'", i, n_frames, error->message); @@ -115,8 +116,12 @@ grab_frames_sync (UcaCamera *camera, gpointer buffer, guint n_frames) static void grab_callback (gpointer data, gpointer user_data) { + static GStaticMutex mutex = G_STATIC_MUTEX_INIT; guint *n_acquired_frames = user_data; + + g_static_mutex_lock (&mutex); *n_acquired_frames += 1; + g_static_mutex_unlock (&mutex); } static void @@ -136,7 +141,6 @@ grab_frames_async (UcaCamera *camera, gpointer buffer, guint n_frames) ; uca_camera_stop_recording (camera, &error); - } static void @@ -204,6 +208,7 @@ benchmark (UcaCamera *camera) g_print ("# Sensor size: %ix%i\n", sensor_width, sensor_height); g_print ("# ROI size: %ix%i\n", roi_width, roi_height); g_print ("# Exposure time: %fs\n", exposure); + g_print ("# Bits: %i\n", bits); /* Synchronous frame acquisition */ g_print ("# %-10s%-10s%-10s%-16s%-16s\n", "type", "n_frames", "n_runs", "frames/s", "MiB/s"); @@ -250,7 +255,7 @@ main (int argc, char *argv[]) g_log_set_handler (NULL, G_LOG_LEVEL_MASK, log_handler, log_channel); manager = uca_plugin_manager_new (); - camera = uca_plugin_manager_get_camera (manager, argv[1], &error); + camera = uca_plugin_manager_get_camera (manager, argv[1], &error, NULL); if (camera == NULL) { g_error ("Initialization: %s", error->message); |