Skip to content

Commit

Permalink
Print total calls as part of the stats on exit
Browse files Browse the repository at this point in the history
Echidna will now print the number of calls done as part of the stats
printed when exiting.

    Unique instructions: 287
    Unique codehashes: 1
    Corpus size: 1
    Seed: 830942768189866820
    Total calls: 10

Closes #1322
  • Loading branch information
elopez committed Dec 3, 2024
1 parent 740e950 commit 162b986
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/Echidna/UI/Report.hs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ ppCampaignEventLog vm ev = (ppCampaignEvent ev <>) <$> ppTxIfHas where
(WorkerEvent _ _ (TestFalsified test)) -> ("\n Call sequence:\n" <>) . unlines <$> mapM (ppTx vm $ length (nub $ (.src) <$> test.reproducer) /= 1) test.reproducer
_ -> pure ""

ppTotalCalls :: [WorkerState] -> String
ppTotalCalls workerStates = "Total calls: " <> show calls
where
calls = sum $ (.ncalls) <$> workerStates

ppCampaign :: (MonadIO m, MonadReader Env m) => VM Concrete RealWorld -> [WorkerState] -> m String
ppCampaign vm workerStates = do
tests <- liftIO . traverse readIORef =<< asks (.testRefs)
Expand All @@ -51,12 +56,14 @@ ppCampaign vm workerStates = do
coveragePrinted <- ppCoverage
let seedPrinted = "Seed: " <> show (head workerStates).genDict.defSeed
corpusPrinted <- ppCorpus
let callsPrinted = ppTotalCalls workerStates
pure $ unlines
[ testsPrinted
, gasInfoPrinted
, coveragePrinted
, corpusPrinted
, seedPrinted
, callsPrinted
]

-- | Given rules for pretty-printing associated addresses, and whether to print
Expand Down

0 comments on commit 162b986

Please sign in to comment.