set/debug rbntimer will show how long a queue takes to process (remember
that this includes sending data out to users).
set/debug rbnskim shows the process of determining the "one true frequency" of
a spot, by running a weighed "auction" of all the spotters's performance
in previous "auctions". A spotter's frequency "score" can be between 5 and -5
(good -> bad) and that is added to each version of the frequency that is
sent by the RBN. The frequency with the highest score is the one posted.
It is the 'QRGScore' in the "progress" spot message.
print_all_fields cltounix unpad is_callsign is_latlong
is_qra is_freq is_digits is_pctext is_pcflag insertitem deleteitem
is_prefix dd is_ipaddr $pi $d2r $r2d localdata localdata_mv
print_all_fields cltounix unpad is_callsign is_latlong
is_qra is_freq is_digits is_pctext is_pcflag insertitem deleteitem
is_prefix dd is_ipaddr $pi $d2r $r2d localdata localdata_mv
- diffms _diffms difft parraydifft is_ztime
+ diffms _diffms _diffus difft parraydifft is_ztime
+# and in microseconds
+sub _diffus
+{
+ my $ta = shift;
+ my $tb = shift || [gettimeofday];
+ my $a = int($ta->[0] * 1000000) + int($ta->[1]);
+ my $b = int($tb->[0] * 1000000) + int($tb->[1]);
+ return $b - $a;
+}
+
sub diffms
{
my $call = shift;
sub diffms
{
my $call = shift;
my $json;
my $noinrush = 0; # override the inrushpreventor if set
my $json;
my $noinrush = 0; # override the inrushpreventor if set
-our $maxdeviants = 10; # the number of deviant QRGs to record for skimmer records
+our $maxdeviants = 5; # the number of deviant QRGs to record for skimmer records
{
foreach my $dxchan (DXChannel::get_all()) {
next unless $dxchan->is_rbn;
{
foreach my $dxchan (DXChannel::get_all()) {
next unless $dxchan->is_rbn;
# At this point we run the queue to see if anything can be sent onwards to the punter
my $now = $main::systime;
# At this point we run the queue to see if anything can be sent onwards to the punter
my $now = $main::systime;
+ my $ta = [gettimeofday];
+ my $items;
+
# now run the waiting queue which just contains KEYS ($call|$qrg)
foreach my $sp (keys %{$dxchan->{queue}}) {
my $cand = $spots->{$sp};
# now run the waiting queue which just contains KEYS ($call|$qrg)
foreach my $sp (keys %{$dxchan->{queue}}) {
my $cand = $spots->{$sp};
unless ($cand && $cand->[CTime]) {
dbg "RBN Cand $sp " . ($cand ? 'def' : 'undef') . " [CTime] " . ($cand->[CTime] ? 'def' : 'undef') . " dwell $dwelltime";
next;
unless ($cand && $cand->[CTime]) {
dbg "RBN Cand $sp " . ($cand ? 'def' : 'undef') . " [CTime] " . ($cand->[CTime] ? 'def' : 'undef') . " dwell $dwelltime";
next;
--$skimmer->[DGood] if $skimmer->[DGood] > 0;
push @deviant, sprintf("$r->[ROrigin]:%+.1f", $diff);
push @{$skimmer->[DEviants]}, $diff;
--$skimmer->[DGood] if $skimmer->[DGood] > 0;
push @deviant, sprintf("$r->[ROrigin]:%+.1f", $diff);
push @{$skimmer->[DEviants]}, $diff;
- shift @{$skimmer->[DEviants]} if @{$skimmer->[DEviants]} > $maxdeviants;
+ shift @{$skimmer->[DEviants]} while @{$skimmer->[DEviants]} > $maxdeviants;
} else {
++$skimmer->[DGood] if $skimmer->[DGood] < $maxdeviants;
--$skimmer->[DBad] if $skimmer->[DBad] > 0;
shift @{$skimmer->[DEviants]};
}
} else {
++$skimmer->[DGood] if $skimmer->[DGood] < $maxdeviants;
--$skimmer->[DBad] if $skimmer->[DBad] > 0;
shift @{$skimmer->[DEviants]};
}
- $skimmer->[DScore] = ($skimmer->[DBad] != 0) ? $skimmer->[DGood] / $skimmer->[DBad] : $skimmer->[DGood];
+ $skimmer->[DScore] = $skimmer->[DGood] - $skimmer->[DBad];
$skimmer->[DScore] ||= 0.2; # minimun score
$skimmer->[DScore] ||= 0.2; # minimun score
- $skimmer->[DScore] = $maxdeviants if $skimmer->[DScore] > $maxdeviants;
dbg("RBN:SKIM key $sp slot $sk $r->[RQrg] - $qrg = $diff " . $json->encode($skimmer)) if isdbg('rbnskim');
$skimmer->[DLastin] = $now;
$r->[RSpotData]->[SQrg] = $qrg if $qrg && $c > 1; # set all the QRGs to the agreed value
dbg("RBN:SKIM key $sp slot $sk $r->[RQrg] - $qrg = $diff " . $json->encode($skimmer)) if isdbg('rbnskim');
$skimmer->[DLastin] = $now;
$r->[RSpotData]->[SQrg] = $qrg if $qrg && $c > 1; # set all the QRGs to the agreed value
dbg sprintf("RBN: QUEUE key: '$sp' SEND time not yet reached %.1f secs left", $cand->[CTime] + $dwelltime - $now) if isdbg 'rbnqueue';
}
}
dbg sprintf("RBN: QUEUE key: '$sp' SEND time not yet reached %.1f secs left", $cand->[CTime] + $dwelltime - $now) if isdbg 'rbnqueue';
}
}
+ if (isdbg('rbntimer')) {
+ my $diff = _diffus($ta);
+ dbg "RBN: TIMER process queue for call: $dxchan->{call} $items spots $diff uS";
+ }
while (my ($k, $cand) = each %$spots) {
next if $k eq 'VERSION';
next if $k =~ /^O\|/;
while (my ($k, $cand) = each %$spots) {
next if $k eq 'VERSION';
next if $k =~ /^O\|/;
+ next if $k =~ /^SKIM\|/;
if (@$cand > CData) {
$spots->{$k} = [$cand->[CTime], $cand->[CQual]];
}
if (@$cand > CData) {
$spots->{$k} = [$cand->[CTime], $cand->[CQual]];
}