Merge "Pull CPU statistics code out of threadLoop()"