access2rohit commented on a change in pull request #15132: Profiler API
Enhancements
URL: https://github.com/apache/incubator-mxnet/pull/15132#discussion_r293041100
##########
File path: tests/python/unittest/test_profiler.py
##########
@@ -232,6 +233,41 @@ def test_continuous_profile_and_instant_marker():
print(debug_str)
profiler.set_state('stop')
+def test_aggregate_stats_valid_json_return():
+ file_name = 'test_aggregate_stats_json_return.json'
+ enable_profiler(file_name, True, True, True)
+ test_profile_event(False)
+ debug_str = profiler.dumps(format = 'json')
+ assert(len(debug_str) > 0)
+ print(debug_str)
+ # if the format is wrong, an exception will be thrown
+ target_dict = json.loads(debug_str)
+ profiler.set_state('stop')
+
+def test_aggregate_stats_sorting():
+ sort_by_options = {'avg': "Avg", 'min': "Min", 'max': "Max", 'count':
"Count"}
+ ascending_options = [False, True]
+ def check_ascending(lst, asc):
+ assert(lst == sorted(lst, reverse = not asc))
+
+ def check_sorting(str, sb, asc):
+ target_dict = json.loads(debug_str)
Review comment:
How is this accessible here ? shouldn't it be str? or change parameter name
to 'debug_str'
----------------------------------------------------------------
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