%% Measuring Entity Delays Using Timers

% Copyright 2008-2011 The MathWorks, Inc.

%% Overview
% This example shows how to use the *Start Timer* and *Read Timer* blocks to
% measure entity-based delays. The Start Timer block starts
% a specified timer (equivalent to time-stamping an entity) for each
% arriving entity. The Read Timer block reads this timer for each entity
% and computes the delay that the entity incurred between the two timer
% blocks. 

modelname = 'sedemo_start_timer_read_timer';
open_system(modelname);
set_param([modelname '/Number of Entities Received'],'OpenScopeAtSimStart', 'off' );
set_param([modelname '/Number of Entities Time-Stamped'],'OpenScopeAtSimStart', 'off' );


%% Results and Displays

sim(modelname);

%% Related Examples
% * <matlab:helpview(fullfile(docroot,'toolbox','simevents','helptargets.map'),'doc_timer_prototype'); Basic Example
% Using Timer Blocks> 
% * <matlab:helpview(fullfile(docroot,'toolbox','simevents','helptargets.map'),'doc_two_timers'); Timing Multiple Processes 
% Independently> 


%% 
%cleanup
bdclose(modelname);
clear modelname;
displayEndOfDemoMessage(mfilename)
