logswan

Fast Web log analyzer using probabilistic data structures
Log | Files | Refs | README | LICENSE

commit 7e6e20b7ab1f1a38fe8ed84b2839a9e8ebf750db
parent 2f41eb77410e971557c7cb63b65271d813dc309e
Author: Frederic Cambus <fred@statdns.com>
Date:   Sat,  9 Jan 2016 17:49:53 +0100

Do not increment hits and processed lines counter for each parsed line, compute total when everything is parsed

Diffstat:
Msrc/logswan.c | 11+++++------
1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/logswan.c b/src/logswan.c @@ -5,7 +5,7 @@ /* http://www.logswan.org */ /* */ /* Created: 2015-05-31 */ -/* Last Updated: 2016-01-08 */ +/* Last Updated: 2016-01-09 */ /* */ /* Logswan is released under the BSD 3-Clause license. */ /* See LICENSE file for details. */ @@ -226,17 +226,16 @@ int main (int argc, char *argv[]) { /* Increment hits counter */ results.hitsIPv4 += isIPv4; results.hitsIPv6 += isIPv6; - results.hits++; } else { /* Invalid line */ - results.invalidLines++; } - - /* Increment processed lines counter */ - results.processedLines++; } + /* Counting hits and processed lines */ + results.hits = results.hitsIPv4 + results.hitsIPv6; + results.processedLines = results.hits + results.invalidLines; + /* Counting unique visitors */ results.visitsIPv4 = hll_count(&uniqueIPv4); results.visitsIPv6 = hll_count(&uniqueIPv6);