classdef ExecutionTimeTaskSection < coder.profile.ExecutionTimeSection
%EXECUTIONTIMETASKSECTION execution profiling results for a section of code
    
%   Copyright 2010-2015 The MathWorks, Inc.
    
    properties (GetAccess=public, SetAccess=private, Dependent = true, Hidden=true)
       SamplePeriod;
       SampleOffset;
       SlotUtilization;
    end
    
    methods 
       
        function val = get.SamplePeriod(this)
            lSampleTime = this.TraceInfo.getSampleTime;
            val = lSampleTime(1);
        end
        
        function val = get.SampleOffset(this)
            lSampleTime = this.TraceInfo.getSampleTime;
            val = lSampleTime(2);
        end
        
        function vals = get.SlotUtilization(this)
            lSampleTime = getSampleTime(getTraceInfo(this));
            lPeriod = lSampleTime(1);
            vals = getSlotUtilization(this.TimerData, this.SectionNumber, lPeriod);
        end
        
    end
    
    
    methods (Access=public, Hidden=true)
        
        function slotRangeTimerValues = getSlotTimerValues(this, callNum)
            
            if nargin < 2
                callNum = 0;
            end
            slotRangeTimerValues = uint64([]);
            
            timerValueSlotStart = getTimerSlotStartValuesForNode...
                (this.TimerData, this.SectionNumber, callNum);
            
            if ~isempty(timerValueSlotStart)
            
                timerValueSlotEnd = getTimerEndValuesForNode...
                    (this.TimerData, this.SectionNumber, callNum);
                
                slotRangeTimerValues = [timerValueSlotStart, timerValueSlotEnd];
            end
        end
        
        function val = getName(this)
            
            lTraceInfo = this.getTraceInfo;
            val = getName(lTraceInfo);

        end
        
    end
        
     methods (Hidden=true, Access=public)
         
       function this = ExecutionTimeTaskSection...
                (lTimerData,...
                 lSectionNumber,...
                 lTraceInfo)
            
            this@coder.profile.ExecutionTimeSection...
                 (lTimerData,...
                 lSectionNumber,...
                 lTraceInfo);

        end
    end
end
