uint64_t
MemStore::currentSize() const
{
- return theCurrentSize >> 10;
+ return theCurrentSize;
}
uint64_t
/** The minimum size the store will shrink to via normal housekeeping */
virtual uint64_t minSize() const = 0;
- /** current store size in kiloBytes */
- virtual uint64_t currentSize() const = 0; // TODO: return size in bytes
+ /** current store size */
+ virtual uint64_t currentSize() const = 0;
/** the total number of objects stored */
virtual uint64_t currentCount() const = 0;
virtual uint64_t minSize() const;
- virtual uint64_t currentSize() const { return cur_size; }
+ virtual uint64_t currentSize() const { return cur_size << 10; }
virtual uint64_t currentCount() const { return n_disk_objects; }
#include "Parsing.h"
#include <iomanip>
#include "MemObject.h"
+#include "SquidMath.h"
#include "base/RunnersRegistry.h"
#include "DiskIO/DiskIOModule.h"
#include "DiskIO/DiskIOStrategy.h"
uint64_t
Rock::SwapDir::currentSize() const
{
- return (HeaderSize + max_objsize * currentCount()) >> 10;
+ return HeaderSize + max_objsize * currentCount();
}
uint64_t
return;
debugs(47,3, HERE << "cache_dir[" << index << "] state: " << map->full() <<
- ' ' << (currentSize() << 10) << " < " << diskOffsetLimit());
+ ' ' << currentSize() << " < " << diskOffsetLimit());
// Hopefully, we find a removable entry much sooner (TODO: use time?)
const int maxProbed = 10000;
void
Rock::SwapDir::statfs(StoreEntry &e) const
{
+ const double currentSizeInKB = currentSize() / 1024.0;
storeAppendPrintf(&e, "\n");
storeAppendPrintf(&e, "Maximum Size: %"PRIu64" KB\n", max_size);
- storeAppendPrintf(&e, "Current Size: %"PRIu64" KB %.2f%%\n",
- currentSize(), 100.0 * currentSize() / max_size);
+ storeAppendPrintf(&e, "Current Size: %.2f KB %.2f%%\n",
+ currentSizeInKB,
+ Math::doublePercent(currentSizeInKB, max_size));
if (map) {
const int limit = map->entryLimit();
case SYSSTOR:
Answer = snmp_var_new_integer(Var->name, Var->name_length,
- Store::Root().currentSize(),
+ Store::Root().currentSize() >> 10,
ASN_INTEGER);
break;
case PERF_PROTOSTAT_AGGR_CURSWAP:
Answer = snmp_var_new_integer(Var->name, Var->name_length,
- (snint) Store::Root().currentSize(),
+ (snint) Store::Root().currentSize() >> 10,
SMI_GAUGE32);
break;
stats.request_hit_disk_ratio5 = statRequestHitDiskRatio(5);
stats.request_hit_disk_ratio60 = statRequestHitDiskRatio(60);
- stats.store_swap_size = Store::Root().currentSize();
+ stats.store_swap_size = Store::Root().currentSize() / 1024.0;
stats.store_swap_max_size = Store::Root().maxSize();
stats.store_mem_size = mem_node::StoreMemSize();
stats.n_disk_objects = Store::Root().currentCount();
stats.objects_size = stats.n_disk_objects > 0 ?
- (double)Store::Root().currentSize() / stats.n_disk_objects : 0.0;
+ stats.store_swap_size / stats.n_disk_objects : 0.0;
stats.unlink_requests = statCounter.unlink.requests;
* number of _entries_ we want to pre-allocate for.
*/
const int hi_cap = Store::Root().maxSize() / Config.Store.avgObjectSize;
- const int lo_cap = 1 + Store::Root().currentSize() / Config.Store.avgObjectSize;
+ const int lo_cap = 1 + (Store::Root().currentSize() >> 10) / Config.Store.avgObjectSize;
const int e_count = StoreEntry::inUseCount();
int cap = e_count ? e_count :hi_cap;
debugs(71, 2, "storeDigestCalcCap: have: " << e_count << ", want " << cap <<
void
StoreController::stat(StoreEntry &output) const
{
+ const double currentSizeInKB = currentSize() / 1024.0;
storeAppendPrintf(&output, "Store Directory Statistics:\n");
storeAppendPrintf(&output, "Store Entries : %lu\n",
(unsigned long int)StoreEntry::inUseCount());
storeAppendPrintf(&output, "Maximum Swap Size : %"PRIu64" KB\n",
maxSize());
- storeAppendPrintf(&output, "Current Store Swap Size: %"PRIu64" KB\n",
- currentSize());
- storeAppendPrintf(&output, "Current Capacity : %"PRId64"%% used, %"PRId64"%% free\n",
- Math::int64Percent(currentSize(), maxSize()),
- Math::int64Percent((maxSize() - currentSize()), maxSize()));
+ storeAppendPrintf(&output, "Current Store Swap Size: %.2f KB\n",
+ currentSizeInKB);
+ storeAppendPrintf(&output, "Current Capacity : %.2f%% used, %.2f%% free\n",
+ Math::doublePercent(currentSizeInKB, maxSize()),
+ Math::doublePercent((maxSize() - currentSizeInKB), maxSize()));
if (memStore)
memStore->stat(output);
if (currentSearch->isDone()) {
debugs(20, 1, " Completed Validation Procedure");
debugs(20, 1, " Validated " << validated << " Entries");
- debugs(20, 1, " store_swap_size = " << Store::Root().currentSize());
+ debugs(20, 1, " store_swap_size = " << Store::Root().currentSize() / 1024.0 << " KB");
StoreController::store_dirs_rebuilding--;
assert(0 == StoreController::store_dirs_rebuilding);