debugdiscovery: small internal refactoring
The part of the code displaying statistic is made independant from the one
running the discovery. In the same do, the declaration of the discovery
function is a bit simplified.
local test passed
addgroupcopy test passed
clone test passed
lowlevelcopy test passed
slicing test passed
issnapshot test passed
findsnapshot test passed