Index: libcfa/src/concurrency/io.cfa
===================================================================
--- libcfa/src/concurrency/io.cfa	(revision 78da4abe22e69798ee3738623dc9a2d99e34d207)
+++ libcfa/src/concurrency/io.cfa	(revision d60d30ef3cbda3a4010ce92c21dcd3ce89fb6684)
@@ -17,6 +17,6 @@
 
 #if defined(__CFA_DEBUG__)
-	#define __CFA_DEBUG_PRINT_IO__
-	#define __CFA_DEBUG_PRINT_IO_CORE__
+	// #define __CFA_DEBUG_PRINT_IO__
+	// #define __CFA_DEBUG_PRINT_IO_CORE__
 #endif
 
@@ -83,4 +83,5 @@
 //=============================================================================================
 	static int __io_uring_enter( struct $io_context & ctx, unsigned to_submit, bool get ) {
+		__STATS__( false, io.calls.count++; )
 		bool need_sys_to_submit = false;
 		bool need_sys_to_complete = false;
@@ -109,4 +110,5 @@
 		if( need_sys_to_submit || need_sys_to_complete ) {
 			__cfadbg_print_safe(io_core, "Kernel I/O : IO_URING enter %d %u %u\n", ctx.fd, to_submit, flags);
+			__STATS__( false, io.calls.blocks++; )
 			ret = syscall( __NR_io_uring_enter, ctx.fd, to_submit, 0, flags, (sigset_t *)0p, _NSIG / 8);
 			__cfadbg_print_safe(io_core, "Kernel I/O : IO_URING %d returned %d\n", ctx.fd, ret);
@@ -124,5 +126,5 @@
 	static inline __u32 __release_sqes( struct $io_context & );
 
-	static [int, bool] __drain_io( & struct  $io_context ctx ) {
+	static bool __drain_io( struct  $io_context & ctx ) {
 		unsigned to_submit = __flush( ctx );
 		int ret = __io_uring_enter( ctx, to_submit, true );
@@ -132,5 +134,7 @@
 			case EINTR:
 			case EBUSY:
-				return [0, true];
+				// Update statistics
+				__STATS__( false, io.calls.errors.busy ++; )
+				return true;
 				break;
 			default:
@@ -141,11 +145,5 @@
 		// update statistics
 		if (to_submit > 0) {
-			__STATS__( false,
-				if( to_submit > 0 ) {
-					io.submit_q.submit_avg.rdy += to_submit;
-					io.submit_q.submit_avg.csm += ret;
-					io.submit_q.submit_avg.cnt += 1;
-				}
-			)
+			__STATS__( false, io.calls.submitted += ret; )
 			/* paranoid */ verify( ctx.sq.to_submit <= *ctx.sq.num );
 
@@ -170,9 +168,11 @@
 		// Nothing was new return 0
 		if (head == tail) {
-			return [0, to_submit > 0];
+			return ctx.sq.to_submit > 0;
 		}
 
 		__u32 count = tail - head;
 		/* paranoid */ verify( count != 0 );
+		__STATS__( false, io.calls.submitted += count; )
+
 		for(i; count) {
 			unsigned idx = (head + i) & mask;
@@ -195,5 +195,5 @@
 		__atomic_store_n( ctx.cq.head, head + count, __ATOMIC_SEQ_CST );
 
-		return [count, count > 0 || to_submit > 0];
+		return count > 0 || to_submit > 0;
 	}
 
@@ -212,15 +212,7 @@
 
 			// Drain the io
-			int count;
-			bool again;
-			[count, again] = __drain_io( this );
+			bool again = __drain_io( this );
 
 			if(!again) reset--;
-
-			// Update statistics
-			__STATS__( false,
-				io.complete_q.completed_avg.val += count;
-				io.complete_q.completed_avg.cnt += 1;
-			)
 
 			// If we got something, just yield and check again
@@ -241,5 +233,5 @@
 
 			__STATS__( false,
-				io.complete_q.blocks += 1;
+				io.calls.blocks += 1;
 			)
 			__cfadbg_print_safe(io_core, "Kernel I/O : Parking io poller %d (%p)\n", this.fd, &this);
@@ -342,4 +334,5 @@
 				// Mark the instance as no longer in-use and re-enable interrupts
 				__atomic_store_n( &proc->io.lock, false, __ATOMIC_RELEASE );
+				__STATS__( true, io.alloc.fast += 1; )
 				enable_interrupts( __cfaabi_dbg_ctx );
 
@@ -350,8 +343,10 @@
 			}
 			// The fast path failed, fallback
+			__STATS__( true, io.alloc.fail += 1; )
 		}
 
 		// Fast path failed, fallback on arbitration
 		__atomic_store_n( &proc->io.lock, false, __ATOMIC_RELEASE );
+		__STATS__( true, io.alloc.slow += 1; )
 		enable_interrupts( __cfaabi_dbg_ctx );
 
@@ -409,4 +404,5 @@
 			// Mark the instance as no longer in-use, re-enable interrupts and return
 			__atomic_store_n( &proc->io.lock, false, __ATOMIC_RELEASE );
+			__STATS__( true, io.submit.fast += 1; )
 			enable_interrupts( __cfaabi_dbg_ctx );
 
@@ -417,4 +413,5 @@
 		// Fast path failed, fallback on arbitration
 		__atomic_store_n( &proc->io.lock, false, __ATOMIC_RELEASE );
+		__STATS__( true, io.submit.slow += 1; )
 		enable_interrupts( __cfaabi_dbg_ctx );
 
@@ -556,4 +553,6 @@
 			__revoke( this, c );
 
+			__STATS__( false, io.alloc.revoke += 1; )
+
 			if(__alloc(c, idxs, want)) {
 				__assign( this, c, proc);
@@ -564,4 +563,6 @@
 		__cfadbg_print_safe(io, "Kernel I/O : waiting for available resources\n");
 
+		__STATS__( false, io.alloc.block += 1; )
+
 		// No one has any resources left, wait for something to finish
 		// Mark as pending
@@ -626,4 +627,6 @@
 	static void __ioarbiter_flush( $io_arbiter & mutex this, $io_context * ctx ) {
 		/* paranoid */ verify( &this == ctx->arbiter );
+
+		__STATS__( false, io.flush.external += 1; )
 
 		__revoke( this, ctx );
