~thopiekar/gnustep/dep-libdispatch

« back to all changes in this revision

Viewing changes to testing/dispatch_priority.c

  • Committer: jkh@apple.com
  • Date: 2010-12-23 21:31:28 UTC
  • Revision ID: git-v1:f50a663b436cc3d820950a23490bacc8563cc5c7
Author: Joakim Johansson <jocke@tbricks.com>

Shims and small patches required to get the portable parts of the test suite to run properly, it also includes a fix for spurious failures of dispatch_priority/dispatch_priority2 due to a wraparound bug, which should affect test stability on other platforms as well.



git-svn-id: http://svn.macosforge.org/repository/libdispatch/trunk@195 5710d607-3af0-45f8-8f96-4508d4f60227

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
int priorities[PRIORITIES] = { DISPATCH_QUEUE_PRIORITY_LOW, DISPATCH_QUEUE_PRIORITY_DEFAULT, DISPATCH_QUEUE_PRIORITY_HIGH };
49
49
 
50
50
union {
51
 
        size_t count;
 
51
        long count;
52
52
        char padding[64];
53
53
} counts[PRIORITIES];
54
54
 
55
 
#define ITERATIONS (size_t)(PRIORITIES * BLOCKS * 0.50)
56
 
size_t iterations = ITERATIONS;
 
55
#define ITERATIONS (long)(PRIORITIES * BLOCKS * 0.50)
 
56
long iterations = ITERATIONS;
57
57
 
58
58
void
59
59
histogram(void) {
60
 
        size_t maxcount = BLOCKS;
61
 
        size_t sc[PRIORITIES];
62
 
        
63
 
        size_t total = 0;
64
 
        
65
 
        size_t x,y;
 
60
        long maxcount = BLOCKS;
 
61
        long sc[PRIORITIES];
 
62
        
 
63
        long total = 0;
 
64
        
 
65
        long x,y;
66
66
        for (y = 0; y < PRIORITIES; ++y) {
67
67
                sc[y] = counts[y].count;
68
68
        }
86
86
void
87
87
cpubusy(void* context)
88
88
{
89
 
        size_t *count = context;
90
 
        size_t iterdone;
 
89
        long *count = context;
 
90
        long iterdone;
91
91
 
92
 
        size_t idx;
 
92
        long idx;
93
93
        for (idx = 0; idx < LOOP_COUNT; ++idx) {
94
94
                if (done) break;
95
95
        }
132
132
                test_ptr_notnull("q[i]", q[i]);
133
133
                assert(q[i]);
134
134
                dispatch_set_target_queue(q[i], dispatch_get_global_queue(priorities[i], 0));
135
 
                dispatch_queue_set_width(q[i], DISPATCH_QUEUE_WIDTH_MAX_LOGICAL_CPUS);
 
135
                dispatch_queue_set_width(q[i], DISPATCH_QUEUE_WIDTH_MAX_LOGICAL_CPUS); 
136
136
        }
137
137
#else
138
138
        test_start("Dispatch Priority");