Changeset d8d9c115 for tests


Ignore:
Timestamp:
May 30, 2023, 8:30:17 PM (15 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ast-experimental, master
Children:
5d81edb
Parents:
8cbb6aa
Message:

reduce duration of lock-free stack test on ARM because CASV is very slow on ARM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/concurrency/lockfree_stack.cfa

    r8cbb6aa rd8d9c115  
    1010// Created On       : Thu May 25 15:36:50 2023
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri May 26 08:08:47 2023
    13 // Update Count     : 4
     12// Last Modified On : Tue May 30 19:02:32 2023
     13// Update Count     : 18
    1414//
    1515
     
    2020struct Node;                                                                                    // forward declaration
    2121union Link {
    22         struct {                                                                                        // 64-bit x 2
     22        struct {                                                                                        // 32/64-bit x 2
    2323                Node * volatile top;                                                    // pointer to stack top
    2424                uintptr_t count;                                                                // count each push
     
    5757Stack stack;                                                                                    // global stack
    5858
     59enum { Times =
     60        #if defined( __ARM_ARCH )                                                       // ARM CASV is very slow
     61        10_000
     62        #else
     63        1_000_000
     64        #endif // __arm_64__
     65};
     66
    5967thread Worker {};
    6068void main( Worker & w ) {
    61         for ( i; 100000 ) {
    62                 Node & n = *pop( stack );
     69        for ( i; Times ) {
     70                Node & n = *pop( stack );                                               // pop any node
    6371                assert( &n != NULL );
    64                 n.next.top = 0p;                                                                // shrub fields
     72                n.next.top = 0p;                                                                // scrub fields
    6573                n.next.count = 0;
    6674                //yield( rand() % 3 );
    67                 push( stack, n );
     75                push( stack, n );                                                               // push it back
    6876        }
    6977}
    7078
    71 
    7279int main() {
    73         enum { N = 10 };
    74         processor p[N - 1];                                                                     // kernel threads
     80        enum { N = 8 };                                                                         // kernel threads
     81        processor p[N - 1];                                                                     // add kernel threads
    7582
    7683        for ( i; N ) {                                                                          // push N values on stack
Note: See TracChangeset for help on using the changeset viewer.