| 106 | } |
| 107 | |
| 108 | std::string_view setColorForBytesBasedMetricsProgress(double progress) |
| 109 | { |
| 110 | constexpr std::array<std::string_view, 7> colors = { |
| 111 | "\033[38;5;236m", /// Dark Grey |
| 112 | "\033[38;5;250m", /// Light Grey |
| 113 | "\033[38;5;34m", /// Green |
| 114 | "\033[38;5;226m", /// Yellow |
| 115 | "\033[38;5;208m", /// Orange |
| 116 | "\033[1;33m", /// Bold |
| 117 | "\033[38;5;160m", /// Red: corresponds to >= 1T/s. Not a practical scenario. |
| 118 | }; |
| 119 | |
| 120 | /// Bytes. |
| 121 | constexpr std::array<uint64_t, 6> thresholds = { |
| 122 | 1LL << 20, |
| 123 | 100LL << 20, |
| 124 | 1'000LL << 20, |
| 125 | 10'000LL << 20, |
| 126 | 100'000LL << 20, |
| 127 | 1'000'000LL << 20, |
| 128 | }; |
| 129 | |
| 130 | auto dist = std::upper_bound(thresholds.begin(), thresholds.end(), progress) - thresholds.begin(); |
| 131 | return colors[dist]; |
| 132 | } |
| 133 | |
| 134 | std::string_view setColorForTimeBasedMetricsProgress(ProfileEvents::ValueType value_type, double progress) |
| 135 | { |
no test coverage detected