From ea2a08ccf308e6f3974350076f5515315f27cde8 Mon Sep 17 00:00:00 2001 From: etienne Date: Wed, 27 Sep 2006 15:57:06 +0000 Subject: added a -debug option. --- src/ivymon | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/ivymon b/src/ivymon index 4bb967a..c21d9c1 100755 --- a/src/ivymon +++ b/src/ivymon @@ -90,7 +90,7 @@ use Getopt::Long; use Tk::CmdLine; use vars qw/$VERSION $opt_help $opt_b $opt_bus $opt_history @opt_bind @opt_send $opt_size $opt_undersize $opt_out $opt_loadingmode $opt_replayrepeat $opt_replaystartregexp - $opt_replaystopregexp $opt_replaytimegranularity/; + $opt_replaystopregexp $opt_replaytimegranularity $opt_debug/; # **** VERSION *** $VERSION = '1.16'; @@ -218,14 +218,14 @@ Tk::CmdLine::SetArguments(); if (not GetOptions('-help', '-history=s', '-b=s', '-bus=s', '-bind=s@', '-send=s@', '-size=s', '-undersize', '-loadingmode=s', - '-replayrepeat', '-replaystartregexp=s', + '-replayrepeat', '-replaystartregexp=s', '-debug', '-replaytimegranularity=s', '-replaystopregexp=s', '-out=s') or $opt_help) { print "\n"; print "IvyMon version $VERSION\n"; print "\n"; print "Usage: ivymon [-b[us] bus] [-help] [-history length]\n"; - print " [-size size] [-undersize]\n"; + print " [-size size] [-undersize] [-debug]\n"; print " [-bind regexp1] ... [-bind regexpN] \n"; print " [-send message1] ... [-send messageN] \n"; print " [-loadingmode mode] [-replayrepeat]\n"; @@ -2703,21 +2703,23 @@ sub replayStart { # if speed rate != 1, time regulation is deactivated if ($replay_speed != 1) { $replay_current_factor = $replay_factor; - #print "replay_speed=$replay_speed => time regulation deactivated\n"; + print "replay_speed=$replay_speed => time regulation deactivated\n" if $opt_debug; # if replay is running behind schedule } elsif ($dt > $data_dt + $replay_maxgap and $replay_current_factor <= $replay_factor) { $replay_current_factor *= (1 - $replay_regulpct->[0]/100); - #print "data_dt=$data_dt dt=$dt2 delay=$d [--] replay_factor=$replay_current_factor\n"; + print "data_dt=$data_dt dt=$dt2 delay=$d [--] replay_factor=$replay_current_factor\n" + if $opt_debug; # if replay is getting ahead of schedule } elsif ($dt < $data_dt - $replay_maxgap and $replay_current_factor >= $replay_factor) { $replay_current_factor *= (1 + $replay_regulpct->[1]/100); - #print "data_dt=$data_dt dt=$dt2 delay=$d [++] replay_factor=$replay_current_factor\n"; + print "data_dt=$data_dt dt=$dt2 delay=$d [++] replay_factor=$replay_current_factor\n" + if $opt_debug; # if replay is on time } else { - #print "data_dt=$data_dt dt=$dt2 delay=$d\n"; + print "data_dt=$data_dt dt=$dt2 delay=$d\n" if $opt_debug; $replay_current_factor = $replay_factor; } -- cgit v1.1