<commit_before>#include "solve_mcf.h"
#include <fstream>
#include <algorithm>

void cacheAlg(std::vector<trEntry> & trace) {
    std::sort(trace.begin(), trace.end());
}

void printRes(std::vector<trEntry> & trace, std::string algName, uint64_t cacheSizeMax, std::ofstream * resultfile) {
    uint64_t csize = 0;
    uint64_t nextCsizePrint = 1;
    uint64_t hitc = 0;
    uint64_t reqcDiff = 0;
    for(auto it: trace) {
        if(csize>cacheSizeMax)
            break;
        if(csize>=nextCsizePrint) {
            *resultfile << algName << " " << nextCsizePrint << " " << hitc << " " << trace.size() << " " << (double)hitc/trace.size() << " " << csize << " " << reqcDiff << "\n";
            //            std::cout << algName << " " << csize << " " << hitc << " " << trace.size() << " " << (double)hitc/trace.size() << "\n";
            nextCsizePrint*=2;
            reqcDiff=0;
        }
        if(it.hasNext) {
            hitc++;
            csize += it.volume/trace.size();
            reqcDiff++;
        }
    }
    while(nextCsizePrint < cacheSizeMax/2) {
        *resultfile << algName << " " << nextCsizePrint << " " << hitc << " " << trace.size() << " " << (double)hitc/trace.size() << " " << csize << " " << reqcDiff << "\n";
        nextCsizePrint*=2;<commit_msg>Increased accuracy in PFOO-L: measure normalized volume in long double instead of uint64<commit_after>#include "solve_mcf.h"
#include <fstream>
#include <algorithm>

void cacheAlg(std::vector<trEntry> & trace) {
    std::sort(trace.begin(), trace.end());
}

void printRes(std::vector<trEntry> & trace, std::string algName, uint64_t cacheSizeMax, std::ofstream * resultfile) {
    long double csize = 0;
    long double nextCsizePrint = 1;
    long double lcacheSizeMax = cacheSizeMax;
    long double ltraceSize = trace.size();
    uint64_t hitc = 0;
    uint64_t reqcDiff = 0;
    for(auto it: trace) {
        if(csize> lcacheSizeMax)
            break;
        if(csize>=nextCsizePrint) {
            *resultfile << algName << " " << nextCsizePrint << " " << hitc << " " << trace.size() << " " << (double)hitc/trace.size() << " " << csize << " " << reqcDiff << "\n";
            //            std::cout << algName << " " << csize << " " << hitc << " " << trace.size() << " " << (double)hitc/trace.size() << "\n";
            nextCsizePrint*=2;
            reqcDiff=0;
        }
        if(it.hasNext) {
            hitc++;
            csize += it.volume/ltraceSize;
            reqcDiff++;
        }
    }
    while(nextCsizePrint < lcacheSizeMax/2) {
        *resultfile << algName << " " << nextCsizePrint << " " << hitc << " " << trace.size() << " " << (double)hitc/trace.size() << " " << csize << " " << reqcDiff << "\n";
        nextCsizePrint*=2;
{'fraction_non_alphanumeric': 0.19058050383351588, 'fraction_numerical': 0.012413289521723256, 'mean_word_length': 2.437892095357591, 'pattern_counts': {'":': 0, '<': 165, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4017855', 'n_tokens_mistral': 955, 'n_tokens_neox': 930, 'n_words': 168}