ó R;]c@@sGdZddlmZddlZddlZddlmZmZmZm Z m Z m Z d„Z ddd „Z d d „Zd d „Zed „Zd„Zed„Zd„Zd„Zdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdS(sProfiler setting methods.i(tabsolute_importNi(t_LIBt check_calltc_strt ProfileHandlet c_str_arraytpy_strc K@ss|jƒ}|jƒ}ttjt|ƒtg|D] }|^q4ƒtg|D]}t|ƒ^qPƒƒƒdS(s:Set 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. N(tkeystvaluesRRtMXSetProfilerConfigtlenRtstr(tkwargstkktvvtkeytval((sN/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/profiler.pyt set_configs   tsymbolics profile.jsoncC@s¢tjdƒtgd|dgD] }|^q!ƒ}tgt|gD]}t|ƒ^qFƒ}t|ƒt|ƒkst‚ttj 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( twarningstwarnRtTrueR R tAssertionErrorRRR (tmodeRRRRR((sN/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/profiler.pytprofiler_set_config<s )+tstopcC@s8idd6dd6}ttjtj||ƒƒƒ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`. iRitrunN(RRtMXSetProfilerStatetctypestc_int(tstatet state2int((sN/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/profiler.pyt set_stateOs 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.2.1-py2.7.egg/mxnet/profiler.pytprofiler_set_state\s cC@s/|tkrdnt}ttj|ƒƒdS(sDump 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 iN(RtFalseRRt MXDumpProfile(tfinishedtfin((sN/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/profiler.pytdumpis 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.2.1-py2.7.egg/mxnet/profiler.pyt dump_profilews 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( Rtc_char_pRRRtMXAggregateProfileStatsPrinttbyreftintRtvalue(tresett debug_strtdo_reset((sN/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/profiler.pytdumpss %cC@sttjtdƒƒƒdS(sPause profiling.iN(RRtMXProfilePauseR-(((sN/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/profiler.pytpausescC@sttjtdƒƒƒdS(sResume paused profiling.iN(RRR3R-(((sN/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/profiler.pytresume’stDomaincB@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( tnameRthandleRRtMXProfileCreateDomainRRR,(tselfR7((sN/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/profiler.pyt__init__¢s  cC@s|jS(N(R7(R:((sN/usr/local/lib/python2.7/site-packages/mxnet-1.2.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:R7((sN/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/profiler.pytnew_taskªscC@s t||ƒS(sCreate new Frame object owned by this domain Parameters ---------- name : string Name of the frame (tFrame(R:R7((sN/usr/local/lib/python2.7/site-packages/mxnet-1.2.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:R7R.((sN/usr/local/lib/python2.7/site-packages/mxnet-1.2.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:R7((sN/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/profiler.pyt new_markerÈsN( t__name__t __module__t__doc__R;R<R>R@tNoneRBRD(((sN/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/profiler.pyR6—s    R=cB@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( R7RR8RRtMXProfileCreateTaskRRR,(R:tdomainR7((sN/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/profiler.pyR;ås    cC@s,|jdk r(ttj|jƒƒndS(N(R8RHRRtMXProfileDestroyHandle(R:((sN/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/profiler.pyt__del__ìscC@sttj|jƒƒdS(s"Start timing scope for this objectN(RRtMXProfileDurationStartR8(R:((sN/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/profiler.pytstartðscC@sttj|jƒƒdS(s!Stop timing scope for this objectN(RRtMXProfileDurationStopR8(R:((sN/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/profiler.pyRôscC@s|jS(N(R7(R:((sN/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/profiler.pyR<øs(RERFRGR;RLRNRR<(((sN/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/profiler.pyR=Òs     R?cB@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( R7RR8RRtMXProfileCreateFrameRRR,(R:RJR7((sN/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/profiler.pyR;s    cC@s,|jdk r(ttj|jƒƒndS(N(R8RHRRRK(R:((sN/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/profiler.pyRLscC@sttj|jƒƒdS(s"Start timing scope for this objectN(RRRMR8(R:((sN/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/profiler.pyRNscC@sttj|jƒƒdS(s!Stop timing scope for this objectN(RRROR8(R:((sN/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/profiler.pyRscC@s|jS(N(R7(R:((sN/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/profiler.pyR<"s(RERFRGR;RLRNRR<(((sN/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/profiler.pyR?ü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( R7RR8RRtMXProfileCreateEventRRR,(R:R7((sN/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/profiler.pyR;5s  cC@s,|jdk r(ttj|jƒƒndS(N(R8RHRRRK(R:((sN/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/profiler.pyRL:scC@sttj|jƒƒdS(s"Start timing scope for this objectN(RRRMR8(R:((sN/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/profiler.pyRN>scC@sttj|jƒƒdS(s!Stop timing scope for this objectN(RRROR8(R:((sN/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/profiler.pyRBscC@s|jS(N(R7(R:((sN/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/profiler.pyR<Fs(RERFRGR;RLRNRR<(((sN/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/profiler.pyRQ&s     RAcB@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( R7RR8RRtMXProfileCreateCounterRRR,RHt set_value(R:RJR7R.((sN/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/profiler.pyR;Xs    cC@s,|jdk r(ttj|jƒƒndS(N(R8RHRRRK(R:((sN/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/profiler.pyRLascC@s#ttj|jt|ƒƒƒdS(sxSet counter value. Parameters ---------- value : int Value for the counter N(RRtMXProfileSetCounterR8R-(R:R.((sN/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/profiler.pyRTfsicC@s#ttj|jt|ƒƒƒdS(s•Increment counter value. Parameters ---------- value_change : int Amount by which to add to the counter N(RRtMXProfileAdjustCounterR8R-(R:tdelta((sN/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/profiler.pyt incrementpscC@s$ttj|jt|ƒ ƒƒdS(sœDecrement counter value. Parameters ---------- value_change : int Amount by which to subtract from the counter N(RRRVR8R-(R:RW((sN/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/profiler.pyt decrementzscC@s|j|ƒ|S(N(RX(R:RW((sN/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/profiler.pyt__iadd__„s cC@s|j|ƒ|S(N(RY(R:RW((sN/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/profiler.pyt__isub__ˆs cC@s|jS(N(R7(R:((sN/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/profiler.pyR<ŒsN( RERFRGRHR;RLRTRXRYRZR[R<(((sN/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/profiler.pyRAJs    RCcB@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(R7RJ(R:RJR7((sN/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/profiler.pyR;œ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(RRtMXProfileSetMarkerRJR8RR7(R:tscope((sN/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/profiler.pytmark s (RERFRGR;R_(((sN/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/profiler.pyRCs  (RGt __future__RRRtbaseRRRRRRRRR"R#RR(R)R$R2R4R5tobjectR6R=R?RQRARC(((sN/usr/local/lib/python2.7/site-packages/mxnet-1.2.1-py2.7.egg/mxnet/profiler.pyts&  .      ;**$F