ADT
arm-eh
ast-experimental
enum
forall-pointer-decay
jacob/cs343-translation
jenkins-sandbox
new-ast
new-ast-unique-expr
pthread-emulation
qualifiedEnum
|
Last change
on this file since 7ac3151 was b4107c8, checked in by Peter A. Buhr <pabuhr@…>, 6 years ago |
|
update existing benchmarks for changes to bench.h, add new benchmarks in new programming languages
|
-
Property mode
set to
100644
|
|
File size:
517 bytes
|
| Line | |
|---|
| 1 | #include <pthread.h>
|
|---|
| 2 | #include <stdio.h>
|
|---|
| 3 |
|
|---|
| 4 | #include "bench.h"
|
|---|
| 5 |
|
|---|
| 6 | static void * foo(void *arg) {
|
|---|
| 7 | return arg;
|
|---|
| 8 | }
|
|---|
| 9 |
|
|---|
| 10 | int main( int argc, char * argv[] ) {
|
|---|
| 11 | BENCH_START()
|
|---|
| 12 | BENCH(
|
|---|
| 13 | for (size_t i = 0; i < times; i++) {
|
|---|
| 14 | pthread_t thread;
|
|---|
| 15 | if (pthread_create(&thread, NULL, foo, NULL) < 0) {
|
|---|
| 16 | perror( "failure" );
|
|---|
| 17 | return 1;
|
|---|
| 18 | }
|
|---|
| 19 | if (pthread_join( thread, NULL) < 0) {
|
|---|
| 20 | perror( "failure" );
|
|---|
| 21 | return 1;
|
|---|
| 22 | }
|
|---|
| 23 | },
|
|---|
| 24 | result
|
|---|
| 25 | )
|
|---|
| 26 | printf( "%g\n", result );
|
|---|
| 27 | }
|
|---|
| 28 |
|
|---|
| 29 | // Local Variables: //
|
|---|
| 30 | // tab-width: 4 //
|
|---|
| 31 | // End: //
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.