Changes in tests/concurrent/preempt.cfa [8e5e945:b200492]
- File:
-
- 1 edited
-
tests/concurrent/preempt.cfa (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tests/concurrent/preempt.cfa
r8e5e945 rb200492 1 #include <clock.hfa>2 1 #include <fstream.hfa> 3 2 #include <kernel.hfa> … … 19 18 #else 20 19 static const unsigned long N = 500ul; 21 static volatile Time prev;22 static Duration preempt_durations[6] = { 0 };23 20 #endif 24 21 … … 29 26 thread worker_t { 30 27 int value; 31 unsigned long longspin;28 unsigned spin; 32 29 }; 33 30 … … 39 36 void main(worker_t & this) { 40 37 while(TEST(counter < N)) { 41 if(this.spin > 50_000_000_000) abort | "Worker" | this.value | "has been spinning too long! (" | this.spin | ")";38 if(this.spin > 100_000_000) abort | "Worker" | this.value | "has been spinning too long! (" | this.spin | ")"; 42 39 __cfaabi_check_preemption(); 43 40 if( (counter % 7) == this.value ) { 44 41 __cfaabi_check_preemption(); 45 #if !defined(TEST_LONG)46 Time now = timeHiRes();47 Duration diff = now - prev;48 prev = now;49 #endif50 42 int next = __atomic_add_fetch( &counter, 1, __ATOMIC_SEQ_CST ); 51 43 __cfaabi_check_preemption(); 52 if( (next % 100) == 0 ) { 53 #if !defined(TEST_LONG) 54 unsigned idx = next / 100; 55 if (idx >= 6) abort | "Idx from next is invalid: " | idx | "vs" | next; 56 preempt_durations[idx] = diff; 57 if(diff > 12`s) serr | "Duration suspiciously large:" | diff; 58 #endif 59 printf("%d\n", (int)next); 60 61 } 44 if( (next % 100) == 0 ) printf("%d\n", (int)next); 62 45 __cfaabi_check_preemption(); 63 46 this.spin = 0; … … 72 55 processor p; 73 56 { 74 prev = timeHiRes();75 57 worker_t w0 = 0; 76 58 worker_t w1 = 1;
Note:
See TracChangeset
for help on using the changeset viewer.