~ubuntu-branches/ubuntu/utopic/kde4libs/utopic

« back to all changes in this revision

Viewing changes to kdecore/util/kshareddatacache.cpp

  • Committer: Package Import Robot
  • Author(s): Jonathan Kolberg
  • Date: 2012-03-03 00:25:28 UTC
  • mfrom: (1.14.15)
  • Revision ID: package-import@ubuntu.com-20120303002528-chhwyfluldkicy5k
Tags: 4:4.8.1-0ubuntu1
* New upstream release
  - Update symbol files

Show diffs side-by-side

added added

removed removed

Lines of Context:
1367
1367
    static double mustCullPoint = 0.96l;
1368
1368
 
1369
1369
    // cacheAvail is in pages, cacheSize is in bytes.
1370
 
    double loadFactor = (1.0l * d->shm->cacheAvail * d->shm->cachePageSize()
 
1370
    double loadFactor = 1.0 - (1.0l * d->shm->cacheAvail * d->shm->cachePageSize()
1371
1371
                              / d->shm->cacheSize);
1372
1372
    bool cullCollisions = false;
1373
1373
 
1374
1374
    if (KDE_ISUNLIKELY(loadFactor >= mustCullPoint)) {
1375
1375
        cullCollisions = true;
1376
1376
    }
1377
 
    else {
1378
 
        int tripWireValue = RAND_MAX * (loadFactor - startCullPoint) / (mustCullPoint - startCullPoint);
 
1377
    else if (loadFactor > startCullPoint) {
 
1378
        const int tripWireValue = RAND_MAX * (loadFactor - startCullPoint) / (mustCullPoint - startCullPoint);
1379
1379
        if (KRandom::random() >= tripWireValue) {
1380
1380
            cullCollisions = true;
1381
1381
        }