Skip to content

Commit

Permalink
Add instrumentation for osrm-routed
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMarex committed May 31, 2017
1 parent 3d19212 commit 602dd39
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions include/engine/datafacade/contiguous_internalmem_datafacade.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include "util/static_graph.hpp"
#include "util/static_rtree.hpp"
#include "util/typedefs.hpp"
#include "util/timed_histogram.hpp"

#include <boost/assert.hpp>

Expand Down Expand Up @@ -71,6 +72,7 @@ class ContiguousInternalMemoryAlgorithmDataFacade<CH> : 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
Expand Down Expand Up @@ -99,6 +101,12 @@ class ContiguousInternalMemoryAlgorithmDataFacade<CH> : 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);
Expand All @@ -121,13 +129,13 @@ class ContiguousInternalMemoryAlgorithmDataFacade<CH> : 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
Expand Down Expand Up @@ -945,6 +953,7 @@ template <> class ContiguousInternalMemoryAlgorithmDataFacade<MLD> : 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)
Expand Down Expand Up @@ -1057,6 +1066,12 @@ template <> class ContiguousInternalMemoryAlgorithmDataFacade<MLD> : 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;
Expand All @@ -1081,17 +1096,19 @@ template <> class ContiguousInternalMemoryAlgorithmDataFacade<MLD> : 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);
}

Expand Down

0 comments on commit 602dd39

Please sign in to comment.