piiswrong commented on a change in pull request #8972: Profiling enhancements, 
python API, vtune and chrome tracing objects, etc.
URL: https://github.com/apache/incubator-mxnet/pull/8972#discussion_r156519270
 
 

 ##########
 File path: python/mxnet/profiler.py
 ##########
 @@ -56,3 +53,235 @@ def dump_profile():
     """Dump profile and stop profiler. Use this to save profile
     in advance in case your program cannot exit normally."""
     check_call(_LIB.MXDumpProfile())
+
+def create_domain(name):
+    domain_handle = ProfileHandle()
+    check_call(_LIB.MXProfileCreateDomain(c_str(name), 
ctypes.byref(domain_handle)))
+    return domain_handle
+
+def create_task(domain_handle, name):
+    task_handle = ProfileHandle()
+    check_call(_LIB.MXProfileCreateTask(domain_handle,
+                                        c_str(name),
+                                        ctypes.byref(task_handle)))
+    return task_handle
+
+def destroy_task(task_handle):
+    check_call(_LIB.MXProfileDestroyHandle(task_handle))
+
+def task_start(task_handle):
+    check_call(_LIB.MXProfileDurationStart(task_handle))
+
+def task_stop(task_handle):
+    check_call(_LIB.MXProfileDurationStop(task_handle))
+
+def create_frame(domain_handle, name):
+    frame_handle = ProfileHandle()
+    check_call(_LIB.MXProfileCreateFrame(domain_handle,
+                                         c_str(name),
+                                         ctypes.byref(frame_handle)))
+    return frame_handle
+
+def destroy_frame(frame_handle):
+    check_call(_LIB.MXProfileDestroyHandle(frame_handle))
+
+def frame_start(frame_handle):
+    check_call(_LIB.MXProfileDurationStart(frame_handle))
+
+def frame_stop(frame_handle):
+    check_call(_LIB.MXProfileDurationStop(frame_handle))
+
+def create_event(name):
+    event_handle = ProfileHandle()
+    check_call(_LIB.MXProfileCreateEvent(c_str(name), 
ctypes.byref(event_handle)))
+    return event_handle
+
+def destroy_event(event_handle):
+    check_call(_LIB.MXProfileDestroyHandle(event_handle))
+
+def event_start(event_handle):
+    check_call(_LIB.MXProfileDurationStart(event_handle))
+
+def event_stop(event_handle):
+    check_call(_LIB.MXProfileDurationStop(event_handle))
+
+def tune_pause():
+    check_call(_LIB.MXProfilePause(int(1)))
+
+def tune_resume():
+    check_call(_LIB.MXProfilePause(int(0)))
+
+def create_counter(domain_handle, name, value=None):
+    counter_handle = ProfileHandle()
+    check_call(_LIB.MXProfileCreateCounter(domain_handle,
+                                           c_str(name),
+                                           ctypes.byref(counter_handle)))
+    if value is not None:
+        set_counter(counter_handle, value)
+    return counter_handle
+
+def destroy_counter(counter_handle):
+    check_call(_LIB.MXProfileDestroyHandle(counter_handle))
+
+def set_counter(counter_handle, value):
+    check_call(_LIB.MXProfileSetCounter(counter_handle, int(value)))
+
+def increment_counter(counter_handle, by_value):
+    check_call(_LIB.MXProfileAdjustCounter(counter_handle, int(by_value)))
+
+def decrement_counter(counter_handle, by_value):
+    check_call(_LIB.MXProfileAdjustCounter(counter_handle, -int(by_value)))
+
+def set_append_mode(mode):
+    if mode is False:
+        mode = 0
+    else:
+        mode = 1
+    check_call(_LIB.MXSetDumpProfileAppendMode(int(mode)))
+
+def set_continuous_dump(continuous_dump=True, delay_in_seconds=1.0):
+    if continuous_dump is False:
+        cd = 0
+    else:
+        cd = 1
+    ds = float(delay_in_seconds)
+    check_call(_LIB.MXSetContinuousProfileDump(ctypes.c_int(cd), 
ctypes.c_float(ds)))
+
+def set_instant_marker(domain_handle, name, scope='process'):
+    check_call(_LIB.MXProfileSetInstantMarker(domain_handle, c_str(name), 
c_str(scope)))
+
+
+class Domain:
 
 Review comment:
   class Domain(object):

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


With regards,
Apache Git Services

Reply via email to