From: Dirk Koopman Date: Mon, 25 Jul 2016 17:55:54 +0000 (+0100) Subject: add cmd line to forkcall stats X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=commitdiff_plain;h=201dedf3e4325faab5c34b38135790012142286b;hp=4db91b5f128f03334ec03a89eb8f56af1d698c78;p=spider.git add cmd line to forkcall stats --- diff --git a/cmd/show/announce.pl b/cmd/show/announce.pl index 3454140e..77811449 100644 --- a/cmd/show/announce.pl +++ b/cmd/show/announce.pl @@ -34,7 +34,7 @@ while ($f = shift @f) { # next field $to = 20 unless $to; $from = 0 unless $from; -@out = $self->spawn_cmd(\&DXLog::print, args => [$from, $to, $main::systime, 'ann', $who]); +@out = $self->spawn_cmd("show/announce $cmdline", \&DXLog::print, args => [$from, $to, $main::systime, 'ann', $who]); #@out = DXLog::print($from, $to, $main::systime, 'ann', $who); return (1, @out); diff --git a/cmd/show/chat.pl b/cmd/show/chat.pl index 5ac6312e..38d5b38a 100644 --- a/cmd/show/chat.pl +++ b/cmd/show/chat.pl @@ -34,7 +34,7 @@ while ($f = shift @f) { # next field $to = 20 unless $to; $from = 0 unless $from; -@out = $self->spawn_cmd(\&DXLog::print, args => [$from, $to, $main::systime, 'chat', $who]); +@out = $self->spawn_cmd("show/chat $cmdline", \&DXLog::print, args => [$from, $to, $main::systime, 'chat', $who]); #@out = DXLog::print($from, $to, $main::systime, 'chat', $who); return (1, @out); diff --git a/cmd/show/dx.pl b/cmd/show/dx.pl index 15eaffd0..1170a344 100644 --- a/cmd/show/dx.pl +++ b/cmd/show/dx.pl @@ -385,7 +385,7 @@ if ($doqra) { # now do the search -push @out, $self->spawn_cmd(\&Spot::search, +push @out, $self->spawn_cmd("sh/dx $line", \&Spot::search, args => [$expr, $fromday, $today, $from, $to, $hint, $dofilter ? $self : undef], cb => sub { my ($dxchan, @res) = @_; diff --git a/cmd/show/groups.pl b/cmd/show/groups.pl index 48ab9e10..26aad008 100644 --- a/cmd/show/groups.pl +++ b/cmd/show/groups.pl @@ -20,7 +20,7 @@ sub handle my @out; $to = 500 unless $to; - @out = $self->spawn_cmd(\&DXLog::print, + @out = $self->spawn_cmd("show/groups $to", \&DXLog::print, args => [0, $to, $main::systime, 'chat', undef], cb => sub { my $self = shift; diff --git a/cmd/show/hfstats.pl b/cmd/show/hfstats.pl index c2e055f7..5cee6593 100644 --- a/cmd/show/hfstats.pl +++ b/cmd/show/hfstats.pl @@ -53,7 +53,7 @@ $now = Julian::Day->new($utime); $now = $now->sub($days); $date = cldate($utime); -@out = $self->spawn_cmd(sub { +@out = $self->spawn_cmd("show/hfstats $line", sub { my %list; my @out; my @in; diff --git a/cmd/show/hftable.pl b/cmd/show/hftable.pl index 25cb9c0b..40f8d2ca 100644 --- a/cmd/show/hftable.pl +++ b/cmd/show/hftable.pl @@ -95,7 +95,7 @@ unless ($now) { $date = cldate(time); } -@out = $self->spawn_cmd(sub { +@out = $self->spawn_cmd("show/hftable $line", sub { my %list; my @out; my $i; diff --git a/cmd/show/isolate.pl b/cmd/show/isolate.pl index 979bf0d3..3c0939c9 100644 --- a/cmd/show/isolate.pl +++ b/cmd/show/isolate.pl @@ -15,7 +15,7 @@ my @out; use DB_File; -@out = $self->spawn_cmd(sub { +@out = $self->spawn_cmd("show/isolate $line", sub { my @out; my @val; diff --git a/cmd/show/lockout.pl b/cmd/show/lockout.pl index d2133df5..e97b4bcf 100644 --- a/cmd/show/lockout.pl +++ b/cmd/show/lockout.pl @@ -22,7 +22,7 @@ if ($line) { return (1, $self->msg('lockoutuse')) unless $line; -@out = $self->spawn_cmd(sub { +@out = $self->spawn_cmd("show lockout $line", sub { my @out; my @val; my ($action, $count, $key, $data) = (0,0,0,0); diff --git a/cmd/show/log.pl b/cmd/show/log.pl index 18d94050..29d2b512 100644 --- a/cmd/show/log.pl +++ b/cmd/show/log.pl @@ -41,7 +41,7 @@ sub handle $who = $self->call; } - @out = $self->spawn_cmd(\&DXLog::print, args => [$from, $to, $main::systime, undef, $who]); + @out = $self->spawn_cmd("show/log $cmdline", \&DXLog::print, args => [$from, $to, $main::systime, undef, $who]); return (1, @out); } diff --git a/cmd/show/rcmd.pl b/cmd/show/rcmd.pl index 57cfe096..64b64798 100644 --- a/cmd/show/rcmd.pl +++ b/cmd/show/rcmd.pl @@ -33,7 +33,7 @@ while ($f = shift @f) { # next field $to = 20 unless $to; $from = 0 unless $from; -@out = $self->spawn_cmd(\&DXLog::print, args => [$from, $to, $main::systime, 'rcmd', $who]); +@out = $self->spawn_cmd("show/rcmd $cmdline", \&DXLog::print, args => [$from, $to, $main::systime, 'rcmd', $who]); #@out = DXLog::print($from, $to, $main::systime, 'rcmd', $who); return (1, @out); diff --git a/cmd/show/registered.pl b/cmd/show/registered.pl index 7e3ce45d..0b41164c 100644 --- a/cmd/show/registered.pl +++ b/cmd/show/registered.pl @@ -20,7 +20,7 @@ if ($line) { $line = "^\U\Q$line"; } -@out = $self->spawn_cmd(sub { +@out = $self->spawn_cmd("show/registered $line", sub { my @out; my @val; diff --git a/cmd/show/talk.pl b/cmd/show/talk.pl index 3dafbc0b..942dac72 100644 --- a/cmd/show/talk.pl +++ b/cmd/show/talk.pl @@ -35,7 +35,7 @@ if ($self->priv < 6) { return (1, $self->msg('e5')) if $who ne $self->call; } -@out = $self->spawn_cmd(\&DXLog::print, args => [$from, $to, $main::systime, 'talk', $who]); +@out = $self->spawn_cmd("show/talk $cmdline", \&DXLog::print, args => [$from, $to, $main::systime, 'talk', $who]); #@out = DXLog::print($from, $to, $main::systime, 'talk', $who); return (1, @out); diff --git a/cmd/show/vhfstats.pl b/cmd/show/vhfstats.pl index 402cc06d..b819ab7c 100644 --- a/cmd/show/vhfstats.pl +++ b/cmd/show/vhfstats.pl @@ -34,7 +34,7 @@ $now = Julian::Day->new($utime); $now = $now->sub($days); $date = cldate($utime); -@out = $self->spawn_cmd(sub { +@out = $self->spawn_cmd("show/vhfstats $line", sub { my %list; my @out; my @in; diff --git a/cmd/show/vhftable.pl b/cmd/show/vhftable.pl index a4a78491..e7770e5c 100644 --- a/cmd/show/vhftable.pl +++ b/cmd/show/vhftable.pl @@ -67,7 +67,7 @@ unless ($now) { $date = cldate(time); } -@out = $self->spawn_cmd(sub { +@out = $self->spawn_cmd("show/vhftable $line", sub { my %list; my @out; my $i; diff --git a/cmd/show/wx.pl b/cmd/show/wx.pl index 81a81bf7..6b43268e 100644 --- a/cmd/show/wx.pl +++ b/cmd/show/wx.pl @@ -28,7 +28,7 @@ while ($f = shift @f) { # next field $to = 20 unless $to; $from = 0 unless $from; -@out = $self->spawn_cmd(\&DXLog::print, args => [$from, $to, $main::systime, 'ann', 'WX']); +@out = $self->spawn_cmd("show/wx $cmdline", \&DXLog::print, args => [$from, $to, $main::systime, 'ann', 'WX']); #@out = DXLog::print($from, $to, $main::systime, 'ann', $who); return (1, @out); diff --git a/perl/DXCommandmode.pm b/perl/DXCommandmode.pm index 14e0dd2c..12ff1750 100644 --- a/perl/DXCommandmode.pm +++ b/perl/DXCommandmode.pm @@ -1256,16 +1256,15 @@ sub _diffms { return unless isdbg('chan'); my $call = shift; - my $a = shift; - my $b = shift || [gettimeofday]; - my $prefix = shift; + my $line = shift; + my $ta = shift; + my $tb = shift || [gettimeofday]; - my $secs = $b->[0] - $a->[0]; - my $msecs = int(($b->[1] - $a->[1]) / 1000); + my $a = int($ta->[0] * 1000) + int($ta->[1] / 1000); + my $b = int($tb->[0] * 1000) + int($tb->[1] / 1000); + my $msecs = $b - $a; - my $s = "forkcall stats: $call "; - $s .= "$prefix " if $prefix; - $s .= "${secs}S" if $secs; + my $s = "forkcall stats: $call '$line' "; $s .= "${msecs}mS"; dbg($s); } @@ -1280,10 +1279,11 @@ sub _diffms # IT DOES NOT START UP SOME NEW PROGRAM AND RELIES ON THE FACT THAT IT IS RUNNING DXSPIDER # THE CURRENT CONTEXT!! # -# call: $self->spawn_cmd(\, [cb => sub{...}], [prefix => "cmd> "], [progress => 0|1], [args => [...]]); +# call: $self->spawn_cmd($original_cmd_line, \, [cb => sub{...}], [prefix => "cmd> "], [progress => 0|1], [args => [...]]); sub spawn_cmd { my $self = shift; + my $line = shift; my $cmdref = shift; my $call = $self->{call}; my %args = @_; @@ -1324,7 +1324,7 @@ sub spawn_cmd $dxchan->send(@res); } } - _diffms($call, $t0, [gettimeofday], $prefix); + _diffms($call, $line, $t0); }); return @out;