~ubuntu-branches/ubuntu/oneiric/squid3/oneiric-security

« back to all changes in this revision

Viewing changes to src/store_dir.cc

  • Committer: Bazaar Package Importer
  • Author(s): Mahyuddin Susanto
  • Date: 2011-02-15 18:46:13 UTC
  • mfrom: (21.2.4 sid)
  • Revision ID: james.westby@ubuntu.com-20110215184613-1u3dh5sz4i055flk
Tags: 3.1.10-1ubuntu1
* Merge from debian unstable. (LP: #719283)  Remaining changes:
  - debian/patches/18-fix-ftbfs-binutils-gold.dpatch: Add library linker into
    LIBS instead to LDFLAGS to fixing FTBFS binutils-gold.
* Drop Ubuntu configuration for ufw which landed in Debian and sync it: 
  - debian/squid3.ufw.profile.

Show diffs side-by-side

added added

removed removed

Lines of Context:
343
343
void
344
344
SwapDir::updateSize(int64_t size, int sign)
345
345
{
346
 
    int blks = (size + fs.blksize - 1) / fs.blksize;
347
 
    int k = (blks * fs.blksize >> 10) * sign;
 
346
    int64_t blks = (size + fs.blksize - 1) / fs.blksize;
 
347
    int64_t k = ((blks * fs.blksize) >> 10) * sign;
348
348
    cur_size += k;
349
349
    store_swap_size += k;
350
350
 
360
360
    storeAppendPrintf(&output, "Store Directory Statistics:\n");
361
361
    storeAppendPrintf(&output, "Store Entries          : %lu\n",
362
362
                      (unsigned long int)StoreEntry::inUseCount());
363
 
    storeAppendPrintf(&output, "Maximum Swap Size      : %8ld KB\n",
364
 
                      (long int) maxSize());
 
363
    storeAppendPrintf(&output, "Maximum Swap Size      : %"PRIu64" KB\n",
 
364
                      maxSize());
365
365
    storeAppendPrintf(&output, "Current Store Swap Size: %8lu KB\n",
366
366
                      store_swap_size);
367
 
    storeAppendPrintf(&output, "Current Capacity       : %d%% used, %d%% free\n",
368
 
                      Math::intPercent((int) store_swap_size, (int) maxSize()),
369
 
                      Math::intPercent((int) (maxSize() - store_swap_size), (int) maxSize()));
 
367
    storeAppendPrintf(&output, "Current Capacity       : %"PRId64"%% used, %"PRId64"%% free\n",
 
368
                      Math::int64Percent(store_swap_size, maxSize()),
 
369
                      Math::int64Percent((maxSize() - store_swap_size), maxSize()));
370
370
    /* FIXME Here we should output memory statistics */
371
371
 
372
372
    /* now the swapDir */
374
374
}
375
375
 
376
376
/* if needed, this could be taught to cache the result */
377
 
size_t
 
377
uint64_t
378
378
StoreController::maxSize() const
379
379
{
380
380
    /* TODO: include memory cache ? */
381
381
    return swapDir->maxSize();
382
382
}
383
383
 
384
 
size_t
 
384
uint64_t
385
385
StoreController::minSize() const
386
386
{
387
387
    /* TODO: include memory cache ? */
827
827
    }
828
828
}
829
829
 
830
 
size_t
 
830
uint64_t
831
831
StoreHashIndex::maxSize() const
832
832
{
833
 
    int i;
834
 
    size_t result = 0;
 
833
    uint64_t result = 0;
835
834
 
836
 
    for (i = 0; i < Config.cacheSwap.n_configured; i++)
 
835
    for (int i = 0; i < Config.cacheSwap.n_configured; i++)
837
836
        result += store(i)->maxSize();
838
837
 
839
838
    return result;
840
839
}
841
840
 
842
 
size_t
 
841
uint64_t
843
842
StoreHashIndex::minSize() const
844
843
{
845
 
    size_t result = 0;
 
844
    uint64_t result = 0;
846
845
 
847
846
    for (int i = 0; i < Config.cacheSwap.n_configured; i++)
848
847
        result += store(i)->minSize();