Added code to profile a function