Revision: 111 http://trac.macosforge.org/projects/libdispatch/changeset/111 Author: robert@fledge.watson.org Date: 2009-11-03 09:47:11 -0800 (Tue, 03 Nov 2009) Log Message: ----------- Use portable _dispatch_absolute_time() instead of mach_absolute_time() in dispatch_starfish; connect to portable testing build. Modified Paths: -------------- trunk/testing/Makefile.am trunk/testing/dispatch_starfish.c Modified: trunk/testing/Makefile.am =================================================================== --- trunk/testing/Makefile.am 2009-11-03 17:01:05 UTC (rev 110) +++ trunk/testing/Makefile.am 2009-11-03 17:47:11 UTC (rev 111) @@ -27,6 +27,7 @@ dispatch_cascade \ dispatch_debug \ dispatch_priority \ + dispatch_starfish \ queue_finalizer TESTS+=$(BLOCKS_TESTS) @@ -38,7 +39,6 @@ BROKEN_TESTS= \ dispatch_cffd \ dispatch_proc \ - dispatch_starfish \ dispatch_timer_set_time BROKEN_TOOLS= \ Modified: trunk/testing/dispatch_starfish.c =================================================================== --- trunk/testing/dispatch_starfish.c 2009-11-03 17:01:05 UTC (rev 110) +++ trunk/testing/dispatch_starfish.c 2009-11-03 17:47:11 UTC (rev 111) @@ -18,13 +18,14 @@ * @APPLE_APACHE_LICENSE_HEADER_END@ */ -#include <mach/mach.h> -#include <mach/mach_time.h> #include <dispatch/dispatch.h> +#include "src/internal.h" #include <stdio.h> #include <stdlib.h> #include <assert.h> +#if HAVE_TARGETCONDITIONALS_H #include <TargetConditionals.h> +#endif #include "dispatch_test.h" @@ -40,7 +41,6 @@ static size_t lap_count_down = LAPS; static size_t count_down; static uint64_t start; -static mach_timebase_info_data_t tbi; static void do_test(void); @@ -55,10 +55,8 @@ return; } - delta = mach_absolute_time() - start; - delta *= tbi.numer; - delta /= tbi.denom; - math = delta; + delta = _dispatch_absolute_time() - start; + math = delta = _dispatch_convert_mach2nano(delta); math /= COUNT * COUNT * 2ul + COUNT * 2ul; printf("lap: %ld\n", lap_count_down); @@ -125,15 +123,11 @@ do_test(void) { size_t i; - kern_return_t kr; count_down = COUNT; - kr = mach_timebase_info(&tbi); - assert(kr == 0); + start = _dispatch_absolute_time(); - start = mach_absolute_time(); - for (i = 0; i < COUNT; i++) { char buf[1000]; snprintf(buf, sizeof(buf), "com.example.starfish-node#%ld", i);
participants (1)
-
source_changes@macosforge.org