add calculate frame rate code