Changes in / [45a4ea7:4f9636f]


Ignore:
Location:
src
Files:
9 added
6 deleted
10 edited

Legend:

Unmodified
Added
Removed
  • src/Concurrency/Keywords.cc

    r45a4ea7 r4f9636f  
    246246        //=============================================================================================
    247247        void ConcurrentSueKeyword::visit(StructDecl * decl) {
     248                Visitor::visit(decl);
    248249                if( decl->get_name() == type_name ) {
    249250                        assert( !type_decl );
     
    385386        //=============================================================================================
    386387        void MutexKeyword::visit(FunctionDecl* decl) {
     388                Visitor::visit(decl);           
     389
    387390                std::list<DeclarationWithType*> mutexArgs = findMutexArgs( decl );
    388391                if( mutexArgs.empty() ) return;
     
    402405
    403406        void MutexKeyword::visit(StructDecl* decl) {
     407                Visitor::visit(decl);
     408
    404409                if( decl->get_name() == "monitor_desc" ) {
    405410                        assert( !monitor_decl );
     
    504509        //=============================================================================================
    505510        void ThreadStarter::visit(FunctionDecl * decl) {
     511                Visitor::visit(decl);
     512               
    506513                if( ! InitTweak::isConstructor(decl->get_name()) ) return;
    507514
  • src/benchmark/CorCtxSwitch.c

    r45a4ea7 r4f9636f  
    33#include <thread>
    44
    5 #include <unistd.h>                                     // sysconf
    6 #include <sys/times.h>                                  // times
    7 #include <time.h>
    8 
    9 inline unsigned long long int Time() {
    10     timespec ts;
    11     clock_gettime(
    12 #if defined( __linux__ )
    13          CLOCK_THREAD_CPUTIME_ID,
    14 #elif defined( __freebsd__ )
    15          CLOCK_PROF,
    16 #elif defined( __solaris__ )
    17          CLOCK_HIGHRES,
    18 #else
    19     #error uC++ : internal error, unsupported architecture
    20 #endif
    21          &ts );
    22     return 1000000000LL * ts.tv_sec + ts.tv_nsec;
    23 } // Time
     5#include "bench.h"
    246
    257coroutine GreatSuspender {};
     
    4224}
    4325
    44 #ifndef N
    45 #define N 100000000
    46 #endif
    47 
    4826int main() {
    4927        const unsigned int NoOfTimes = N;
  • src/benchmark/Makefile.am

    r45a4ea7 r4f9636f  
    4444        @rm -f ./a.out
    4545
     46sched-int:
     47        ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=10000000 SchedInt.c
     48        @for number in 1 2 3 4 5 6 7 8 9 10; do \
     49                ./a.out ; \
     50        done
     51        @rm -f ./a.out
     52
     53monitor:
     54        ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=10000000 Monitor.c
     55        @for number in 1 2 3 4 5 6 7 8 9 10; do \
     56                ./a.out ; \
     57        done
     58        @rm -f ./a.out
     59
    4660csv-data:
    4761        @${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -quiet -DN=10000000 csv-data.c
  • src/benchmark/Makefile.in

    r45a4ea7 r4f9636f  
    492492        @rm -f ./a.out
    493493
     494sched-int:
     495        ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=10000000 SchedInt.c
     496        @for number in 1 2 3 4 5 6 7 8 9 10; do \
     497                ./a.out ; \
     498        done
     499        @rm -f ./a.out
     500
     501monitor:
     502        ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=10000000 Monitor.c
     503        @for number in 1 2 3 4 5 6 7 8 9 10; do \
     504                ./a.out ; \
     505        done
     506        @rm -f ./a.out
     507
    494508csv-data:
    495509        @${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -quiet -DN=10000000 csv-data.c
  • src/benchmark/ThrdCtxSwitch.c

    r45a4ea7 r4f9636f  
    33#include <thread>
    44
    5 #include <unistd.h>                                     // sysconf
    6 #include <sys/times.h>                                  // times
    7 #include <time.h>
    8 
    9 inline unsigned long long int Time() {
    10     timespec ts;
    11     clock_gettime(
    12 #if defined( __linux__ )
    13          CLOCK_THREAD_CPUTIME_ID,
    14 #elif defined( __freebsd__ )
    15          CLOCK_PROF,
    16 #elif defined( __solaris__ )
    17          CLOCK_HIGHRES,
    18 #else
    19     #error uC++ : internal error, unsupported architecture
    20 #endif
    21          &ts );
    22     return 1000000000LL * ts.tv_sec + ts.tv_nsec;
    23 } // Time
    24  
    25 #ifndef N
    26 #define N 100000000
    27 #endif
     5#include "bench.h"
    286
    297int main() {
  • src/benchmark/bench.c

    r45a4ea7 r4f9636f  
    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//=======================================
  • src/benchmark/csv-data.c

    r45a4ea7 r4f9636f  
    11#include <fstream>
     2#include <monitor>
    23#include <stdlib>
    34#include <thread>
    45
    5 extern "C" {
    6 #include <unistd.h>                                     // sysconf
    7 #include <sys/times.h>                                  // times
    8 #include <time.h>
    9 }
    10 
    11 inline unsigned long long int Time() {
    12     timespec ts;
    13     clock_gettime(
    14 #if defined( __linux__ )
    15          CLOCK_THREAD_CPUTIME_ID,
    16 #elif defined( __freebsd__ )
    17          CLOCK_PROF,
    18 #elif defined( __solaris__ )
    19          CLOCK_HIGHRES,
    20 #else
    21     #error uC++ : internal error, unsupported architecture
    22 #endif
    23          &ts );
    24     return 1000000000LL * ts.tv_sec + ts.tv_nsec;
    25 } // Time
     6#include "bench.h"
    267
    278coroutine GreatSuspender {};
     
    4829#endif
    4930
    50 
    51 
     31//-----------------------------------------------------------------------------
     32// coroutine context switch
    5233long long int measure_coroutine() {
    5334        const unsigned int NoOfTimes = N;
     
    6748}
    6849
     50//-----------------------------------------------------------------------------
     51// thread context switch
    6952long long int measure_thread() {
    7053        const unsigned int NoOfTimes = N;
     
    8063}
    8164
     65//-----------------------------------------------------------------------------
     66// single monitor entry
     67monitor mon_t {};
     68void dummy( mon_t * mutex m ) {}
     69
     70long long int measure_1_monitor_entry() {
     71        const unsigned int NoOfTimes = N;
     72        long long int StartTime, EndTime;
     73        mon_t mon;
     74
     75        StartTime = Time();
     76        for ( volatile unsigned int i = 0; i < NoOfTimes; i += 1 ) {
     77                dummy( &mon );
     78        }
     79        EndTime = Time();
     80
     81        return ( EndTime - StartTime ) / NoOfTimes;
     82}
     83
     84//-----------------------------------------------------------------------------
     85// multi monitor entry
     86void dummy( mon_t * mutex m1,  mon_t * mutex m2 ) {}
     87
     88long long int measure_2_monitor_entry() {
     89        const unsigned int NoOfTimes = N;
     90        long long int StartTime, EndTime;
     91        mon_t mon1, mon2;
     92
     93        StartTime = Time();
     94        for ( volatile unsigned int i = 0; i < NoOfTimes; i += 1 ) {
     95                dummy( &mon1, &mon2 );
     96        }
     97        EndTime = Time();
     98
     99        return ( EndTime - StartTime ) / NoOfTimes;
     100}
     101
    82102int main()
    83103{
    84         sout | time(NULL) | ',' | measure_coroutine() | ',' | measure_thread() | endl;
     104        sout | time(NULL) | ',';
     105        sout | measure_coroutine() | ',';
     106        sout | measure_thread() | ',';
     107        sout | measure_1_monitor_entry() | ',';
     108        sout | measure_2_monitor_entry() | endl;
    85109}
  • src/libcfa/concurrency/thread.c

    r45a4ea7 r4f9636f  
    4040        this->next = NULL;
    4141
    42         this->current_monitors      = NULL;
    43         this->current_monitor_count = 0;
     42        this->current_monitors      = &this->mon;
     43        this->current_monitor_count = 1;
    4444}
    4545
  • src/tests/Makefile.am

    r45a4ea7 r4f9636f  
    2222concurrent=yes
    2323quick_test+= coroutine thread monitor
    24 concurrent_test=coroutine thread monitor multi-monitor sched-int sched-int-multi sched-int-multi2 sched-ext sched-ext-multi preempt
     24concurrent_test=coroutine thread monitor multi-monitor sched-int-disjoint sched-int-barge sched-int-wait sched-ext sched-ext-multi preempt
    2525else
    2626concurrent=no
  • src/tests/Makefile.in

    r45a4ea7 r4f9636f  
    230230@BUILD_CONCURRENCY_TRUE@concurrent = yes
    231231@BUILD_CONCURRENCY_FALSE@concurrent_test =
    232 @BUILD_CONCURRENCY_TRUE@concurrent_test = coroutine thread monitor multi-monitor sched-int sched-int-multi sched-int-multi2 sched-ext sched-ext-multi preempt
     232@BUILD_CONCURRENCY_TRUE@concurrent_test = coroutine thread monitor multi-monitor sched-int-disjoint sched-int-barge sched-int-wait sched-ext sched-ext-multi preempt
    233233
    234234# applies to both programs
Note: See TracChangeset for help on using the changeset viewer.