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_r316019604
##########
File path: benchmark/opperf/utils/profiler_utils.py
##########
@@ -228,10 +229,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)
Review comment:
so Im trying to reuse the existing code.
Other function uses runs and runs a for loop here
https://github.com/ChaiBapchya/incubator-mxnet/blob/bb3e9fc65b756716b4f010c98ed2cfe733f52386/benchmark/opperf/utils/ndarray_utils.py#L45
I reuse the above function. MXNet profiler is able to log the data on a per
run basis without explicitly storing that info after every run/iteration
But we need to do that. So that's what I am doing it here
https://github.com/ChaiBapchya/incubator-mxnet/blob/bb3e9fc65b756716b4f010c98ed2cfe733f52386/benchmark/opperf/utils/profiler_utils.py#L236
Not sure if this is the best way. But I wanted to reuse the code and ensure
it is backward compatible. Hence this workaround.
Let me know if I should clarify further.
----------------------------------------------------------------
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