From: Julian Andres Klode Date: Sun, 3 Jan 2016 16:39:39 +0000 (+0100) Subject: apt-cache: stats: Show a table utilization as percentage X-Git-Tag: 1.2_exp1~43 X-Git-Url: https://git.saurik.com/apt.git/commitdiff_plain/38a5b1ceeeca6ff530a2816a39bcd10d14c85d33 apt-cache: stats: Show a table utilization as percentage Gbp-Dch: ignore --- diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc index 347a0954e..4d8b9bc41 100644 --- a/apt-pkg/pkgcache.cc +++ b/apt-pkg/pkgcache.cc @@ -210,7 +210,7 @@ map_id_t pkgCache::sHash(const string &Str) const { uint32_t Hash = 5381; for (string::const_iterator I = Str.begin(); I != Str.end(); ++I) - Hash = 33 * Hash + tolower_ascii(*I); + Hash = 33 * Hash + tolower_ascii((signed char)*I); return Hash % HeaderP->GetHashTableSize(); } @@ -218,7 +218,7 @@ map_id_t pkgCache::sHash(const char *Str) const { uint32_t Hash = 5381; for (const char *I = Str; *I != 0; ++I) - Hash = 33 * Hash + tolower_ascii(*I); + Hash = 33 * Hash + tolower_ascii((signed char)*I); return Hash % HeaderP->GetHashTableSize(); } diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc index 7139bdeac..481833084 100644 --- a/cmdline/apt-cache.cc +++ b/cmdline/apt-cache.cc @@ -172,6 +172,7 @@ static void ShowHashTableStats(std::string Type, cout << "Total buckets in " << Type << ": " << NumBuckets << std::endl; cout << " Unused: " << UnusedBuckets << std::endl; cout << " Used: " << UsedBuckets << std::endl; + cout << " Utilization: " << 100.0 * UsedBuckets/NumBuckets << "%" << std::endl; cout << " Average entries: " << Entries/(double)UsedBuckets << std::endl; cout << " Longest: " << LongestBucket << std::endl; cout << " Shortest: " << ShortestBucket << std::endl;