implements profile, profile_start, and profile_stop for profiling function execution