σ ω΅Θ[c@@skdZddlmZddlZddlZddlmZmZmZm Z m Z m Z m Z e ƒa d„Zd„Zdd d „Zd d d „Zd d„Zed d„Zd„Zed„Zd d„Zd d„Zdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZ dS( sProfiler setting methods.i(tabsolute_importNi(t_LIBt check_calltc_strt ProfileHandlet c_str_arraytpy_strt KVStoreHandlecC@s |adS(N(tprofiler_kvstore_handle(thandle((sN/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/profiler.pytset_kvstore_handlesc K@sv|jƒ}|jƒ}ttjt|ƒtg|D] }|^q4ƒtg|D]}t|ƒ^qPƒtƒƒdS(sSet up the configure of profiler (only accepts keyword arguments). Parameters ---------- filename : string, output file for profile data profile_all : boolean, all profile types enabled profile_symbolic : boolean, whether to profile symbolic operators profile_imperative : boolean, whether to profile imperative operators profile_memory : boolean, whether to profile memory usage profile_api : boolean, whether to profile the C API contiguous_dump : boolean, whether to periodically dump profiling data to file dump_period : float, seconds between profile data dumps aggregate_stats : boolean, whether to maintain aggregate stats in memory for console dump. Has some negative performance impact. profile_process : string whether to profile kvstore `server` or `worker`. server can only be profiled when kvstore is of type dist. if this is not passed, defaults to `worker` N( tkeystvaluesRRtMXSetProcessProfilerConfigtlenRtstrR(tkwargstkktvvtkeytval((sN/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/profiler.pyt set_config!s   "tsymbolics profile.jsoncC@s₯tjdƒtgd|dgD] }|^q!ƒ}tgt|gD]}t|ƒ^qFƒ}t|ƒt|ƒkst‚ttj t|ƒ||t ƒƒdS(s@Set up the configure of profiler (Deprecated). Parameters ---------- mode : string, optional Indicates whether to enable the profiler, can be 'symbolic', or 'all'. Defaults to `symbolic`. filename : string, optional The name of output trace file. Defaults to 'profile.json'. sVprofiler.profiler_set_config() is deprecated. Please use profiler.set_config() insteadtprofile_tfilenameN( twarningstwarnRtTrueRRtAssertionErrorRRR R(tmodeRRR RR ((sN/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/profiler.pytprofiler_set_configFs )+tstoptworkercC@sVidd6dd6}idd6dd6}ttjtj||ƒ||tƒƒdS(sœSet up the profiler state to 'run' or 'stop'. Parameters ---------- state : string, optional Indicates whether to run the profiler, can be 'stop' or 'run'. Default is `stop`. profile_process : string whether to profile kvstore `server` or `worker`. server can only be profiled when kvstore is of type dist. if this is not passed, defaults to `worker` iRitrunR tserverN(RRtMXSetProcessProfilerStatetctypestc_intR(tstatetprofile_processt state2inttprofile_process2int((sN/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/profiler.pyt set_stateYs cC@stjdƒt|ƒdS(sέSet up the profiler state to 'run' or 'stop' (Deprecated). Parameters ---------- state : string, optional Indicates whether to run the profiler, can be 'stop' or 'run'. Default is `stop`. sTprofiler.profiler_set_state() is deprecated. Please use profiler.set_state() insteadN(RRR*(R&((sN/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/profiler.pytprofiler_set_statems cC@sM|tkrdnd}idd6dd6}ttj|||tƒƒdS(sίDump profile and stop profiler. Use this to save profile in advance in case your program cannot exit normally. Parameters ---------- finished : boolean Indicates whether to stop statistic output (dumping) after this dump. Default is True profile_process : string whether to profile kvstore `server` or `worker`. server can only be profiled when kvstore is of type dist. if this is not passed, defaults to `worker` iiR R"N(RRRtMXDumpProcessProfileR(tfinishedR'tfinR)((sN/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/profiler.pytdumpzs  cC@stjdƒttƒdS(srDump profile and stop profiler. Use this to save profile in advance in case your program cannot exit normally.sIprofiler.dump_profile() is deprecated. Please use profiler.dump() insteadN(RRR/R(((sN/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/profiler.pyt dump_profiles cC@sVtjƒ}|tkrdnd}ttjtj|ƒt|ƒƒƒt|j ƒS(sΖReturn a printable string of aggregate profile stats. Parameters ---------- reset: boolean Indicates whether to clean aggeregate statistical data collected up to this point ii( R$tc_char_pRRRtMXAggregateProfileStatsPrinttbyreftintRtvalue(tresett debug_strtdo_reset((sN/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/profiler.pytdumps—s %cC@s;idd6dd6}ttjtdƒ||tƒƒdS(sPause profiling. Parameters ---------- profile_process : string whether to profile kvstore `server` or `worker`. server can only be profiled when kvstore is of type dist. if this is not passed, defaults to `worker` iR iR"N(RRtMXProcessProfilePauseR4R(R'R)((sN/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/profiler.pytpause₯s cC@s;idd6dd6}ttjtdƒ||tƒƒdS(s  Resume paused profiling. Parameters ---------- profile_process : string whether to profile kvstore `server` or `worker`. server can only be profiled when kvstore is of type dist. if this is not passed, defaults to `worker` iR iR"N(RRR:R4R(R'R)((sN/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/profiler.pytresume΅s tDomaincB@sGeZdZd„Zd„Zd„Zd„Zdd„Zd„Z RS(s Profiling domain, used to group sub-objects like tasks, counters, etc into categories Serves as part of 'categories' for chrome://tracing Note: Domain handles are never destroyed. Parameters ---------- name : string Name of the domain cC@sD||_tƒ|_ttjt|jƒtj|jƒƒƒdS(N( tnameRR RRtMXProfileCreateDomainRR$R3(tselfR>((sN/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/profiler.pyt__init__Ρs  cC@s|jS(N(R>(R@((sN/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/profiler.pyt__str__ΦscC@s t||ƒS(sŽCreate new Task object owned by this domain Parameters ---------- name : string Name of the task (tTask(R@R>((sN/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/profiler.pytnew_taskΩscC@s t||ƒS(sCreate new Frame object owned by this domain Parameters ---------- name : string Name of the frame (tFrame(R@R>((sN/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/profiler.pyt new_frameγscC@st|||ƒS(s”Create new Counter object owned by this domain Parameters ---------- name : string Name of the counter (tCounter(R@R>R5((sN/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/profiler.pyt new_counterνscC@s t||ƒS(s’Create new Marker object owned by this domain Parameters ---------- name : string Name of the marker (tMarker(R@R>((sN/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/profiler.pyt new_markerχsN( t__name__t __module__t__doc__RARBRDRFtNoneRHRJ(((sN/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/profiler.pyR=Ζs    RCcB@s;eZdZd„Zd„Zd„Zd„Zd„ZRS(sœProfiling Task class. A task is a logical unit of work performed by a particular thread. Tasks can nest; thus, tasks typically correspond to functions, scopes, or a case block in a switch statement. You can use the Task API to assign tasks to threads. This is different from Frame in that all profiling statistics for passes through the task's begin and endpoints are accumulated together into a single statistical analysys, rather than a separate analysis for each pass (as with a Frame) Parameters ---------- domain : Domain object Domain to which this object belongs name : string Name of the task cC@sJ||_tƒ|_ttj|jt|jƒtj|jƒƒƒdS(N( R>RR RRtMXProfileCreateTaskRR$R3(R@tdomainR>((sN/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/profiler.pyRAs    cC@s,|jdk r(ttj|jƒƒndS(N(R RNRRtMXProfileDestroyHandle(R@((sN/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/profiler.pyt__del__scC@sttj|jƒƒdS(s"Start timing scope for this objectN(RRtMXProfileDurationStartR (R@((sN/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/profiler.pytstartscC@sttj|jƒƒdS(s!Stop timing scope for this objectN(RRtMXProfileDurationStopR (R@((sN/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/profiler.pyR#scC@s|jS(N(R>(R@((sN/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/profiler.pyRB's(RKRLRMRARRRTRRB(((sN/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/profiler.pyRCs     REcB@s;eZdZd„Zd„Zd„Zd„Zd„ZRS(s!Profiling Frame class. Use the frame API to insert calls to the desired places in your code and analyze performance per frame, where frame is the time period between frame begin and end points. When frames are displayed in Intel VTune Amplifier, they are displayed in a separate track, so they provide a way to visually separate this data from normal task data. This is different from Task in that each 'Frame' duration will be a discretely-numbered event in the VTune output, as well as its rate (frame-rate) shown. This is analogous to profiling each frame of some visual output, such as rendering a video game frame. Parameters ---------- domain : Domain object Domain to which this object belongs name : string Name of the frame cC@sJ||_tƒ|_ttj|jt|jƒtj|jƒƒƒdS(N( R>RR RRtMXProfileCreateFrameRR$R3(R@RPR>((sN/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/profiler.pyRA>s    cC@s,|jdk r(ttj|jƒƒndS(N(R RNRRRQ(R@((sN/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/profiler.pyRREscC@sttj|jƒƒdS(s"Start timing scope for this objectN(RRRSR (R@((sN/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/profiler.pyRTIscC@sttj|jƒƒdS(s!Stop timing scope for this objectN(RRRUR (R@((sN/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/profiler.pyRMscC@s|jS(N(R>(R@((sN/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/profiler.pyRBQs(RKRLRMRARRRTRRB(((sN/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/profiler.pyRE+s     tEventcB@s;eZdZd„Zd„Zd„Zd„Zd„ZRS(s)Profiling Event class. The event API is used to observe when demarcated events occur in your application, or to identify how long it takes to execute demarcated regions of code. Set annotations in the application to demarcate areas where events of interest occur. After running analysis, you can see the events marked in the Timeline pane. Event API is a per-thread function that works in resumed state. This function does not work in paused state. Parameters ---------- name : string Name of the event cC@sD||_tƒ|_ttjt|jƒtj|jƒƒƒdS(N( R>RR RRtMXProfileCreateEventRR$R3(R@R>((sN/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/profiler.pyRAds  cC@s,|jdk r(ttj|jƒƒndS(N(R RNRRRQ(R@((sN/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/profiler.pyRRiscC@sttj|jƒƒdS(s"Start timing scope for this objectN(RRRSR (R@((sN/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/profiler.pyRTmscC@sttj|jƒƒdS(s!Stop timing scope for this objectN(RRRUR (R@((sN/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/profiler.pyRqscC@s|jS(N(R>(R@((sN/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/profiler.pyRBus(RKRLRMRARRRTRRB(((sN/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/profiler.pyRWUs     RGcB@s_eZdZd d„Zd„Zd„Zdd„Zdd„Zd„Z d„Z d „Z RS( s5Profiling Counter class. The counter event can track a value as it changes over time. Parameters ---------- domain : Domain object Domain to which this object belongs name : string Name of the counter value: integer, optional Initial value of the counter cC@sc||_tƒ|_ttj|jt|ƒtj|jƒƒƒ|dk r_|j |ƒndS(N( R>RR RRtMXProfileCreateCounterRR$R3RNt set_value(R@RPR>R5((sN/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/profiler.pyRA‡s    cC@s,|jdk r(ttj|jƒƒndS(N(R RNRRRQ(R@((sN/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/profiler.pyRRscC@s#ttj|jt|ƒƒƒdS(sxSet counter value. Parameters ---------- value : int Value for the counter N(RRtMXProfileSetCounterR R4(R@R5((sN/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/profiler.pyRZ•sicC@s#ttj|jt|ƒƒƒdS(s•Increment counter value. Parameters ---------- value_change : int Amount by which to add to the counter N(RRtMXProfileAdjustCounterR R4(R@tdelta((sN/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/profiler.pyt incrementŸscC@s$ttj|jt|ƒ ƒƒdS(sœDecrement counter value. Parameters ---------- value_change : int Amount by which to subtract from the counter N(RRR\R R4(R@R]((sN/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/profiler.pyt decrement©scC@s|j|ƒ|S(N(R^(R@R]((sN/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/profiler.pyt__iadd__³s cC@s|j|ƒ|S(N(R_(R@R]((sN/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/profiler.pyt__isub__·s cC@s|jS(N(R>(R@((sN/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/profiler.pyRB»sN( RKRLRMRNRARRRZR^R_R`RaRB(((sN/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/profiler.pyRGys    RIcB@s#eZdZd„Zdd„ZRS(sSet marker for an instant in time. The marker event marks a particular instant in time across some scope boundaries. Parameters ---------- domain : Domain object Domain to which this object belongs name : string Name of the marker cC@s||_||_dS(N(R>RP(R@RPR>((sN/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/profiler.pyRAΛs tprocesscC@s2ttj|jjt|jƒt|ƒƒƒdS(s"Set up the profiler state to record operator. Parameters ---------- scope : string, optional Indicates what scope the marker should refer to. Can be 'global', 'process', thread', task', and 'marker' Default is `process`. N(RRtMXProfileSetMarkerRPR RR>(R@tscope((sN/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/profiler.pytmarkΟs (RKRLRMRARe(((sN/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/profiler.pyRIΏs  (!RMt __future__RR$RtbaseRRRRRRRRR RRR*R+RR/R0tFalseR9R;R<tobjectR=RCRERWRGRI(((sN/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/profiler.pyts*  4   %     ;**$F