source: src/benchmark/CorCtxSwitch.c @ f1dd17a

aaron-thesisarm-ehcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerresolv-newwith_gc
Last change on this file since f1dd17a was f1dd17a, checked in by Thierry Delisle <tdelisle@…>, 5 years ago

Fixed errors and warnings in CtxSwitch? benchmarks

  • Property mode set to 100644
File size: 612 bytes
Line 
1#include <fstream>
2#include <stdlib>
3#include <thread>
4
5#include "bench.h"
6
7coroutine GreatSuspender {};
8
9void ?{}( GreatSuspender & this ) {
10        prime(this);
11}
12
13void main( GreatSuspender & this )
14{
15        while( true ) {
16                suspend();
17        }
18}
19
20void resumer( GreatSuspender & this, const unsigned int NoOfTimes ) {
21        for ( volatile unsigned int i = 0; i < NoOfTimes; i += 1 ) {
22                resume( this );
23        }
24}
25
26int main() {
27        const unsigned int NoOfTimes = N;
28        long long int StartTime, EndTime;
29
30        GreatSuspender s;
31
32        StartTime = Time();
33        resumer( s, NoOfTimes );
34        EndTime = Time();
35
36        sout | ( EndTime - StartTime ) / NoOfTimes | endl;
37}
Note: See TracBrowser for help on using the repository browser.