51 double averageTime(
const std::list<std::pair<double, double>> &vals)
57 std::vector<std::pair<double, unsigned>> *vec1 =
new std::vector<std::pair<double, unsigned>>();
58 std::vector<std::pair<double, unsigned>> *vec2 =
new std::vector<std::pair<double, unsigned>>();
59 vec1->reserve(vals.size() / 4 + 1);
60 vec2->reserve(vals.size() / 4 + 1);
64 for (
auto iter = vals.begin(); iter != vals.end(); iter++)
68 vec1->push_back(std::make_pair(sum, count));
72 sum = sum + (iter->second - iter->first);
76 vec1->push_back(std::make_pair(sum, count));
78 while (vec1->size() > 1)
84 while (iter < vec1->size())
88 vec2->push_back(std::make_pair(sum, count));
93 auto p = (*vec1)[iter++];
99 vec2->push_back(std::make_pair(sum, count));
108 return vec1->front().first / vec1->front().second;
double averageTime(const std::list< std::pair< double, double >> &vals)
Page Table Entry (PTE) defines the composition of Page Frame Number (PFN) and relavant flags.
#define NAN
A constant expression of type float representing a quiet NaN.
void swap(T &lhs, T &rhs)