Index: src/Parser/DeclarationNode.cc
===================================================================
--- src/Parser/DeclarationNode.cc	(revision 0cf5b7992194658ccc6f30eae5069589577633a3)
+++ src/Parser/DeclarationNode.cc	(revision fdd378689d3d56d0079d126007dfd882e43af0e4)
@@ -10,6 +10,6 @@
 // Created On       : Sat May 16 12:34:05 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Sat Sep 23 18:16:48 2017
-// Update Count     : 1024
+// Last Modified On : Mon Nov 20 09:21:52 2017
+// Update Count     : 1031
 //
 
@@ -509,16 +509,13 @@
 
 DeclarationNode * DeclarationNode::addQualifiers( DeclarationNode * q ) {
-	if ( ! q ) { delete q; return this; }
+	if ( ! q ) { delete q; return this; }				// empty qualifier
 
 	checkSpecifiers( q );
 	copySpecifiers( q );
 
-	if ( ! q->type ) {
-		delete q;
-		return this;
-	} // if
+	if ( ! q->type ) { delete q; return this; }
 
 	if ( ! type ) {
-		type = q->type;									// reuse this structure
+		type = q->type;									// reuse structure
 		q->type = nullptr;
 		delete q;
@@ -526,17 +523,21 @@
 	} // if
 
-	if ( q->type->forall ) {
-		if ( type->forall ) {
-			type->forall->appendList( q->type->forall );
+	if ( q->type->forall ) {							// forall qualifier ?
+		if ( type->forall ) {							// polymorphic routine ?
+			type->forall->appendList( q->type->forall ); // augment forall qualifier
 		} else {
-			if ( type->kind == TypeData::Aggregate ) {
-				type->aggregate.params = q->type->forall;
-				// change implicit typedef from TYPEDEFname to TYPEGENname
-				typedefTable.changeKind( *type->aggregate.name, TypedefTable::TG );
-			} else {
-				type->forall = q->type->forall;
+			if ( type->kind == TypeData::Aggregate ) {	// struct/union ?
+				if ( type->aggregate.params ) {			// polymorphic ?
+					type->aggregate.params->appendList( q->type->forall ); // augment forall qualifier
+				} else {								// not polymorphic
+					type->aggregate.params = q->type->forall; // make polymorphic type
+					// change implicit typedef from TYPEDEFname to TYPEGENname
+					typedefTable.changeKind( *type->aggregate.name, TypedefTable::TG );
+				} // if
+			} else {									// not polymorphic
+				type->forall = q->type->forall;			// make polymorphic routine
 			} // if
 		} // if
-		q->type->forall = nullptr;
+		q->type->forall = nullptr;						// forall qualifier moved
 	} // if
 
Index: src/Parser/parser.yy
===================================================================
--- src/Parser/parser.yy	(revision 0cf5b7992194658ccc6f30eae5069589577633a3)
+++ src/Parser/parser.yy	(revision fdd378689d3d56d0079d126007dfd882e43af0e4)
@@ -10,6 +10,6 @@
 // Created On       : Sat Sep  1 20:22:55 2001
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Wed Oct 25 12:28:54 2017
-// Update Count     : 2893
+// Last Modified On : Mon Nov 20 09:45:36 2017
+// Update Count     : 2945
 //
 
@@ -114,4 +114,16 @@
 	} // for
 } // distExt
+
+// There is an ambiguity for inline generic-routine return-types and generic routines.
+//   forall( otype T ) struct S { int i; } bar( T ) {}
+// Does the forall bind to the struct or the routine, and how would it be possible to explicitly specify the binding.
+//   forall( otype T ) struct S { int T; } forall( otype W ) bar( W ) {}
+
+void rebindForall( DeclarationNode * declSpec, DeclarationNode * funcDecl ) {
+	if ( declSpec->type->kind == TypeData::Aggregate ) { // return is aggregate definition
+		funcDecl->type->forall = declSpec->type->aggregate.params; // move forall from aggregate to function type
+		declSpec->type->aggregate.params = nullptr;
+	} // if
+} // rebindForall
 
 bool forall = false;									// aggregate have one or more forall qualifiers ?
@@ -348,9 +360,8 @@
 
 
-// Handle single shift/reduce conflict for dangling else by shifting the ELSE token. For example, this string
-// is ambiguous:
-// .---------.				matches IF '(' comma_expression ')' statement . (reduce)
-// if ( C ) S1 else S2
-// `-----------------'		matches IF '(' comma_expression ')' statement . (shift) ELSE statement */
+// Handle shift/reduce conflict for dangling else by shifting the ELSE token. For example, this string is ambiguous:
+//   .---------.				matches IF '(' comma_expression ')' statement . (reduce)
+//   if ( C ) S1 else S2
+//   `-----------------'		matches IF '(' comma_expression ')' statement . (shift) ELSE statement */
 // Similar issues exit with the waitfor statement.
 
@@ -361,4 +372,16 @@
 %precedence TIMEOUT	// token precedence for start of TIMEOUT in WAITFOR statement
 %precedence ELSE	// token precedence for start of else clause in IF/WAITFOR statement
+
+// Handle shift/reduce conflict for generic type by shifting the '(' token. For example, this string is ambiguous:
+//   forall( otype T ) struct Foo { T v; };
+//       .-----.				matches pointer to function returning a generic (which is impossible without a type)
+//   Foo ( *fp )( int );
+//   `---'						matches start of TYPEGENname '('
+// Must be:
+// Foo( int ) ( *fp )( int );
+
+// Order of these lines matters (low-to-high precedence).
+%precedence TYPEGENname
+%precedence '('
 
 %locations			// support location tracking for error messages
@@ -1765,5 +1788,7 @@
 
 typegen_name:											// CFA
-	TYPEGENname '(' ')'
+	TYPEGENname
+		{ $$ = DeclarationNode::newFromTypeGen( $1, nullptr ); }
+	| TYPEGENname '(' ')'
 		{ $$ = DeclarationNode::newFromTypeGen( $1, nullptr ); }
 	| TYPEGENname '(' type_list ')'
@@ -1809,5 +1834,13 @@
 		}
 	| aggregate_key attribute_list_opt typegen_name		// CFA
-		{ $$ = $3->addQualifiers( $2 ); }
+		{
+			// Create new generic declaration with same name as previous forward declaration, where the IDENTIFIER is
+			// switched to a TYPEGENname. Link any generic arguments from typegen_name to new generic declaration and
+			// delete newFromTypeGen.
+			$$ = DeclarationNode::newAggregate( $1, $3->type->symbolic.name, $3->type->symbolic.actuals, nullptr, false )->addQualifiers( $2 );
+			$3->type->symbolic.name = nullptr;
+			$3->type->symbolic.actuals = nullptr;
+			delete $3;
+		}
 	;
 
@@ -2380,4 +2413,5 @@
 	| declaration_specifier function_declarator with_clause_opt compound_statement
 		{
+			rebindForall( $1, $2 );
 			typedefTable.addToEnclosingScope( TypedefTable::ID );
 			typedefTable.leaveScope();
@@ -2406,4 +2440,5 @@
 	| declaration_specifier KR_function_declarator KR_declaration_list_opt with_clause_opt compound_statement
 		{
+			rebindForall( $1, $2 );
 			typedefTable.addToEnclosingScope( TypedefTable::ID );
 			typedefTable.leaveScope();
Index: src/SymTab/Validate.cc
===================================================================
--- src/SymTab/Validate.cc	(revision 0cf5b7992194658ccc6f30eae5069589577633a3)
+++ src/SymTab/Validate.cc	(revision fdd378689d3d56d0079d126007dfd882e43af0e4)
@@ -423,4 +423,12 @@
 	}
 
+	void checkGenericParameters( ReferenceToType * inst ) {
+		for ( Expression * param : inst->parameters ) {
+			if ( ! dynamic_cast< TypeExpr * >( param ) ) {
+				throw SemanticError( "Expression parameters for generic types are currently unsupported: ", inst );
+			}
+		}
+	}
+
 	void LinkReferenceToTypes::postvisit( StructInstType *structInst ) {
 		StructDecl *st = local_indexer->lookupStruct( structInst->get_name() );
@@ -434,4 +442,5 @@
 			forwardStructs[ structInst->get_name() ].push_back( structInst );
 		} // if
+		checkGenericParameters( structInst );
 	}
 
@@ -446,4 +455,5 @@
 			forwardUnions[ unionInst->get_name() ].push_back( unionInst );
 		} // if
+		checkGenericParameters( unionInst );
 	}
 
@@ -525,5 +535,8 @@
 		// need to carry over the 'sized' status of each decl in the instance
 		for ( auto p : group_iterate( traitDecl->get_parameters(), traitInst->get_parameters() ) ) {
-			TypeExpr * expr = strict_dynamic_cast< TypeExpr * >( std::get<1>(p) );
+			TypeExpr * expr = dynamic_cast< TypeExpr * >( std::get<1>(p) );
+			if ( ! expr ) {
+				throw SemanticError( "Expression parameters for trait instances are currently unsupported: ", std::get<1>(p) );
+			}
 			if ( TypeInstType * inst = dynamic_cast< TypeInstType * >( expr->get_type() ) ) {
 				TypeDecl * formalDecl = std::get<0>(p);
Index: src/benchmark/Makefile.am
===================================================================
--- src/benchmark/Makefile.am	(revision 0cf5b7992194658ccc6f30eae5069589577633a3)
+++ src/benchmark/Makefile.am	(revision fdd378689d3d56d0079d126007dfd882e43af0e4)
@@ -24,5 +24,5 @@
 repeats  = 30
 TIME_FORMAT = "%E"
-PRINT_FORMAT = '%20s\t'
+PRINT_FORMAT = %20s: #Comments needed for spacing
 
 .NOTPARALLEL:
@@ -217,28 +217,28 @@
 
 compile-array$(EXEEXT):
-	@${CC} -nodebug -quiet -fsyntax-only -w ../tests/array.c
+	@${CC} -nodebug -quiet -fsyntax-only -w ../tests/array.c		@CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
 
 compile-attributes$(EXEEXT):
-	@${CC} -nodebug -quiet -fsyntax-only -w ../tests/attributes.c
+	@${CC} -nodebug -quiet -fsyntax-only -w ../tests/attributes.c	@CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
 
 compile-empty$(EXEEXT):
-	@${CC} -nodebug -quiet -fsyntax-only -w compile/empty.c
+	@${CC} -nodebug -quiet -fsyntax-only -w compile/empty.c		@CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
 
 compile-expression$(EXEEXT):
-	@${CC} -nodebug -quiet -fsyntax-only -w ../tests/expression.c
+	@${CC} -nodebug -quiet -fsyntax-only -w ../tests/expression.c	@CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
 
 compile-io$(EXEEXT):
-	@${CC} -nodebug -quiet -fsyntax-only -w ../tests/io.c
+	@${CC} -nodebug -quiet -fsyntax-only -w ../tests/io.c			@CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
 
 compile-monitor$(EXEEXT):
-	@${CC} -nodebug -quiet -fsyntax-only -w ../tests/monitor.c
+	@${CC} -nodebug -quiet -fsyntax-only -w ../tests/monitor.c		@CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
 
 compile-operators$(EXEEXT):
-	@${CC} -nodebug -quiet -fsyntax-only -w ../tests/operators.c
+	@${CC} -nodebug -quiet -fsyntax-only -w ../tests/operators.c	@CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
 
 compile-thread$(EXEEXT):
-	@${CC} -nodebug -quiet -fsyntax-only -w ../tests/thread.c
+	@${CC} -nodebug -quiet -fsyntax-only -w ../tests/thread.c		@CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
 
 compile-typeof$(EXEEXT):
-	@${CC} -nodebug -quiet -fsyntax-only -w ../tests/typeof.c
-
+	@${CC} -nodebug -quiet -fsyntax-only -w ../tests/typeof.c		@CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
+
Index: src/benchmark/Makefile.in
===================================================================
--- src/benchmark/Makefile.in	(revision 0cf5b7992194658ccc6f30eae5069589577633a3)
+++ src/benchmark/Makefile.in	(revision fdd378689d3d56d0079d126007dfd882e43af0e4)
@@ -254,5 +254,5 @@
 repeats = 30
 TIME_FORMAT = "%E"
-PRINT_FORMAT = '%20s\t'
+PRINT_FORMAT = %20s: #Comments needed for spacing
 all: all-am
 
@@ -623,29 +623,29 @@
 
 compile-array$(EXEEXT):
-	@${CC} -nodebug -quiet -fsyntax-only -w ../tests/array.c
+	@${CC} -nodebug -quiet -fsyntax-only -w ../tests/array.c		@CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
 
 compile-attributes$(EXEEXT):
-	@${CC} -nodebug -quiet -fsyntax-only -w ../tests/attributes.c
+	@${CC} -nodebug -quiet -fsyntax-only -w ../tests/attributes.c	@CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
 
 compile-empty$(EXEEXT):
-	@${CC} -nodebug -quiet -fsyntax-only -w compile/empty.c
+	@${CC} -nodebug -quiet -fsyntax-only -w compile/empty.c		@CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
 
 compile-expression$(EXEEXT):
-	@${CC} -nodebug -quiet -fsyntax-only -w ../tests/expression.c
+	@${CC} -nodebug -quiet -fsyntax-only -w ../tests/expression.c	@CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
 
 compile-io$(EXEEXT):
-	@${CC} -nodebug -quiet -fsyntax-only -w ../tests/io.c
+	@${CC} -nodebug -quiet -fsyntax-only -w ../tests/io.c			@CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
 
 compile-monitor$(EXEEXT):
-	@${CC} -nodebug -quiet -fsyntax-only -w ../tests/monitor.c
+	@${CC} -nodebug -quiet -fsyntax-only -w ../tests/monitor.c		@CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
 
 compile-operators$(EXEEXT):
-	@${CC} -nodebug -quiet -fsyntax-only -w ../tests/operators.c
+	@${CC} -nodebug -quiet -fsyntax-only -w ../tests/operators.c	@CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
 
 compile-thread$(EXEEXT):
-	@${CC} -nodebug -quiet -fsyntax-only -w ../tests/thread.c
+	@${CC} -nodebug -quiet -fsyntax-only -w ../tests/thread.c		@CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
 
 compile-typeof$(EXEEXT):
-	@${CC} -nodebug -quiet -fsyntax-only -w ../tests/typeof.c
+	@${CC} -nodebug -quiet -fsyntax-only -w ../tests/typeof.c		@CFA_FLAGS@ ${AM_CFLAGS} ${CFLAGS} ${ccflags}
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
Index: src/benchmark/bench.c
===================================================================
--- src/benchmark/bench.c	(revision 0cf5b7992194658ccc6f30eae5069589577633a3)
+++ 	(revision )
@@ -1,220 +1,0 @@
-
-#include <fstream>
-#include <stdlib>
-#include <thread>
-
-#include "bench.h"
-
-//=======================================
-// time struct
-//=======================================
-
-// prevent dead-code removal
-struct StructDummy {
-	volatile int i;
-};
-
-void ?{}(StructDummy * this) __attribute__(( noinline )) {
-	this->i = 2;
-}
-
-int get_i(StructDummy * this) {
-	return this->i;
-}
-
-forall( dtype T | { int get_i(T*); } )
-int bidirectional( StructDummy * this ) __attribute__(( noinline )) {
-	return get_i( this );
-}
-
-void BlockStructCreateDelete( int N ) {
-    long long int StartTime, EndTime;
-
-    StartTime = Time();
-    for ( int i = 0; i < N; i += 1 ) {
-	StructDummy dummy;
-    }
-    EndTime = Time();
-    sout | "\t " | ( EndTime - StartTime ) / N;
-}
-
-void DynamicStructCreateDelete( int N ) {
-    long long int StartTime, EndTime;
-
-    StartTime = Time();
-    for ( int i = 0; i < N; i += 1 ) {
-	StructDummy *dummy = new();
-	delete(dummy);
-    }
-    EndTime = Time();
-    sout | "\t " | ( EndTime - StartTime ) / N;
-}
-
-void StructBidirectional( int N ) {
-    long long int StartTime, EndTime;
-    StructDummy dummy;
-    volatile int rv __attribute__(( unused ));
-
-    StartTime = Time();
-    for ( int i = 0; i < N; i += 1 ) {
-	rv = bidirectional( &dummy ); 
-    }
-    EndTime = Time();
-    sout | "\t " | ( EndTime - StartTime ) / N;
-}
-
-//=======================================
-// time coroutine
-//=======================================
-
-coroutine CoroutineDummy {};
-void main(CoroutineDummy * this) {}
-
-void ?{}(CoroutineDummy * this) {
-	prime(this);
-}
-
-void BlockCoroutineCreateDelete( int N ) {
-    long long int StartTime, EndTime;
-
-    StartTime = Time();
-    for ( int i = 0; i < N; i += 1 ) {
-	CoroutineDummy dummy;
-    }
-    EndTime = Time();
-    sout | "\t " | ( EndTime - StartTime ) / N;
-}
-
-void DynamicCoroutineCreateDelete( int N ) {
-    long long int StartTime, EndTime;
-
-    StartTime = Time();
-    for ( int i = 0; i < N; i += 1 ) {
-	CoroutineDummy * dummy = new();
-	delete(dummy);
-    }
-    EndTime = Time();
-    sout | "\t " | ( EndTime - StartTime ) / N;
-}
-
-coroutine CoroutineResume {
-    int N;
-};
-
-void ?{}(CoroutineResume* this, int N) {
-      this->N = N;
-	prime(this);
-}
-
-void main(CoroutineResume* this) {
-	for ( int i = 1; i <= this->N; i += 1 ) {
-		suspend();
-	}
-}
-
-void resumer(CoroutineResume* this) {
-	long long int StartTime, EndTime;
-
-	StartTime = Time();
-	for ( int i = 1; i <= this->N; i += 1 ) {
-		resume(this);
-	}
-	EndTime = Time();
-	sout | "\t " | ( EndTime - StartTime ) / this->N;
-}
-
-//=======================================
-// time task
-//=======================================
-
-thread ThreadDummy {};
-void main(ThreadDummy * this) {}
-
-void BlockTaskCreateDelete( int N ) {
-    long long int StartTime, EndTime;
-
-    StartTime = Time();
-    for ( int i = 0; i < N; i += 1 ) {
-	scoped(ThreadDummy) dummy;
-    }
-    EndTime = Time();
-    sout | "\t " | ( EndTime - StartTime ) / N;
-}
-
-void DynamicTaskCreateDelete( int N ) {
-    long long int StartTime, EndTime;
-
-    StartTime = Time();
-    for ( int i = 0; i < N; i += 1 ) {
-	scoped(ThreadDummy) * dummy = new();
-	delete(dummy);
-    }
-    EndTime = Time();
-    sout | "\t " | ( EndTime - StartTime ) / N;
-}
-
-thread ContextSwitch {
-    int N;
-    long long result;
-};
-
-void main(ContextSwitch * this) {    
-	long long int StartTime, EndTime;
-
-	StartTime = Time();
-	for ( int i = 1; i <= this->N; i += 1 ) {
-	    yield();
-	} // for
-	EndTime = Time();
-	this->result = ( EndTime - StartTime ) / this->N;
-}
-
-void ?{}(ContextSwitch * this, int N) {
-	this->N = N;
-}
-
-void ^?{}(ContextSwitch * this) {
-	sout | "\t " | this->result;
-}
-
-//=======================================
-// benchmark driver
-//=======================================
-
-
-int main() {
-	const int NoOfTimes =
-#if defined( __U_DEBUG__ )				// takes longer so run fewer iterations
-	100000;
-#else
-	1000000;
-#endif // __U_DEBUG__
-
-	sout | "\t\tcreate\tcreate\tcall/" | endl;
-	sout | "(nsecs)";
-	sout | "\t\tdelete/\tdelete/\tctx" | endl;
-	sout | "\t\tblock\tdynamic\tcycle" | endl;
-
-	sout | "object\t";
-	BlockStructCreateDelete( NoOfTimes );
-	DynamicStructCreateDelete( NoOfTimes );
-	StructBidirectional( NoOfTimes );
-	sout | endl;
-
-	sout | "coroutine";
-	BlockCoroutineCreateDelete( NoOfTimes );
-	DynamicCoroutineCreateDelete( NoOfTimes );
-	{
-		CoroutineResume resumer = { NoOfTimes };
-		resumer(&resumer);
-	}
-	sout | endl;
-
-	sout | "task\t";
-	BlockTaskCreateDelete( NoOfTimes );
-	DynamicTaskCreateDelete( NoOfTimes );
-	{
-		ContextSwitch dummy = { (int)NoOfTimes };		// context switch
-	}
-	sout | "\t" | endl;
-}
Index: src/benchmark/csv-data.c
===================================================================
--- src/benchmark/csv-data.c	(revision 0cf5b7992194658ccc6f30eae5069589577633a3)
+++ 	(revision )
@@ -1,276 +1,0 @@
-#include <fstream>
-#include <monitor>
-#include <stdlib>
-#include <thread>
-
-#include "bench.h"
-
-coroutine GreatSuspender {};
-
-void ?{}( GreatSuspender & this ) {
-	prime(this);
-}
-
-void main( GreatSuspender & this )
-{
-	while( true ) {
-		suspend();
-	}
-}
-
-void resumer( GreatSuspender * this, const unsigned int NoOfTimes ) {
-	for ( volatile unsigned int i = 0; i < NoOfTimes; i += 1 ) {
-		resume( *this );
-	}
-}
-
-//-----------------------------------------------------------------------------
-// coroutine context switch
-long long int measure_coroutine() {
-	const unsigned int NoOfTimes = 50000000;
-	long long int StartTime, EndTime;
-
-	GreatSuspender s;
-
-	StartTime = Time();
-	resumer( &s, NoOfTimes );
-	EndTime = Time();
-
-	return ( EndTime - StartTime ) / NoOfTimes;
-}
-
-//-----------------------------------------------------------------------------
-// thread context switch
-long long int measure_thread() {
-	const unsigned int NoOfTimes = 50000000;
-	long long int StartTime, EndTime;
-
-	StartTime = Time();
-	for ( volatile unsigned int i = 0; i < NoOfTimes; i += 1 ) {
-		yield();
-	}
-	EndTime = Time();
-
-	return ( EndTime - StartTime ) / NoOfTimes;
-}
-
-//-----------------------------------------------------------------------------
-// single monitor entry
-monitor mon_t {};
-void dummy( mon_t & mutex m ) {}
-
-long long int measure_1_monitor_entry() {
-	const unsigned int NoOfTimes = 5000000;
-	long long int StartTime, EndTime;
-	mon_t mon;
-
-	StartTime = Time();
-	for ( volatile unsigned int i = 0; i < NoOfTimes; i += 1 ) {
-		dummy( mon );
-	}
-	EndTime = Time();
-
-	return ( EndTime - StartTime ) / NoOfTimes;
-}
-
-//-----------------------------------------------------------------------------
-// multi monitor entry
-void dummy( mon_t & mutex m1,  mon_t & mutex m2 ) {}
-
-long long int measure_2_monitor_entry() {
-	const unsigned int NoOfTimes = 5000000;
-	long long int StartTime, EndTime;
-	mon_t mon1, mon2;
-
-	StartTime = Time();
-	for ( volatile unsigned int i = 0; i < NoOfTimes; i += 1 ) {
-		dummy( mon1, mon2 );
-	}
-	EndTime = Time();
-
-	return ( EndTime - StartTime ) / NoOfTimes;
-}
-
-//-----------------------------------------------------------------------------
-// single internal sched entry
-const unsigned int NoOfTimes = 500000;
-
-mon_t mon1;
-
-condition cond1a;
-condition cond1b;
-
-thread thrd1a { long long int * out; };
-thread thrd1b {};
-
-void ?{}( thrd1a & this, long long int * out ) {
-	this.out = out;
-}
-
-void side1A( mon_t & mutex a, long long int * out ) {
-	const unsigned int NoOfTimes = 500000;
-	long long int StartTime, EndTime;
-
-	StartTime = Time();
-	for( int i = 0;; i++ ) {
-		signal(cond1a);
-		if( i > NoOfTimes ) break;
-		wait(cond1b);
-	}
-	EndTime = Time();
-
-	*out = ( EndTime - StartTime ) / NoOfTimes;
-}
-
-void side1B( mon_t & mutex a ) {
-	for( int i = 0;; i++ ) {
-		signal(cond1b);
-		if( i > N ) break;
-		wait(cond1a);
-	}
-}
-
-void main( thrd1a & this ) { side1A( mon1, this.out ); }
-void main( thrd1b & this ) { side1B( mon1 ); }
-
-long long int measure_1_sched_int() {
-	long long int t;
-	{
-		thrd1a a = { &t };
-		thrd1b b;
-	}
-	return t;
-}
-
-//-----------------------------------------------------------------------------
-// multi internal sched
-mon_t mon2;
-
-condition cond2a;
-condition cond2b;
-
-thread thrd2a { long long int * out; };
-thread thrd2b {};
-
-void ?{}( thrd2a & this, long long int * out ) {
-	this.out = out;
-}
-
-void side2A( mon_t & mutex a, mon_t & mutex b, long long int * out ) {
-	const unsigned int NoOfTimes = 500000;
-	long long int StartTime, EndTime;
-
-	StartTime = Time();
-	for( int i = 0;; i++ ) {
-		signal(cond2a);
-		if( i > NoOfTimes ) break;
-		wait(cond2b);
-	}
-	EndTime = Time();
-
-	*out = ( EndTime - StartTime ) / NoOfTimes;
-}
-
-void side2B( mon_t & mutex a, mon_t & mutex b ) {
-	for( int i = 0;; i++ ) {
-		signal(cond2b);
-		if( i > N ) break;
-		wait(cond2a);
-	}
-}
-
-void main( thrd2a & this ) { side2A( mon1, mon2, this.out ); }
-void main( thrd2b & this ) { side2B( mon1, mon2 ); }
-
-long long int measure_2_sched_int() {
-	long long int t;
-	{
-		thrd2a a = { &t };
-		thrd2b b;
-	}
-	return t;
-}
-
-//-----------------------------------------------------------------------------
-// single external sched
-
-volatile int go = 0;
-
-void __attribute__((noinline)) call( mon_t & mutex m1 ) {}
-
-long long int  __attribute__((noinline)) wait( mon_t & mutex m1 ) {
-	go = 1;
-	const unsigned int NoOfTimes = 5000000;
-	long long int StartTime, EndTime;
-
-	StartTime = Time();
-	for (size_t i = 0; i < NoOfTimes; i++) {
-		waitfor(call, m1);
-	}
-
-	EndTime = Time();
-	go = 0;
-	return ( EndTime - StartTime ) / NoOfTimes;
-}
-
-thread thrd3 {};
-void ^?{}( thrd3 & mutex this ) {}
-void main( thrd3 & this ) {
-	while(go == 0) { yield(); }
-	while(go == 1) { call(mon1); }
-
-}
-
-long long int measure_1_sched_ext() {
-	go = 0;
-	thrd3 t;
-	return wait(mon1);
-}
-
-//-----------------------------------------------------------------------------
-// multi external sched
-
-void __attribute__((noinline)) call( mon_t & mutex m1, mon_t & mutex m2 ) {}
-
-long long int  __attribute__((noinline)) wait( mon_t & mutex m1, mon_t & mutex m2 ) {
-	go = 1;
-	const unsigned int NoOfTimes = 5000000;
-	long long int StartTime, EndTime;
-
-	StartTime = Time();
-	for (size_t i = 0; i < NoOfTimes; i++) {
-		waitfor(call, m1, m2);
-	}
-
-	EndTime = Time();
-	go = 0;
-	return ( EndTime - StartTime ) / NoOfTimes;
-}
-
-thread thrd4 {};
-void ^?{}( thrd4 & mutex this ) {}
-void main( thrd4 & this ) {
-	while(go == 0) { yield(); }
-	while(go == 1) { call(mon1, mon2); }
-
-}
-
-long long int measure_2_sched_ext() {
-	go = 0;
-	thrd3 t;
-	return wait(mon1, mon2);
-}
-
-//-----------------------------------------------------------------------------
-// main loop
-int main()
-{
-	sout | "\tepoch:" | time(NULL) | ',' | endl;
-	sout | "\tctxswitch: {" | endl;
-	sout | "\t\tcoroutine: "| measure_coroutine() | ',' | endl;
-	sout | "\t\tthread:" | measure_thread() | ',' | endl;
-	sout | "\t}," | endl;
-	sout | "\tmutex: [" 	| measure_1_monitor_entry() 	| ',' | measure_2_monitor_entry() 	| "]," | endl;
-	sout | "\tscheduling: ["| measure_1_sched_int() 	| ',' | measure_2_sched_int() 	| ','  |
-					  measure_1_sched_ext() 	| ',' | measure_2_sched_ext() 	| "]," | endl;
-}
