| 212 | } |
| 213 | |
| 214 | void Statistics::Print(std::ostream& out) { // NOLINT |
| 215 | const map_t& tag_map = Instance().tag_map_; |
| 216 | |
| 217 | if (tag_map.empty()) { |
| 218 | return; |
| 219 | } |
| 220 | |
| 221 | out << "Statistics\n"; |
| 222 | |
| 223 | out.width((std::streamsize)Instance().max_tag_length_); |
| 224 | out.setf(std::ios::left, std::ios::adjustfield); |
| 225 | out << "-----------"; |
| 226 | out.width(7); |
| 227 | out.setf(std::ios::right, std::ios::adjustfield); |
| 228 | out << "#\t"; |
| 229 | out << "Log Hz\t"; |
| 230 | out << "{avg +- std }\t"; |
| 231 | out << "[min,max]\n"; |
| 232 | |
| 233 | for (const typename map_t::value_type& t : tag_map) { |
| 234 | size_t i = t.second; |
| 235 | out.width((std::streamsize)Instance().max_tag_length_); |
| 236 | out.setf(std::ios::left, std::ios::adjustfield); |
| 237 | // Print Name of tag |
| 238 | out << t.first << "\t"; |
| 239 | |
| 240 | out.setf(std::ios::right, std::ios::adjustfield); |
| 241 | // Print # |
| 242 | out << std::setw(5) << GetNumSamples(i) << "\t"; |
| 243 | if (GetNumSamples(i) > 0) { |
| 244 | out << std::showpoint << GetHz(i) << "\t"; |
| 245 | double mean = GetMean(i); |
| 246 | double stddev = sqrt(GetVariance(i)); |
| 247 | out << "{" << std::showpoint << mean; |
| 248 | out << " +- "; |
| 249 | out << std::showpoint << stddev << "}\t"; |
| 250 | |
| 251 | double min_value = GetMin(i); |
| 252 | double max_value = GetMax(i); |
| 253 | |
| 254 | // out.width(5); |
| 255 | out << std::noshowpoint << "[" << min_value << "," << max_value << "]"; |
| 256 | } |
| 257 | out << std::endl; |
| 258 | } |
| 259 | } |
| 260 | |
| 261 | void Statistics::WriteAllSamplesToCsvFile(const std::string& path) { |
| 262 | const map_t& tag_map = Instance().tag_map_; |