Added time counting for APIFunction calls