From 6265c3a3a8dc28a04f4e76893c22bcf6f0664b77 Mon Sep 17 00:00:00 2001 From: etienne Date: Wed, 30 Dec 2015 15:00:21 +0000 Subject: * ivymon : . New option -buf for bufferizing messages from the begining. Use this option to minimize processings when ivymon is intended to receive very large flows of messages. You can always display them later using the "Scroll" button. . The -history option now accepts 3 types of value : . N => only the N first received messages are kept (unchanged) . Nm => only the messages received during the N first minutes are kept . infinite => all received messages are kept (according to memory capacity) . New option -verbose. . Improved bufferized mode management (in save function, etc.). . Fix : crash during input file loading. . Loggued ivymon bindings changes. . Added a button to enlarge the "Bindings" frame. . Added a status bar. . Added some ballon help informations. . Minor fixes. * ivyreplay : . Updated code to take into account new ivymon tags. . Minor fixes. --- src/ivyreplay | 79 ++++++++++++++++++++++++++--------------------------------- 1 file changed, 35 insertions(+), 44 deletions(-) (limited to 'src/ivyreplay') diff --git a/src/ivyreplay b/src/ivyreplay index e1ab41b..b4d9adb 100755 --- a/src/ivyreplay +++ b/src/ivyreplay @@ -23,7 +23,7 @@ use vars qw/$opt_help $opt_b $opt_bus $opt_repeat $opt_startregexp $opt_padding $opt_stopregexp $opt_timegranularity $opt_debug/; -our $VERSION = '1.24'; +our $VERSION = '1.25'; # geometry @@ -62,8 +62,8 @@ my $replay_fg = 'black'; my $replay_bg_orig; my $replay_fg_orig; my $replay_hour; -$opt_startregexp = '^ClockStart\$'; -$opt_stopregexp = '^ClockStop\$'; +$opt_startregexp = '^ClockStart$'; +$opt_stopregexp = '^ClockStop$'; my $padding = 2; #---------------------------------------------------------------------------------- @@ -114,20 +114,9 @@ if ($opt_bus) { } elsif ($opt_b) { $ivy_port = $opt_b; } -my $title; -my $ivy_version = $Ivy::VERSION; -my $ivy_cvsrevision = 0; -my $ivy_versionstring = "v$ivy_version"; -if ($ivy_version =~ s/Revision: (.*)//) { - $ivy_version = $1; - $ivy_cvsrevision = 1; - $ivy_versionstring = "v$ivy_version (cvs revision)"; -} -if ($ivy_port) { - $title = "Ivyreplay ($ivy_port) - Ivy $ivy_versionstring"; -} else { - $title = "Ivyreplay (default port) - Ivy $ivy_versionstring"; -} +my $title = "Ivyreplay v$VERSION "; +$title .= ($ivy_port) ? "($ivy_port)" : "(default port)"; + $replay_time_granularity = $opt_timegranularity if $opt_timegranularity > 0; if ($replay_time_granularity >= 1) { $replay_time_decimalplaces = 0; @@ -202,34 +191,35 @@ $ivy->start; # load input files my @files = @ARGV; -my $lines = 0; my $steps = 0; if (@files == 0) { $mw->Tk::Error("Error : an input file is expected"); } else { - &showProgressbar(); - for my $file (@files) { - if (not open(IN, $file)) { - $mw->Tk::Error("Can't open file '$file' ($!)"); - next; - } else { - my ($l, $timefound) = &stepsnumber; - $lines += $l; - if ($timefound) { + &showProgressbar("Loading file..."); + my $file = $files[0]; + if (not open(IN, $file)) { + $mw->Tk::Error("Can't open file '$file' ($!)"); + } else { + my ($lines, $timefound) = &stepsnumber; + $title .= " - $lines messages"; + $mw->title($title); + $steps = int($lines/10); + $progressbar->configure(-to => $steps*10); + if ($timefound) { &loadfileForReplay(); - } else { + &hideProgressbar(); + } else { $mw->Tk::Error("No time information in file '$file'. ". "Can't be replayed."); - next; - } + } } close(IN); - } - $steps = int($lines/10); - $progressbar->configure(-to => 10); - &displayMessages() unless $opt_light; - &hideProgressbar(); - &replayStart() if $opt_autostart; + unless ($opt_light) { + &showProgressbar("Displaying msgs..."); + &displayMessages(); + &hideProgressbar(); + } + &replayStart() if $opt_autostart; } MainLoop; @@ -255,7 +245,7 @@ sub stepsnumber { while() { chomp; next if (/^applications=/ or /^(marker\d+)$/ or /^(messages_number=)/ - or /^\#/ or /^delay=/); + or /^\#/ or /^delay=/ or /^comment=/ or /^\s*$/); my ($sender, $message) = split(/\s+/, $_, 2); if ($message =~ /^(\d[\d\.]+\d)\s+.*/) { $timefound = 1; @@ -387,15 +377,15 @@ sub build { sub loadfileForReplay { - # display messsages to replay my ($sender, $time, $message); my $delay = 0; + my $line = 0; while() { chomp; next if /^\#/ or /^applications=/ or /^messages_number=/ - or /^\s*$/ or /^(marker\d+)$/; + or /^\s*$/ or /^(marker\d+)$/ or /^comment=/; if (/^delay=(\d.*)/) { if ($1 < 0) { carp "delay (=$1) must be >=0\n"; @@ -405,6 +395,7 @@ sub loadfileForReplay { #print "delay=$delay\n"; next; } + $line++; ($sender, $time, $message) = split(/\s+/, $_, 3); $time += $delay; if ($replay_time_granularity >= 1) { @@ -425,6 +416,7 @@ sub loadfileForReplay { $message =~ s/^\"//; $message =~ s/\"$//; push(@{$replay_msg{$time}}, $message); + &setProgressbar($line); } $mw->raise; $replay_time = $replay_min_time; @@ -446,9 +438,7 @@ sub displayMessages { $replay_text->insert('end', &replayTime($time)." ".$message."\n", $time); $line++; - if ($steps != 0) { - &setProgressbar($line/$steps) if $line % $steps == 0; - } + &setProgressbar($line); # when user click on a message the begin time changes. $replay_text->tagBind($time, '<1>', [sub { my $ti = $_[1]; @@ -478,13 +468,13 @@ sub displayMessages { } $replay_text->configure(-state => 'disabled') if $replay_text; - } sub showProgressbar { + $progressbar->toplevel->title(shift); $progressbar->value(0); - $progressbar->toplevel->deiconify; + $progressbar->toplevel->Popup(-popover => $mw, -popanchor => 'c'); $progressbar->toplevel->raise($mw); } # end showProgressbar @@ -500,6 +490,7 @@ sub hideProgressbar { sub setProgressbar { my ($line) = @_; + return unless ($steps == 0 or $line % $steps == 0); $progressbar->value($line); $progressbar->toplevel->raise($mw); $progressbar->update; -- cgit v1.1