Using CProfile

Report a typo

In this problem, make the profiling running slow_running_func inside the run_scenario function using the cProfile library as shown in the topic.

  • The function slow_running_func does not accept any parameter;
  • The code inside run_scenario should profile the run of the slow_running_func, and print the profile stats.

HINT: You can use the cProfile-based profiling shown in the topic using enable()/disable() ...

Write a program in Python 3
def run_scenario(slow_running_func):
# DO NOT CHANGE THE CALL TO slow_running_func()
# write code above
slow_running_func()
# write code below

Create a free account to access the full topic