profile_reporter attempts to sample before reporting profile. This behavior may not be ideal for lambda application.
If we sample before reporting profile, it is possible for the following scenario happens:
Profile contains 99% of the data for certain time period (e.g. 11:00-11:05). If the lambda container freeze just before the reporter should report the profile and it resumes after 20 minutes, the profile would contain 1 sample for 11:25 and the profile would have start and end time be 11:00 - 11:30 which gives a misleading information of the profile.
Also we should set the end time in profile as the last sample time instead of the actual reporting time to avoid the confusion stated above.