Refine logging output

This commit is contained in:
Michael Krasnyk 2017-12-02 00:37:09 +01:00
parent de938df560
commit 1794185d43

View File

@ -485,7 +485,6 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
util::UnbufferedLog log; util::UnbufferedLog log;
const NodeID node_count = m_node_based_graph.GetNumberOfNodes(); const NodeID node_count = m_node_based_graph.GetNumberOfNodes();
util::Percent progress(log, node_count);
// Because we write TurnIndexBlock data as we go, we'll // Because we write TurnIndexBlock data as we go, we'll
// buffer them into groups of 1000 to reduce the syscall // buffer them into groups of 1000 to reduce the syscall
@ -495,11 +494,9 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
std::vector<lookup::TurnIndexBlock> turn_indexes_write_buffer; std::vector<lookup::TurnIndexBlock> turn_indexes_write_buffer;
turn_indexes_write_buffer.reserve(TURN_INDEX_WRITE_BUFFER_SIZE); turn_indexes_write_buffer.reserve(TURN_INDEX_WRITE_BUFFER_SIZE);
// TODO: update comments block
// This struct is the buffered output of the `processor_stage`. This data is // This struct is the buffered output of the `processor_stage`. This data is
// appended to the various output arrays/files by the `output_stage`. // appended to the various output arrays/files by the `output_stage`.
// same as IntersectionData, but grouped with edge to allow sorting after creating. Edges // same as IntersectionData, but grouped with edge to allow sorting after creating.
// can be out of order
struct EdgeWithData struct EdgeWithData
{ {
EdgeBasedEdge edge; EdgeBasedEdge edge;
@ -1184,13 +1181,12 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
}); });
// Last part of the pipeline puts all the calculated data into the serial buffers // Last part of the pipeline puts all the calculated data into the serial buffers
std::uint64_t routing_nodes_completed = 0; util::Percent routing_progress(log, node_count);
std::vector<EdgeWithData> delayed_data; std::vector<EdgeWithData> delayed_data;
tbb::filter_t<EdgesPipelineBufferPtr, void> output_stage( tbb::filter_t<EdgesPipelineBufferPtr, void> output_stage(
tbb::filter::serial_in_order, [&](auto buffer) { tbb::filter::serial_in_order, [&](auto buffer) {
routing_nodes_completed += buffer->nodes_processed; routing_progress.PrintAddition(buffer->nodes_processed);
progress.PrintStatus(routing_nodes_completed);
// Copy data from local buffers into global EBG data // Copy data from local buffers into global EBG data
std::for_each( std::for_each(
@ -1215,14 +1211,13 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
}); });
// Last part of the pipeline puts all the calculated data into the serial buffers // Last part of the pipeline puts all the calculated data into the serial buffers
std::uint64_t guidance_nodes_completed = 0; util::Percent guidance_progress(log, node_count);
std::vector<TurnData> delayed_turn_data; std::vector<TurnData> delayed_turn_data;
tbb::filter_t<TurnsPipelineBufferPtr, void> guidance_output_stage( tbb::filter_t<TurnsPipelineBufferPtr, void> guidance_output_stage(
tbb::filter::serial_in_order, [&](auto buffer) { tbb::filter::serial_in_order, [&](auto buffer) {
guidance_nodes_completed += buffer->nodes_processed; guidance_progress.PrintAddition(buffer->nodes_processed);
progress.PrintStatus(guidance_nodes_completed);
// Guidance data // Guidance data
std::for_each(buffer->continuous_turn_data.begin(), std::for_each(buffer->continuous_turn_data.begin(),
@ -1246,19 +1241,13 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
current_node = 0; current_node = 0;
tbb::parallel_pipeline(tbb::task_scheduler_init::default_num_threads() * 5, tbb::parallel_pipeline(tbb::task_scheduler_init::default_num_threads() * 5,
generator_stage & processor_stage & output_stage); generator_stage & processor_stage & output_stage);
log << std::endl;
util::Log() << "Generating guidance turns "; util::Log() << "Generating guidance turns ";
current_node = 0; current_node = 0;
tbb::parallel_pipeline(tbb::task_scheduler_init::default_num_threads() * 5, tbb::parallel_pipeline(tbb::task_scheduler_init::default_num_threads() * 5,
generator_stage & guidance_stage & guidance_output_stage); generator_stage & guidance_stage & guidance_output_stage);
// TODO: remove sorting below
// std::sort(delayed_data.begin(), delayed_data.end(), [](auto const &lhs, auto
// const &rhs)
// {
// return lhs.edge.source < rhs.edge.source;
// });
// NOTE: buffer.delayed_data and buffer.delayed_turn_data have the same index // NOTE: buffer.delayed_data and buffer.delayed_turn_data have the same index
std::for_each(delayed_data.begin(), delayed_data.end(), transfer_data); std::for_each(delayed_data.begin(), delayed_data.end(), transfer_data);
std::for_each(delayed_turn_data.begin(), std::for_each(delayed_turn_data.begin(),