source: src/benchmark/ctxswitch/pthreads.c @ 034165a

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

renamed and updated benchmarks for consistency

  • Property mode set to 100644
File size: 345 bytes
RevLine 
[d67cdb7]1#include <stdio.h>
2#include <stdlib.h>
[f1dd17a]3
4#include <sched.h>
[d67cdb7]5
6#include "bench.h"
7
8int main() {
9        const unsigned int NoOfTimes = N;
10        long long int StartTime, EndTime;
11
12        StartTime = Time();
13        for ( volatile unsigned int i = 0; i < NoOfTimes; i += 1 ) {
[f1dd17a]14                sched_yield();
[d67cdb7]15        }
16        EndTime = Time();
17
18        printf("%lld\n", ( EndTime - StartTime ) / NoOfTimes );
19}
Note: See TracBrowser for help on using the repository browser.