summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@gmail.com>2013-02-06 11:13:32 +0100
committerMatthias Vogelgesang <matthias.vogelgesang@gmail.com>2013-02-06 11:13:32 +0100
commitb93ce16e227d3247fea2f2178b3f8f6756a3ac50 (patch)
tree5f2b51e58ded4c6f575cef8ef0dc7cea5bf3ab93 /tools
parent9fbb0ddf466556f762f191415c27a50b96a71787 (diff)
downloaduca-b93ce16e227d3247fea2f2178b3f8f6756a3ac50.tar.gz
uca-b93ce16e227d3247fea2f2178b3f8f6756a3ac50.tar.bz2
uca-b93ce16e227d3247fea2f2178b3f8f6756a3ac50.tar.xz
uca-b93ce16e227d3247fea2f2178b3f8f6756a3ac50.zip
Lock n_frames for correct results
Diffstat (limited to 'tools')
-rw-r--r--tools/benchmark.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/benchmark.c b/tools/benchmark.c
index bff8b50..e062e61 100644
--- a/tools/benchmark.c
+++ b/tools/benchmark.c
@@ -115,8 +115,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
@@ -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");