%%Copyright2010-2018TheMathWorks,Inc.
%%
%%Abstract:Profilinginstrumentionforcodethatisnotaccessibleandcannot
%%beinstrumentedfromCGIR
%%
%if EXISTS("_PROF_TLC_") == 0
%assign _PROF_TLC_ = 1
 
 
%%Function:SLibProfilerSystemStart============================================
%%Abstract:
%%Generatecodeforstartingtheprofileoperationatthebeginningofthe
%%codesegmentforaSystem'sfcn(Output/Update/OutputUpdate/Derivatives)
%%function
%function SLibProfilerSystemStart(system, sectionIdx) void
   
  %openfile tmpBuff
  %if SLibIsERTTarget()
      %assign startSymbol = SLibTraceBegin(sectionIdx)
      %<startSymbol>
  %else
  %assign startSymbol = FEVAL("coder.internal.getExecTimeProbeSymbol", "start")
  %<startSymbol>(%<sectionIdx>);
  %endif
  %closefile tmpBuff
  %return tmpBuff
   
%endfunction
 
%%Function:SLibProfilerSystemFinish============================================
%%Abstract:
%%Generatecodeforendingtheprofileoperationattheendofthe
%%codesegmentforaSystem'sfcn(Output/Update/OutputUpdate/Derivatives)
%%function
%function SLibProfilerSystemFinish(system, sectionIdx) void
     
  %openfile tmpBuff
  %if SLibIsERTTarget()
      %assign endSymbol = SLibTraceEnd(sectionIdx)
      %<endSymbol>
  %else
  %assign endSymbol = FEVAL("coder.internal.getExecTimeProbeSymbol", "end")
  %<endSymbol>(%<sectionIdx>);
  %endif
  %closefile tmpBuff
  %return tmpBuff
 
%endfunction
   
%function SLibProfilerGetSectionIdx(fcnName) void
 
  %assign sectionIdx = ...
    FEVAL("coder.internal.requestExecTimeTraceId", ...
    LibGetModelName(), fcnName)
  %if ISEMPTY(sectionIdx) || (sectionIdx<=0)
    %exit Failed to get identifier for execution profiling
  %endif
  %if SLibIsERTTarget()
      %assign customTraceIdentifier = FEVAL("coder.internal.getExecTimeProbeSymbol", "customTraceIdentifier")
      %assign rtnVal = SLibAddTrace("%<customTraceIdentifier>", "%<sectionIdx>")
  %else
  %assign rtnVal = SPRINTF("%dU",sectionIdx)
  %endif
  %return rtnVal
 
%endfunction
   
 
%%Function:SLibProfilerTypeDefs============================================
%%Abstract:
%%Generatecodefortypedefsofprofilerobjectsandmacrodefinitions
%%forCPUcyclecounting
%function SLibProfilerTypeDefs() void
 
  %assign declarationsSymbol = FEVAL("coder.internal.getExecTimeProbeSymbol", "declarations")
  %openfile tmpBuff
  /* %<declarationsSymbol> */
  %closefile tmpBuff
  %return tmpBuff
   
%endfunction
 
%endif