add cmd line to forkcall stats
authorDirk Koopman <djk@tobit.co.uk>
Mon, 25 Jul 2016 17:55:54 +0000 (18:55 +0100)
committerDirk Koopman <djk@tobit.co.uk>
Mon, 25 Jul 2016 17:55:54 +0000 (18:55 +0100)
16 files changed:
cmd/show/announce.pl
cmd/show/chat.pl
cmd/show/dx.pl
cmd/show/groups.pl
cmd/show/hfstats.pl
cmd/show/hftable.pl
cmd/show/isolate.pl
cmd/show/lockout.pl
cmd/show/log.pl
cmd/show/rcmd.pl
cmd/show/registered.pl
cmd/show/talk.pl
cmd/show/vhfstats.pl
cmd/show/vhftable.pl
cmd/show/wx.pl
perl/DXCommandmode.pm

index 3454140ecf3abe96d3b7f112794982d70aca0322..77811449638fd01210511bb03119d8b33dd17ef3 100644 (file)
@@ -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);
index 5ac6312e2714218e9af1f0f40e5abbd4df356467..38d5b38ab8af5b813e0bb0bc37028e3f9c167f15 100644 (file)
@@ -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);
index 15eaffd0d5a434feb986827389f838552dbab50e..1170a3447e5e333d3c1659458ecf8f04d811a33b 100644 (file)
@@ -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) = @_; 
index 48ab9e10d4bcb093141898673112e0f798ec9556..26aad008a88a3dcb05a9738f88bca87c1cb48d72 100644 (file)
@@ -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;
index c2e055f7d0f878097e00034ee924dce2fe597024..5cee6593e5e758702fb27e9d0df755f856162432 100644 (file)
@@ -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;
index 25cb9c0ba9d4f786a381ae4ac30aca0bc5e5473d..40f8d2ca93f7580aa644bb6b967edd1340c4cb83 100644 (file)
@@ -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;
index 979bf0d3021645d03b77bce0934cef78bcb32f28..3c0939c9cdf6f9d5c3281573d5027004055b232d 100644 (file)
@@ -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;
                                                        
index d2133df5ce3d41651f4fca503a64caf974c99938..e97b4bcf34c53436429478592a624ac2bd8fe5f4 100644 (file)
@@ -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);
index 18d9405091f8e6132640a74d4be5860003c56b4a..29d2b51232aca51f3bae521e98ce2ac42b18d1e5 100644 (file)
@@ -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);
 }
index 57cfe0969a8ce0274af19e550784f89ddbfe5ab3..64b64798ae0a6debafed70ad16e0b37784df88c4 100644 (file)
@@ -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);
index 7e3ce45def2a5f6d8e14def1ec46dbf7f9333b17..0b41164caea7f5cf1c5514773252c7c6cca400fe 100644 (file)
@@ -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;
                                                        
index 3dafbc0b2bfd67201ac5d1cde4903f7b5d04b6bd..942dac72dbeb015ceef56ab0b8e704a50413cf94 100644 (file)
@@ -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);
index 402cc06d8014090f857277559abcaef115e0c342..b819ab7ca29fdfd212695f7ceeb539d377a59249 100644 (file)
@@ -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;
index a4a784918442b626046949196cc7914548ec5e8b..e7770e5c4c48286b96489b665d1682cd81e09bea 100644 (file)
@@ -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;
index 81a81bf7d3b35131f546fc0a04f207c367c192bc..6b43268e89be34cc12c15ad1509dfa5f7dfda131 100644 (file)
@@ -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);
index 14e0dd2c9b8e599a856ddbb76410755d1efa5d48..12ff175029ef10da39ed95116fea66ff13133adb 100644 (file)
@@ -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(\<function>, [cb => sub{...}], [prefix => "cmd> "], [progress => 0|1], [args => [...]]);
+# call: $self->spawn_cmd($original_cmd_line, \<function>, [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;