1. A method for profiling function calls and providing contexts in which the function calls are made for a profiled application, comprising method operations of: injecting calls to instrumentation code within the profiled application; running a sampling thread that wakes up periodically to set a flag to a true state; running the profiled application; and calling the instrumentation code through the injected calls, the calling including, charging time to a function call associated with the injected call when the flag is in a true state, the charging including taking a current timestamp, and setting the flag to a false state if time was charged.