Esempio n. 1
0
void addCache( unsigned int tid, CONTEXT* ctxt, int flags, void* v )
{
    if( tid >= caches.size() )
    {
        caches.resize( tid + 1, nullptr );
    }
    caches[tid] = new Cache( CACHE_SIZE,
                             CACHE_LINE_SIZE,
                             CACHE_ASSOCIATIVITY,
                             &directorySet );
    //cout << "Cache " << tid << " = " << hex << caches[tid] << endl;
}
Esempio n. 2
0
void Gpx::fileParserSucceeded(const CacheList &cacheList) {
  qDebug() << PLUGIN_NAME << __FUNCTION__ << cacheList.size();
  m_cacheList = cacheList;

  emit notifyBusy(false);

  // request map to reload caches
  emit reload();

  // check if parsing actually got us some results and only save
  // the file location then
  if(m_cacheList.size() > 0) {
    // save filename in settings
    QSettings settings;
    settings.beginGroup(PLUGIN_NAME);
    settings.setValue("File", m_fileName);
    settings.endGroup();
  } else
    error(tr("File %1 does not contain any geocaches").arg(m_fileName));
}
Esempio n. 3
0
void finish( int code, void* v )
{
    ofstream file( outputFile.Value().c_str() );
    assert( file.good() );

    file.precision(3);
    file << fixed;
    file << endl;

    file << setw(8) << ""
         << setw(10) << "Total Accesses"
         << setw(11) << "Hit Rate"
         << setw(12) << "Safe Rate"
         //<< setw(15) << "Multiline"
         << setw(13) << "Downgrades"
         << setw(13) << "RSC Flushes"
         << endl;

    unsigned long int totalAccesses = 0;
    unsigned long int totalHits = 0;
    unsigned long int totalSafe = 0;
    unsigned long int totalDowngrades = 0;
    unsigned long int totalRscFlushes = 0;

    map<uintptr_t, unsigned long int> totalDowngradeCount;
    uintptr_t totalTopAddr;
    unsigned long int totalTopCount = 0;

    for( unsigned int i = 0; i < caches.size(); ++i )
    {
        file << "Cache " << i;

        const Cache& c = *caches[i];

        totalAccesses += c.accesses();
        totalHits     += c.hitRate() * c.accesses();
        totalSafe     += c.safeRate() * c.accesses();
        totalDowngrades += c.downgrades();
        totalRscFlushes += c.rscFlushes();

        file << setw(15) << c.accesses()
             << setw(10) << 100.0*c.hitRate() << "%"
             << setw(11) << 100.0*c.safeRate() << "%"
             //<< setw(15) << c.multilineAccesses()
             << setw(13) << c.downgrades()
             << setw(13) << c.rscFlushes()
             /*<< endl*/;

        // Print the most common downgrades from this cache
        const auto& dm = c.downgradeMap( 3 );
        for( auto it = dm.rbegin(); it != dm.rend(); ++it )
        {
            file << " (" << hex << it->second << " : "
                 << fixed << (100.0*it->first/c.downgrades()) << "%)";
        }

        // Add all downgrades into total
        const auto& dc = c.downgradeCount();
        for( auto it = dc.begin(); it != dc.end(); ++it )
        {
            auto curCount = totalDowngradeCount[it->first];
            curCount += it->second;
            if( curCount > totalTopCount )
            {
                totalTopAddr = it->first;
                totalTopCount = curCount;
            }
            totalDowngradeCount[it->first] = curCount;
        }

        file << dec << endl;

        delete caches[i];
    }
    caches.clear();

    file << "Totals ";
    file << setw(15) << totalAccesses
         << setw(10) << 100.0*totalHits/totalAccesses << "%"
         << setw(11) << 100.0*totalSafe/totalAccesses << "%"
         << setw(13) << totalDowngrades
         << setw(13) << totalRscFlushes;

    file << " (" << hex << totalTopAddr << " : "
         << fixed << (100.0*totalTopCount/totalDowngrades) << "%)";

    file << dec << endl << endl;

    directorySet.printStats( file );

    file.close();
}