Update German translation
[glib.git] / glib / tests / bitlock.c
blob694fe6dd1eb27adb220d4d4224a909eda18a6e14
1 #include <glib.h>
3 #define ITERATIONS 100000000
5 static void
6 test_bitlocks (void)
8 guint64 start = g_get_monotonic_time ();
9 gint lock = 0;
10 gint i;
12 for (i = 0; i < ITERATIONS; i++)
14 g_bit_lock (&lock, 0);
15 g_bit_unlock (&lock, 0);
19 gdouble elapsed;
20 gdouble rate;
22 elapsed = g_get_monotonic_time () - start;
23 elapsed /= 1000000;
24 rate = ITERATIONS / elapsed;
26 g_test_maximized_result (rate, "iterations per second");
30 int
31 main (int argc, char **argv)
33 g_test_init (&argc, &argv, NULL);
35 if (g_test_perf ())
36 g_test_add_func ("/bitlock/performance/uncontended", test_bitlocks);
38 return g_test_run ();