From 5150edc41c1eb5845625f75cb7c8a5975a624c4c Mon Sep 17 00:00:00 2001 From: Unbewohnte Date: Mon, 23 Jan 2023 17:38:16 +0300 Subject: [PATCH] Real pages/sec calculation and output --- src/main.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main.go b/src/main.go index 5722c66..895039d 100644 --- a/src/main.go +++ b/src/main.go @@ -39,7 +39,7 @@ import ( "unbewohnte/wecr/worker" ) -const version = "v0.2.2" +const version = "v0.2.3" const ( defaultConfigFile string = "conf.json" @@ -368,19 +368,20 @@ func main() { // if logs are not used or are printed to the file - output a nice statistics message on the screen if !conf.Logging.OutputLogs || (conf.Logging.OutputLogs && conf.Logging.LogsFile != "") { go func() { + var lastPagesVisited uint64 = 0 fmt.Printf("\n") for { time.Sleep(time.Second) timeSince := time.Since(workerPool.Stats.StartTime).Round(time.Second) - fmt.Fprintf(os.Stdout, "\r[%s] %d pages visited; %d pages saved; %d matches (%d pages/sec)", timeSince.String(), workerPool.Stats.PagesVisited, workerPool.Stats.PagesSaved, workerPool.Stats.MatchesFound, - workerPool.Stats.PagesVisited/uint64(timeSince.Seconds()), + workerPool.Stats.PagesVisited-lastPagesVisited, ) + lastPagesVisited = workerPool.Stats.PagesVisited } }() }