%    TIMING - Plots timing information for control cycles.
%
%    B. A. Moran, 12-Oct-1997

%    Copyright (C) 1995-1998
%    Massachussetts Institute of Technology
%    Sea Grant AUV Laboratory
%    $Id: timing.m,v 1.3 1998/05/15 15:01:41 bamoran Exp $	

global run_name;

if exist( 'h_tim' ) ~= 1
    h_tim = figure;
    winpos(position(1,:));
else 
    h_tim = figure( h_tim );
end

set( h_tim, 'name', 'Odyssey II Timing', 'DeleteFcn', 'clear h_tim' );

subplot( 2, 1, 1 )
cla
m = size( time, 1 );
plot( time(1:m-1), diff(time) );
title( ['Control Cycle Duration: ' run_name] );
ylabel( 'duration (s)' );
xlabel( 'elapsed time (s)' );
zoom on

subplot( 2, 2, 3 )
cla
plot( time, 'r' );
title( 'Time Evolution' );
ylabel( 'elapsed time (s)' );
xlabel( 'control cycle' );
zoom on

subplot( 2, 2, 4 )
cla
plot( time, time - (0:m-1)'/5, 'c' );
title( 'Cumulative Overrun' );
ylabel( 'tardiness (s)' );
xlabel( 'elapsed time (s)' );
zoom on
