[hamradio-commits] [dump1090] 126/373: Make stats gathering	conditional on Modes.stats
    Matthew Ernisse 
    mernisse-guest at moszumanska.debian.org
       
    Thu Oct 23 14:58:12 UTC 2014
    
    
  
This is an automated email from the git hooks/post-receive script.
mernisse-guest pushed a commit to branch backport
in repository dump1090.
commit a296f2783fb3e2afbd0b411d9119d94f55839da5
Author: Malcolm Robb <Support at ATTAvionics.com>
Date:   Tue Apr 30 10:46:23 2013 +0100
    Make stats gathering conditional on Modes.stats
    
    There is a quite complex if/else construct for gathering statistics
    inside the main decodeModeS loop. To speed the loop up when not
    gathering statistics, make the whole construct conditional on Modes.stat
    being set.
    
    Also tidy up a few comments
---
 dump1090.c | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/dump1090.c b/dump1090.c
index 2b5b52a..d2d5808 100644
--- a/dump1090.c
+++ b/dump1090.c
@@ -2021,25 +2021,25 @@ void detectModeS(uint16_t *m, uint32_t mlen) {
             // Decode the received message
             decodeModesMessage(&mm, msg);
 
-            /* Update statistics. */
-            if (mm.crcok || use_correction) {
-                if (errors == 0) Modes.stat_demodulated++;
-                if (mm.errorbit == -1) {
-                    if (mm.crcok)
-                        Modes.stat_goodcrc++;
-                    else
+            // Update statistics
+            if (Modes.stats) {
+                if (mm.crcok || use_correction) {
+                    if (errors == 0) Modes.stat_demodulated++;
+                    if (mm.errorbit == -1) {
+                        if (mm.crcok) {Modes.stat_goodcrc++;}
+                        else          {Modes.stat_badcrc++;}
+                    } else {
                         Modes.stat_badcrc++;
-                } else {
-                    Modes.stat_badcrc++;
-                    Modes.stat_fixed++;
-                    if (mm.errorbit < MODES_LONG_MSG_BITS)
-                        Modes.stat_single_bit_fix++;
-                    else
-                        Modes.stat_two_bits_fix++;
+                        Modes.stat_fixed++;
+                        if (mm.errorbit < MODES_LONG_MSG_BITS)
+                            {Modes.stat_single_bit_fix++;}
+                        else
+                            {Modes.stat_two_bits_fix++;}
+                    }
                 }
             }
 
-            /* Output debug mode info if needed. */
+            // Output debug mode info if needed
             if (use_correction) {
                 if (Modes.debug & MODES_DEBUG_DEMOD)
                     dumpRawMessage("Demodulated with 0 errors", msg, m, j);
@@ -2052,7 +2052,7 @@ void detectModeS(uint16_t *m, uint32_t mlen) {
                     dumpRawMessage("Decoded with good CRC", msg, m, j);
             }
 
-            /* Skip this message if we are sure it's fine. */
+            // Skip this message if we are sure it's fine
             if (mm.crcok) {
                 j += (MODES_PREAMBLE_US+msglen)*2;
                 good_message = 1;
@@ -2060,7 +2060,7 @@ void detectModeS(uint16_t *m, uint32_t mlen) {
                     mm.phase_corrected = 1;
             }
 
-            /* Pass data to the next layer */
+            // Pass data to the next layer
             useModesMessage(&mm);
 
         } else {
-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-hamradio/dump1090.git
    
    
More information about the pkg-hamradio-commits
mailing list