From 602dd39c9b5340a8cb4869a7df690d914347f3a4 Mon Sep 17 00:00:00 2001 From: Patrick Niklaus Date: Wed, 31 May 2017 00:03:35 +0000 Subject: [PATCH] Add instrumentation for osrm-routed --- .../contiguous_internalmem_datafacade.hpp | 27 +++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/include/engine/datafacade/contiguous_internalmem_datafacade.hpp b/include/engine/datafacade/contiguous_internalmem_datafacade.hpp index c258bb40079..8a115ea11ce 100644 --- a/include/engine/datafacade/contiguous_internalmem_datafacade.hpp +++ b/include/engine/datafacade/contiguous_internalmem_datafacade.hpp @@ -42,6 +42,7 @@ #include "util/static_graph.hpp" #include "util/static_rtree.hpp" #include "util/typedefs.hpp" +#include "util/timed_histogram.hpp" #include @@ -71,6 +72,7 @@ class ContiguousInternalMemoryAlgorithmDataFacade : public datafacade::Algor using GraphNode = QueryGraph::NodeArrayEntry; using GraphEdge = QueryGraph::EdgeArrayEntry; + mutable util::TimedHistogram<10000, 1000> graph_histogram; QueryGraph m_query_graph; // allocator that keeps the allocation data @@ -99,6 +101,12 @@ class ContiguousInternalMemoryAlgorithmDataFacade : public datafacade::Algor InitializeInternalPointers(allocator->GetLayout(), allocator->GetMemory()); } + ~ContiguousInternalMemoryAlgorithmDataFacade() + { + std::ofstream out("ch_graph_access.csv"); + out << graph_histogram.DumpCSV(); + } + void InitializeInternalPointers(storage::DataLayout &data_layout, char *memory_block) { InitializeGraphPointer(data_layout, memory_block); @@ -121,13 +129,13 @@ class ContiguousInternalMemoryAlgorithmDataFacade : public datafacade::Algor return m_query_graph.GetEdgeData(e); } - EdgeID BeginEdges(const NodeID n) const override final { return m_query_graph.BeginEdges(n); } + EdgeID BeginEdges(const NodeID n) const override final { graph_histogram.Count(n); return m_query_graph.BeginEdges(n); } - EdgeID EndEdges(const NodeID n) const override final { return m_query_graph.EndEdges(n); } + EdgeID EndEdges(const NodeID n) const override final { graph_histogram.Count(n); return m_query_graph.EndEdges(n); } EdgeRange GetAdjacentEdgeRange(const NodeID node) const override final { - return m_query_graph.GetAdjacentEdgeRange(node); + graph_histogram.Count(node); return m_query_graph.GetAdjacentEdgeRange(node); } // searches for a specific edge @@ -945,6 +953,7 @@ template <> class ContiguousInternalMemoryAlgorithmDataFacade : public Algo using GraphNode = QueryGraph::NodeArrayEntry; using GraphEdge = QueryGraph::EdgeArrayEntry; + mutable util::TimedHistogram<10000, 1000> graph_histogram; QueryGraph query_graph; void InitializeInternalPointers(storage::DataLayout &data_layout, char *memory_block) @@ -1057,6 +1066,12 @@ template <> class ContiguousInternalMemoryAlgorithmDataFacade : public Algo InitializeInternalPointers(allocator->GetLayout(), allocator->GetMemory()); } + ~ContiguousInternalMemoryAlgorithmDataFacade() + { + std::ofstream out("mld_graph_access.csv"); + out << graph_histogram.DumpCSV(); + } + const partition::MultiLevelPartitionView &GetMultiLevelPartition() const override { return mld_partition; @@ -1081,17 +1096,19 @@ template <> class ContiguousInternalMemoryAlgorithmDataFacade : public Algo return query_graph.GetEdgeData(e); } - EdgeID BeginEdges(const NodeID n) const override final { return query_graph.BeginEdges(n); } + EdgeID BeginEdges(const NodeID n) const override final { graph_histogram.Count(n); return query_graph.BeginEdges(n); } - EdgeID EndEdges(const NodeID n) const override final { return query_graph.EndEdges(n); } + EdgeID EndEdges(const NodeID n) const override final { graph_histogram.Count(n); return query_graph.EndEdges(n); } EdgeRange GetAdjacentEdgeRange(const NodeID node) const override final { + graph_histogram.Count(node); return query_graph.GetAdjacentEdgeRange(node); } EdgeRange GetBorderEdgeRange(const LevelID level, const NodeID node) const override final { + graph_histogram.Count(node); return query_graph.GetBorderEdgeRange(level, node); }