From e805f85407968aab134c55cb2e43329b4faf5015 Mon Sep 17 00:00:00 2001 From: Michael Krasnyk Date: Mon, 27 Nov 2017 15:19:42 +0100 Subject: [PATCH] Print statistics only for allowed turns --- .../extractor/guidance/statistics_handler.hpp | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/include/extractor/guidance/statistics_handler.hpp b/include/extractor/guidance/statistics_handler.hpp index 32c6ac140..57c767175 100644 --- a/include/extractor/guidance/statistics_handler.hpp +++ b/include/extractor/guidance/statistics_handler.hpp @@ -10,8 +10,8 @@ #include #include #include +#include #include -#include #include @@ -55,7 +55,7 @@ class StatisticsHandler final : public IntersectionHandler for (const auto &kv : type_hist) if (kv.second > 0) - util::Log() << std::fixed << std::setprecision(2) + util::Log() << " " << std::fixed << std::setprecision(2) << internalInstructionTypeToString(kv.first) << ": " << kv.second << " (" << (kv.second / static_cast(num_types) * 100.) << "%)"; @@ -63,7 +63,7 @@ class StatisticsHandler final : public IntersectionHandler for (const auto &kv : modifier_hist) if (kv.second > 0) - util::Log() << std::fixed << std::setprecision(2) + util::Log() << " " << std::fixed << std::setprecision(2) << instructionModifierToString(kv.first) << ": " << kv.second << " (" << (kv.second / static_cast(num_modifiers) * 100.) << "%)"; } @@ -84,12 +84,14 @@ class StatisticsHandler final : public IntersectionHandler // numbers closer to the handlers and see how often handlers ran. for (const auto &road : intersection) { + if (road.entry_allowed) + { + const auto type = road.instruction.type; + const auto modifier = road.instruction.direction_modifier; - const auto type = road.instruction.type; - const auto modifier = road.instruction.direction_modifier; - - type_hist[type] += 1; - modifier_hist[modifier] += 1; + type_hist[type] += 1; + modifier_hist[modifier] += 1; + } } return intersection; @@ -97,8 +99,8 @@ class StatisticsHandler final : public IntersectionHandler private: mutable std::mutex lock; - mutable std::unordered_map type_hist; - mutable std::unordered_map modifier_hist; + mutable std::map type_hist; + mutable std::map modifier_hist; }; } // namespace guidance