Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/benchmark/bench.c

    r17af7d1 r8cb6fcd  
    44#include <thread>
    55
    6 #include <unistd.h>                                     // sysconf
    7 #include <sys/times.h>                                  // times
    8 #include <time.h>
    9 
    10 inline unsigned long long int Time() {
    11     timespec ts;
    12     clock_gettime(
    13 #if defined( __linux__ )
    14          CLOCK_THREAD_CPUTIME_ID,
    15 #elif defined( __freebsd__ )
    16          CLOCK_PROF,
    17 #elif defined( __solaris__ )
    18          CLOCK_HIGHRES,
    19 #else
    20     #error uC++ : internal error, unsupported architecture
    21 #endif
    22          &ts );
    23     return 1000000000LL * ts.tv_sec + ts.tv_nsec;
    24 } // Time
     6#include "bench.h"
    257
    268//=======================================
     
    8668//=======================================
    8769
    88 struct CoroutineDummy { coroutine_desc __cor; };
    89 DECL_COROUTINE(CoroutineDummy);
     70coroutine CoroutineDummy {};
    9071void main(CoroutineDummy * this) {}
    9172
     
    11798}
    11899
    119 struct CoroutineResume {
     100coroutine CoroutineResume {
    120101    int N;
    121     coroutine_desc __cor;
    122102};
    123 
    124 DECL_COROUTINE(CoroutineResume);
    125103
    126104void ?{}(CoroutineResume* this, int N) {
     
    150128//=======================================
    151129
    152 struct ThreadDummy { thread_desc __thrd; };
    153 DECL_THREAD(ThreadDummy);
     130thread ThreadDummy {};
    154131void main(ThreadDummy * this) {}
    155132
     
    177154}
    178155
    179 struct ContextSwitch {
     156thread ContextSwitch {
    180157    int N;
    181158    long long result;
    182     thread_desc __thrd;
    183159};
    184 
    185 DECL_THREAD(ContextSwitch);
    186160
    187161void main(ContextSwitch * this) {   
     
    241215        DynamicTaskCreateDelete( NoOfTimes );
    242216        {
    243                 scoped(ContextSwitch) dummy = { (int)NoOfTimes };               // context switch
     217                ContextSwitch dummy = { (int)NoOfTimes };               // context switch
    244218        }
    245219        sout | "\t" | endl;
Note: See TracChangeset for help on using the changeset viewer.