From eceb418be84f6271c10e374281c1a8379647679b Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 18 Jun 2014 08:51:59 +0200 Subject: improve formating of the hash stats --- cmdline/apt-cache.cc | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc index a620740e1..072cf4ef7 100644 --- a/cmdline/apt-cache.cc +++ b/cmdline/apt-cache.cc @@ -374,7 +374,7 @@ static bool Stats(CommandLine &) Cache->Head().ProvidesCount*Cache->Head().ProvidesSz; cout << _("Total space accounted for: ") << SizeToStr(Total) << endl; - // get the hash collisions average + // hashtable stats for the PkgHashTable long NumBuckets = sizeof(Cache->HeaderP->PkgHashTable)/sizeof(map_ptrloc); long UsedBuckets = 0; long UnusedBuckets = 0; @@ -395,14 +395,14 @@ static bool Stats(CommandLine &) ShortestBucket = std::min(ThisBucketSize, ShortestBucket); UsedBuckets += ThisBucketSize; } - cout << _("Pkg Hashtable stats:") << endl; - cout << _("Number of buckets: ") << SizeToStr(NumBuckets) << endl; - cout << _("Unused buckets: ") << SizeToStr(UnusedBuckets) << endl; - cout << _("Used buckets: ") << UsedBuckets << endl; - cout << _("Average num entries per bucket : ") << UsedBuckets/(double)NumBuckets << endl; - cout << _("Longest / Shortest bucket: ") << LongestBucket << " / " << ShortestBucket << endl; - - // get the hash collisions average + cout << "Total PkgHashTable buckets: " << SizeToStr(NumBuckets) << std::endl; + cout << " Unused: " << SizeToStr(UnusedBuckets) << std::endl; + cout << " Used: " << UsedBuckets << std::endl; + cout << " Average entries: " << UsedBuckets/(double)NumBuckets << std::endl; + cout << " Longest: " << LongestBucket << std::endl; + cout << " Shortest: " << ShortestBucket << std::endl; + + // hashtable stats for the GrpHashTable NumBuckets = sizeof(Cache->HeaderP->GrpHashTable)/sizeof(map_ptrloc); UsedBuckets = 0; UnusedBuckets = 0; @@ -423,12 +423,12 @@ static bool Stats(CommandLine &) ShortestBucket = std::min(ThisBucketSize, ShortestBucket); UsedBuckets += ThisBucketSize; } - cout << _("Grp Hashtable stats:") << endl; - cout << _("Number of buckets: ") << SizeToStr(NumBuckets) << endl; - cout << _("Unused buckets: ") << SizeToStr(UnusedBuckets) << endl; - cout << _("Used buckets: ") << UsedBuckets << endl; - cout << _("Average num entries per bucket : ") << UsedBuckets/(double)NumBuckets << endl; - cout << _("Longest / Shortest bucket: ") << LongestBucket << " / " << ShortestBucket << endl; + cout << "Total GrpHashTable buckets: " << SizeToStr(NumBuckets) << std::endl; + cout << " Unused: " << SizeToStr(UnusedBuckets) << std::endl; + cout << " Used: " << UsedBuckets << std::endl; + cout << " Average entries: " << UsedBuckets/(double)NumBuckets << std::endl; + cout << " Longest: " << LongestBucket << std::endl; + cout << " Shortest: " << ShortestBucket << std::endl; return true; } -- cgit v1.2.3