info: Changed sorting of numcopies stats table, so it's ordered by the variance from the desired number of copies.

Compare these...

numcopies stats:
	numcopies -1: 1986
	numcopies +0: 1170
	numcopies -2: 769
	numcopies +1: 716
	numcopies -4: 696
	numcopies -3: 485
	numcopies -6: 230
	numcopies -5: 111
	numcopies -7: 91
	numcopies -9: 9

numcopies stats:
	numcopies +1: 716
	numcopies +0: 1170
	numcopies -1: 1986
	numcopies -2: 769
	numcopies -3: 485
	numcopies -4: 696
	numcopies -5: 111
	numcopies -6: 230
	numcopies -7: 91
	numcopies -9: 9

I feel that the former is a jumbled mess that doesn't tell much overall,
while the second shows pretty clearly that most files are within 1 degree
of the desired number of copies, with some outliers without enough.
This commit is contained in:
Joey Hess 2018-04-05 14:54:39 -04:00
parent 817ebb5765
commit 6cb5b7294f
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 3 additions and 1 deletions

View file

@ -16,6 +16,8 @@ git-annex (6.20180317) UNRELEASED; urgency=medium
uses http-conduit. uses http-conduit.
* info: Added "combined size of repositories containing these files" * info: Added "combined size of repositories containing these files"
stat when run on a directory. stat when run on a directory.
* info: Changed sorting of numcopies stats table, so it's ordered
by the variance from the desired number of copies.
-- Joey Hess <id@joeyh.name> Mon, 19 Mar 2018 23:13:59 -0400 -- Joey Hess <id@joeyh.name> Mon, 19 Mar 2018 23:13:59 -0400

View file

@ -477,7 +477,7 @@ numcopies_stats = stat "numcopies stats" $ json fmt $
calc <$> (maybe M.empty numCopiesVarianceMap <$> cachedNumCopiesStats) calc <$> (maybe M.empty numCopiesVarianceMap <$> cachedNumCopiesStats)
where where
calc = map (\(variance, count) -> (show variance, count)) calc = map (\(variance, count) -> (show variance, count))
. sortBy (flip (comparing snd)) . sortBy (flip (comparing fst))
. M.toList . M.toList
fmt = multiLine . map (\(variance, count) -> "numcopies " ++ variance ++ ": " ++ show count) fmt = multiLine . map (\(variance, count) -> "numcopies " ++ variance ++ ": " ++ show count)