Please sign in to comment.
tests: fix gobject performance tests
The performance tests use GTimer which internally uses g_get_monotonic_time, which at least on Windows has a pretty bad resolution: depending on the configuration of the system, the wall clock time is updated as infrequently as 64 times a second (which is approximately every 16ms). For starters let's ask Windows for a higher timer resolution (see g_get_monotonic_time comments in gmain.c for more info). However, it is still possible for min_elapsed to be zero. In the common case this leads to a division by zero: factor = TARGET_ROUND_TIME / min_elapsed; or when GLib has been compiled with -D__USE_MINGW_ANSI_STDIO=1, factor ends up being inf, which is then passed into test initialisation code which is trying to do the equivalent of: n = 10000 * inf data->objects = g_new (GObject *, n); Work around these issues by setting min_elapsed = 0.001 whenever is would have been zero otherwise.
- Loading branch information...