Index: libcfa/src/concurrency/kernel.cfa
===================================================================
--- libcfa/src/concurrency/kernel.cfa	(revision ecfd7589e4796949fcc35b475a024d4acda6e636)
+++ libcfa/src/concurrency/kernel.cfa	(revision 73f4d084fe155d69b7fe36866e5666bde0a03166)
@@ -359,4 +359,5 @@
 				#if !defined(__CFA_NO_STATISTICS__)
 					__tls_stats()->ready.threads.threads++;
+					__push_stat( __tls_stats(), __tls_stats()->ready.threads.threads, false, "Processor", this );
 				#endif
 				// This is case 2, the racy case, someone tried to run this thread before it finished blocking
@@ -376,4 +377,5 @@
 	#if !defined(__CFA_NO_STATISTICS__)
 		__tls_stats()->ready.threads.threads--;
+		__push_stat( __tls_stats(), __tls_stats()->ready.threads.threads, false, "Processor", this );
 	#endif
 
@@ -455,7 +457,9 @@
 		if( kernelTLS().this_stats ) {
 			__tls_stats()->ready.threads.threads++;
+			__push_stat( __tls_stats(), __tls_stats()->ready.threads.threads, false, "Processor", kernelTLS().this_processor );
 		}
 		else {
 			__atomic_fetch_add(&cl->stats->ready.threads.threads, 1, __ATOMIC_RELAXED);
+			__push_stat( cl->stats, cl->stats->ready.threads.threads, true, "Cluster", cl );
 		}
 	#endif
Index: libcfa/src/concurrency/kernel/startup.cfa
===================================================================
--- libcfa/src/concurrency/kernel/startup.cfa	(revision ecfd7589e4796949fcc35b475a024d4acda6e636)
+++ libcfa/src/concurrency/kernel/startup.cfa	(revision 73f4d084fe155d69b7fe36866e5666bde0a03166)
@@ -268,4 +268,7 @@
 			__print_stats( st, mainProcessor->print_stats, "Processor ", mainProcessor->name, (void*)mainProcessor );
 		}
+		#if defined(CFA_STATS_ARRAY)
+			__flush_stat( st, "Processor", mainProcessor );
+		#endif
 	#endif
 
@@ -348,4 +351,7 @@
 			__print_stats( &local_stats, proc->print_stats, "Processor ", proc->name, (void*)proc );
 		}
+		#if defined(CFA_STATS_ARRAY)
+			__flush_stat( &local_stats, "Processor", proc );
+		#endif
 	#endif
 
@@ -615,4 +621,7 @@
 			__print_stats( this.stats, this.print_stats, "Cluster", this.name, (void*)&this );
 		}
+		#if defined(CFA_STATS_ARRAY)
+			__flush_stat( this.stats, "Cluster", &this );
+		#endif
 		free( this.stats );
 	#endif
Index: libcfa/src/concurrency/stats.cfa
===================================================================
--- libcfa/src/concurrency/stats.cfa	(revision ecfd7589e4796949fcc35b475a024d4acda6e636)
+++ libcfa/src/concurrency/stats.cfa	(revision 73f4d084fe155d69b7fe36866e5666bde0a03166)
@@ -5,4 +5,5 @@
 #include <inttypes.h>
 #include "bits/debug.hfa"
+#include "bits/locks.hfa"
 #include "stats.hfa"
 
@@ -44,4 +45,9 @@
 			stats->io.calls.errors.busy = 0;
 			stats->io.poller.sleeps     = 0;
+		#endif
+
+		#if defined(CFA_STATS_ARRAY)
+			stats->array.values = alloc(CFA_STATS_ARRAY);
+			stats->array.cnt = 0;
 		#endif
 	}
@@ -151,3 +157,48 @@
 		#endif
 	}
+
+	#if defined(CFA_STATS_ARRAY)
+		extern "C" {
+			#include <stdio.h>
+			#include <errno.h>
+			#include <sys/stat.h>
+			#include <fcntl.h>
+		}
+
+		void __flush_stat( struct __stats_t * this, const char * name, void * handle) {
+			int ret = mkdir(".cfadata", 0755);
+			if(ret < 0 && errno != EEXIST) abort("Failed to create directory .cfadata: %d\n", errno);
+
+			char filename[100];
+			snprintf(filename, 100, ".cfadata/%s%p.data", name, handle);
+
+			int fd = open(filename, O_WRONLY | O_APPEND | O_CREAT, 0644);
+			if(fd < 0) abort("Failed to create file %s: %d\n", filename, errno);
+
+			for(i; this->array.cnt) {
+				char line[100];
+				size_t n = snprintf(line, 100, "%llu, %lld\n", this->array.values[i].ts, this->array.values[i].value);
+				write(fd, line, n);
+			}
+
+			this->array.cnt = 0;
+			close(fd);
+		}
+
+		static __spinlock_t stats_lock;
+
+		void __push_stat( struct __stats_t * this, int64_t value, bool external, const char * name, void * handle ) {
+			if(external) lock(stats_lock __cfaabi_dbg_ctx2);
+
+			if( this->array.cnt >= CFA_STATS_ARRAY ) __flush_stat( this, name, handle );
+
+			size_t idx = this->array.cnt;
+			this->array.cnt++;
+
+			if(external) unlock(stats_lock);
+
+			this->array.values[idx].ts = rdtscl();
+			this->array.values[idx].value = value;
+		}
+	#endif
 #endif
Index: libcfa/src/concurrency/stats.hfa
===================================================================
--- libcfa/src/concurrency/stats.hfa	(revision ecfd7589e4796949fcc35b475a024d4acda6e636)
+++ libcfa/src/concurrency/stats.hfa	(revision 73f4d084fe155d69b7fe36866e5666bde0a03166)
@@ -1,3 +1,5 @@
 #pragma once
+
+// #define CFA_STATS_ARRAY 10000
 
 #include <stdint.h>
@@ -109,4 +111,11 @@
 	#endif
 
+	#if defined(CFA_STATS_ARRAY)
+		struct __stats_elem_t {
+			long long int ts;
+			int64_t value;
+		};
+	#endif
+
 	struct __attribute__((aligned(128))) __stats_t {
 		__stats_readQ_t ready;
@@ -114,4 +123,12 @@
 			__stats_io_t    io;
 		#endif
+
+		#if defined(CFA_STATS_ARRAY)
+			struct {
+				__stats_elem_t * values;
+				volatile size_t cnt;
+			} array;
+		#endif
+
 	};
 
@@ -119,4 +136,11 @@
 	void __tally_stats( struct __stats_t *, struct __stats_t * );
 	void __print_stats( struct __stats_t *, int, const char *, const char *, void * );
+	#if defined(CFA_STATS_ARRAY)
+		void __push_stat ( struct __stats_t *, int64_t value, bool external, const char * name, void * handle);
+		void __flush_stat( struct __stats_t *, const char *, void * );
+	#else
+		static inline void __push_stat ( struct __stats_t *, int64_t, bool, const char *, void * ) {}
+		static inline void __flush_stat( struct __stats_t *, const char *, void * ) {}
+	#endif
 #endif
 
