> > On Fri, Dec 21, 2018 at 4:04 PM Frediano Ziglio <fziglio@xxxxxxxxxx> wrote: > > > > usleep under Windows does not seem to have the required precision. > > Use milliseconds and adjust check times according. > > > > Have you given g_usleep() a try? It has some specific windows handling. > Implementation is Sleep (microseconds ? (1 + (microseconds - 1) / 1000) : 0); So does the same, round up to millisecond. It seems a limit in the Windows scheduler. > > > Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx> > > --- > > server/tests/stat-test.c | 12 ++++++------ > > 1 file changed, 6 insertions(+), 6 deletions(-) > > > > diff --git a/server/tests/stat-test.c b/server/tests/stat-test.c > > index e4a83f4f..444ff7e3 100644 > > --- a/server/tests/stat-test.c > > +++ b/server/tests/stat-test.c > > @@ -57,13 +57,13 @@ void TEST_NAME(void) > > > > stat_init(&info, "test", CLOCK_MONOTONIC); > > stat_start_time_init(&start_time, &info); > > - usleep(2); > > + usleep(2000); > > stat_add(&info, start_time); > > > > #ifdef RED_WORKER_STAT > > g_assert_cmpuint(info.count, ==, 1); > > g_assert_cmpuint(info.min, ==, info.max); > > - g_assert_cmpuint(info.min, >=, 2000); > > + g_assert_cmpuint(info.min, >=, 2000000); > > g_assert_cmpuint(info.min, <, 100000000); > > #endif > > > > @@ -71,17 +71,17 @@ void TEST_NAME(void) > > > > stat_compress_init(&info, "test", CLOCK_MONOTONIC); > > stat_start_time_init(&start_time, &info); > > - usleep(2); > > + usleep(2000); > > stat_compress_add(&info, start_time, 100, 50); > > - usleep(1); > > + usleep(1000); > > stat_compress_add(&info, start_time, 1000, 500); > > > > #ifdef COMPRESS_STAT > > g_assert_cmpuint(info.count, ==, 2); > > g_assert_cmpuint(info.min, !=, info.max); > > - g_assert_cmpuint(info.min, >=, 2000); > > + g_assert_cmpuint(info.min, >=, 2000000); > > g_assert_cmpuint(info.min, <, 100000000); > > - g_assert_cmpuint(info.total, >=, 5000); > > + g_assert_cmpuint(info.total, >=, 5000000); > > g_assert_cmpuint(info.orig_size, ==, 1100); > > g_assert_cmpuint(info.comp_size, ==, 550); > > #endif Frediano _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel