add cpu profiling support; replace the overhead of goroutines with the overhead of channels