Move cgroup sample timestamp insertion and fix unit test