ChaiBapchya commented on a change in pull request #15953: Add Median,p50,p99 to 
python profiler
URL: https://github.com/apache/incubator-mxnet/pull/15953#discussion_r317769432
 
 

 ##########
 File path: benchmark/opperf/utils/profiler_utils.py
 ##########
 @@ -228,10 +232,16 @@ def python_profile(func):
 
     @functools.wraps(func)
     def python_profile_it(*args, **kwargs):
-        start_time = time.perf_counter()    # 1
-        res = func(*args, **kwargs)
-        end_time = time.perf_counter()      # 2
-        run_time = end_time - start_time    # 3
+        runs = args[1]
+        modified_args = (args[0], 1, args[2])
 
 Review comment:
   This is where we decide which profiler to call (selects which decorator to 
use 'cpp' or 'python'
   
   
https://github.com/ChaiBapchya/incubator-mxnet/blob/5a56aa3580e2f78a1a78581fe8b8f179962a3a5a/benchmark/opperf/utils/benchmark_utils.py#L56
   
   The reason why I had to modify the args, was because I wanted to reuse the 
function
   
   
https://github.com/ChaiBapchya/incubator-mxnet/blob/cba7c4e360d843d523b29be7fb52fa220fcafa92/benchmark/opperf/utils/ndarray_utils.py#L23
   
   Here it runs the operator runs number of times. But I can't add python time 
functions here as it will change the behavior of the function for python as 
well as cpp decorator. Hence I had to override the function by modifying the 
arguments passed.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to