diff --git a/include/engine/routing_algorithms/routing_base_ch.hpp b/include/engine/routing_algorithms/routing_base_ch.hpp index ac56c07311e..078c3ee4f02 100644 --- a/include/engine/routing_algorithms/routing_base_ch.hpp +++ b/include/engine/routing_algorithms/routing_base_ch.hpp @@ -232,7 +232,7 @@ void unpackPath(const DataFacade &facade, BidirectionalIterator packed_path_end, Callback &&callback) { - UnpackingStatistics unpacking_cache(0); + UnpackingStatistics unpacking_cache; unpackPath(facade, packed_path_begin, packed_path_end, unpacking_cache, callback); } template @@ -264,13 +264,13 @@ void unpackPath(const DataFacade &facade, if (!std::get<2>(edge)) { - if (unpacking_cache.EdgeInCache(std::make_pair(std::get<0>(edge), std::get<1>(edge)))) + if (unpacking_cache.IsEdgeInCache(std::make_pair(std::get<0>(edge), std::get<1>(edge)))) { std::get<2>(edge) = true; } - if (!std::get<2>(edge)) - unpacking_cache.CollectStats(std::make_pair(std::get<0>(edge), std::get<1>(edge))); + // if (!std::get<2>(edge)) + unpacking_cache.CollectStats(std::make_pair(std::get<0>(edge), std::get<1>(edge))); } // Look for an edge on the forward CH graph (.forward) diff --git a/include/engine/search_engine_data.hpp b/include/engine/search_engine_data.hpp index 291e356791e..9b4c3e151d9 100644 --- a/include/engine/search_engine_data.hpp +++ b/include/engine/search_engine_data.hpp @@ -66,7 +66,7 @@ template <> struct SearchEngineData void InitializeOrClearManyToManyThreadLocalStorage(unsigned number_of_nodes); - void InitializeOrClearUnpackingStatisticsThreadLocalStorage(unsigned number_of_nodes); + void InitializeOrClearUnpackingStatisticsThreadLocalStorage(); }; struct MultiLayerDijkstraHeapData diff --git a/include/engine/unpacking_statistics.hpp b/include/engine/unpacking_statistics.hpp index 0e94b567934..bd7e9e5c644 100644 --- a/include/engine/unpacking_statistics.hpp +++ b/include/engine/unpacking_statistics.hpp @@ -27,19 +27,13 @@ namespace engine class UnpackingStatistics { std::pair edge; - unsigned number_of_nodes; - std::unordered_map, int> cache; int number_of_lookups; int number_of_finds; int number_of_misses; public: - UnpackingStatistics(unsigned number_of_nodes) - : number_of_nodes(number_of_nodes), number_of_lookups(0), number_of_finds(0), - number_of_misses(0) - { - } + UnpackingStatistics() : number_of_lookups(0), number_of_finds(0), number_of_misses(0) {} // UnpackingStatistics(std::pair edge) : edge(edge) {} // UnpackingStatistics() : edge(std::make_pair(SPECIAL_NODEID, SPECIAL_NODEID)) {} @@ -52,7 +46,17 @@ class UnpackingStatistics number_of_misses = 0; } - bool EdgeInCache(std::pair edge) { return cache.find(edge) != cache.end(); } + bool IsEdgeInCache(std::pair edge) + { + ++number_of_lookups; + bool edge_is_in_cache = cache.find(edge) != cache.end(); + // if (edge_is_in_cache) { + // std::cout << edge.first << ", " << edge.second << " true" << std::endl; + // } else { + // std::cout << edge.first << ", " << edge.second << " false" << std::endl; + // } + return edge_is_in_cache; + } void CollectStats(std::pair edge) { @@ -65,8 +69,6 @@ class UnpackingStatistics // - increment number_of_lookups, number_of_misses // - insert edge into map with value 1 - number_of_lookups = number_of_lookups + 1; - if (cache.find(edge) == cache.end()) { ++number_of_misses; @@ -84,13 +86,9 @@ class UnpackingStatistics << " Total Lookups: " << number_of_lookups << std::endl; } - void PrintEdgeLookups(std::pair edge) - { - if (cache.find(edge) == cache.end()) - { - } - std::cout << "{I'm heeeear}" << std::endl; - } + // void PrintEdgeLookups(std::pair edge) + // { + // } }; } // engine } // osrm diff --git a/src/engine/routing_algorithms/many_to_many_ch.cpp b/src/engine/routing_algorithms/many_to_many_ch.cpp index e04990ffd38..a52a04ea444 100644 --- a/src/engine/routing_algorithms/many_to_many_ch.cpp +++ b/src/engine/routing_algorithms/many_to_many_ch.cpp @@ -169,8 +169,7 @@ std::vector manyToManySearch(SearchEngineData &engi std::vector weights_table(number_of_entries, INVALID_EDGE_WEIGHT); std::vector durations_table(number_of_entries, MAXIMAL_EDGE_DURATION); - engine_working_data.InitializeOrClearUnpackingStatisticsThreadLocalStorage( - facade.GetNumberOfNodes()); + engine_working_data.InitializeOrClearUnpackingStatisticsThreadLocalStorage(); for (std::uint32_t column_idx = 0; column_idx < number_of_targets; ++column_idx) { diff --git a/src/engine/search_engine_data.cpp b/src/engine/search_engine_data.cpp index 496b2d35514..7acee5db5da 100644 --- a/src/engine/search_engine_data.cpp +++ b/src/engine/search_engine_data.cpp @@ -91,8 +91,7 @@ void SearchEngineData::InitializeOrClearManyToManyThreadLocalStorage(unsigne } } -void SearchEngineData::InitializeOrClearUnpackingStatisticsThreadLocalStorage( - unsigned number_of_nodes) +void SearchEngineData::InitializeOrClearUnpackingStatisticsThreadLocalStorage() { if (unpacking_cache.get()) { @@ -100,7 +99,7 @@ void SearchEngineData::InitializeOrClearUnpackingStatisticsThreadLocalStorag } else { - unpacking_cache.reset(new UnpackingStatistics(number_of_nodes)); + unpacking_cache.reset(new UnpackingStatistics()); } }