Add caching days per month timeline

sql-rework
Tomasz Golinski 2020-07-06 00:01:26 +02:00
rodzic 37f945c70a
commit a2e4fd3acf
1 zmienionych plików z 24 dodań i 0 usunięć

Wyświetl plik

@ -420,6 +420,30 @@ int main(int argc, char** argv) {
}
std::cout << "</table>\n";
std::cout << "<h2>Caching days per month</h2>\n";
std::cout << "<table class=\"calendar_tab\">\n";
std::cout << "<tr><th></th>";
for (int j = 1; j <= 12; j++) { // print table month headers
std::cout << "<th>" << j << "</th>";
}
std::cout << "</tr>\n";
max = 31; // maximal value for histogram
for (int i = y_min; i <= y_max; i++) { // i -> years in rows
std::cout << "<tr><th>" << i + 1900 << "</th> ";
for (int j = 1; j <= 12; j++) { // j -> months in cols
std::map<int, int> dates;
for (auto el : cc) {
if (el.date_tm.tm_mon == j - 1 && el.date_tm.tm_year == i)
dates[el.date_tm.tm_mday]++;
}
std::cout << "<td style=\"--percent: " << dates.size() * 100 / max << "%\"><span>" << dates.size() << "</span></td>";
}
std::cout << "</tr>\n";
}
std::cout << "</table>\n";
// auto far = std::max_element(fcc.begin(), fcc.end(), [&](const Cache& a, const Cache& b) { return a.distance() < b.distance(); });
// auto near = std::min_element(fcc.begin(), fcc.end(), [&](const Cache& a, const Cache& b) { return a.distance() < b.distance(); });
//