source: src/benchmark/ctxswitch/cfa_cor.c @ 4149d9d

aaron-thesisarm-ehcleanup-dtorsdeferred_resndemanglerjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerresolv-newwith_gc
Last change on this file since 4149d9d was 034165a, checked in by Thierry Delisle <tdelisle@…>, 4 years ago

renamed and updated benchmarks for consistency

  • Property mode set to 100644
File size: 516 bytes
RevLine 
[de90452]1#include <fstream>
2#include <stdlib>
[29f44a74]3#include <thread>
[de90452]4
[8cb6fcd]5#include "bench.h"
[de90452]6
[b510ac2]7coroutine GreatSuspender {};
[de90452]8
[f1dd17a]9void ?{}( GreatSuspender & this ) {
[de90452]10        prime(this);
11}
12
[f1dd17a]13void main( GreatSuspender & this )
[de90452]14{
15        while( true ) {
16                suspend();
17        }
18}
19
[f1dd17a]20void resumer( GreatSuspender & this, const unsigned int NoOfTimes ) {
[de90452]21        for ( volatile unsigned int i = 0; i < NoOfTimes; i += 1 ) {
22                resume( this );
23        }
24}
25
[034165a]26int main(int argc, char* argv[]) {
[de90452]27        GreatSuspender s;
28
[034165a]29        BENCH(
30                resumer( s, NoOfTimes );,
31                result
32        )
[de90452]33
[034165a]34        sout | result | endl;
[de90452]35}
Note: See TracBrowser for help on using the repository browser.