Run clang-format
This commit is contained in:
+11
-12
@@ -19,7 +19,6 @@ namespace tools
|
||||
|
||||
using EdgeData = contractor::QueryEdge::EdgeData;
|
||||
using QueryGraph = util::StaticGraph<EdgeData>;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,10 +43,10 @@ int main(int argc, char *argv[])
|
||||
unsigned m_number_of_nodes =
|
||||
readHSGRFromStream(hsgr_path, node_list, edge_list, &m_check_sum);
|
||||
osrm::util::SimpleLogger().Write() << "expecting " << m_number_of_nodes
|
||||
<< " nodes, checksum: " << m_check_sum;
|
||||
<< " nodes, checksum: " << m_check_sum;
|
||||
BOOST_ASSERT_MSG(0 != node_list.size(), "node list empty");
|
||||
osrm::util::SimpleLogger().Write() << "loaded " << node_list.size() << " nodes and " << edge_list.size()
|
||||
<< " edges";
|
||||
osrm::util::SimpleLogger().Write() << "loaded " << node_list.size() << " nodes and "
|
||||
<< edge_list.size() << " edges";
|
||||
auto m_query_graph = std::make_shared<osrm::tools::QueryGraph>(node_list, edge_list);
|
||||
|
||||
BOOST_ASSERT_MSG(0 == node_list.size(), "node list not flushed");
|
||||
@@ -67,18 +66,18 @@ int main(int argc, char *argv[])
|
||||
const EdgeID edge_id_1 = m_query_graph->FindEdgeInEitherDirection(node_u, data.id);
|
||||
if (SPECIAL_EDGEID == edge_id_1)
|
||||
{
|
||||
throw osrm::util::exception("cannot find first segment of edge (" +
|
||||
std::to_string(node_u) + "," + std::to_string(data.id) +
|
||||
"," + std::to_string(node_v) + "), eid: " +
|
||||
std::to_string(eid));
|
||||
throw osrm::util::exception(
|
||||
"cannot find first segment of edge (" + std::to_string(node_u) + "," +
|
||||
std::to_string(data.id) + "," + std::to_string(node_v) + "), eid: " +
|
||||
std::to_string(eid));
|
||||
}
|
||||
const EdgeID edge_id_2 = m_query_graph->FindEdgeInEitherDirection(data.id, node_v);
|
||||
if (SPECIAL_EDGEID == edge_id_2)
|
||||
{
|
||||
throw osrm::util::exception("cannot find second segment of edge (" +
|
||||
std::to_string(node_u) + "," + std::to_string(data.id) +
|
||||
"," + std::to_string(node_v) + "), eid: " +
|
||||
std::to_string(eid));
|
||||
throw osrm::util::exception(
|
||||
"cannot find second segment of edge (" + std::to_string(node_u) + "," +
|
||||
std::to_string(data.id) + "," + std::to_string(node_v) + "), eid: " +
|
||||
std::to_string(eid));
|
||||
}
|
||||
}
|
||||
progress.printStatus(node_u);
|
||||
|
||||
+24
-19
@@ -66,7 +66,7 @@ std::size_t loadGraph(const char *path,
|
||||
std::vector<NodeID> barrier_node_list;
|
||||
|
||||
auto number_of_nodes = util::loadNodesFromFile(input_stream, barrier_node_list,
|
||||
traffic_light_node_list, coordinate_list);
|
||||
traffic_light_node_list, coordinate_list);
|
||||
|
||||
util::loadEdgesFromFile(input_stream, edge_list);
|
||||
|
||||
@@ -116,17 +116,20 @@ int main(int argc, char *argv[])
|
||||
auto number_of_nodes = osrm::tools::loadGraph(argv[1], coordinate_list, graph_edge_list);
|
||||
|
||||
tbb::parallel_sort(graph_edge_list.begin(), graph_edge_list.end());
|
||||
const auto graph = std::make_shared<osrm::tools::TarjanGraph>(number_of_nodes, graph_edge_list);
|
||||
const auto graph =
|
||||
std::make_shared<osrm::tools::TarjanGraph>(number_of_nodes, graph_edge_list);
|
||||
graph_edge_list.clear();
|
||||
graph_edge_list.shrink_to_fit();
|
||||
|
||||
osrm::util::SimpleLogger().Write() << "Starting SCC graph traversal";
|
||||
|
||||
auto tarjan = osrm::util::make_unique<osrm::extractor::TarjanSCC<osrm::tools::TarjanGraph>>(graph);
|
||||
auto tarjan =
|
||||
osrm::util::make_unique<osrm::extractor::TarjanSCC<osrm::tools::TarjanGraph>>(graph);
|
||||
tarjan->run();
|
||||
osrm::util::SimpleLogger().Write() << "identified: " << tarjan->get_number_of_components()
|
||||
<< " many components";
|
||||
osrm::util::SimpleLogger().Write() << "identified " << tarjan->get_size_one_count() << " size 1 SCCs";
|
||||
<< " many components";
|
||||
osrm::util::SimpleLogger().Write() << "identified " << tarjan->get_size_one_count()
|
||||
<< " size 1 SCCs";
|
||||
|
||||
// output
|
||||
TIMER_START(SCC_RUN_SETUP);
|
||||
@@ -141,8 +144,7 @@ int main(int argc, char *argv[])
|
||||
OGRRegisterAll();
|
||||
|
||||
const char *psz_driver_name = "ESRI Shapefile";
|
||||
auto *po_driver =
|
||||
OGRSFDriverRegistrar::GetRegistrar()->GetDriverByName(psz_driver_name);
|
||||
auto *po_driver = OGRSFDriverRegistrar::GetRegistrar()->GetDriverByName(psz_driver_name);
|
||||
if (nullptr == po_driver)
|
||||
{
|
||||
throw osrm::util::exception("ESRI Shapefile driver not available");
|
||||
@@ -164,8 +166,8 @@ int main(int argc, char *argv[])
|
||||
throw osrm::util::exception("Layer creation failed.");
|
||||
}
|
||||
TIMER_STOP(SCC_RUN_SETUP);
|
||||
osrm::util::SimpleLogger().Write() << "shapefile setup took " << TIMER_MSEC(SCC_RUN_SETUP) / 1000.
|
||||
<< "s";
|
||||
osrm::util::SimpleLogger().Write() << "shapefile setup took "
|
||||
<< TIMER_MSEC(SCC_RUN_SETUP) / 1000. << "s";
|
||||
|
||||
uint64_t total_network_length = 0;
|
||||
percentage.reinit(graph->GetNumberOfNodes());
|
||||
@@ -196,12 +198,15 @@ int main(int argc, char *argv[])
|
||||
if (size_of_containing_component < 1000)
|
||||
{
|
||||
OGRLineString line_string;
|
||||
line_string.addPoint(coordinate_list[source].lon / osrm::COORDINATE_PRECISION,
|
||||
coordinate_list[source].lat / osrm::COORDINATE_PRECISION);
|
||||
line_string.addPoint(coordinate_list[target].lon / osrm::COORDINATE_PRECISION,
|
||||
coordinate_list[target].lat / osrm::COORDINATE_PRECISION);
|
||||
line_string.addPoint(
|
||||
coordinate_list[source].lon / osrm::COORDINATE_PRECISION,
|
||||
coordinate_list[source].lat / osrm::COORDINATE_PRECISION);
|
||||
line_string.addPoint(
|
||||
coordinate_list[target].lon / osrm::COORDINATE_PRECISION,
|
||||
coordinate_list[target].lat / osrm::COORDINATE_PRECISION);
|
||||
|
||||
OGRFeature *po_feature = OGRFeature::CreateFeature(po_layer->GetLayerDefn());
|
||||
OGRFeature *po_feature =
|
||||
OGRFeature::CreateFeature(po_layer->GetLayerDefn());
|
||||
|
||||
po_feature->SetGeometry(&line_string);
|
||||
if (OGRERR_NONE != po_layer->CreateFeature(po_feature))
|
||||
@@ -216,12 +221,12 @@ int main(int argc, char *argv[])
|
||||
OGRSpatialReference::DestroySpatialReference(po_srs);
|
||||
OGRDataSource::DestroyDataSource(po_datasource);
|
||||
TIMER_STOP(SCC_OUTPUT);
|
||||
osrm::util::SimpleLogger().Write() << "generating output took: " << TIMER_MSEC(SCC_OUTPUT) / 1000.
|
||||
<< "s";
|
||||
osrm::util::SimpleLogger().Write()
|
||||
<< "generating output took: " << TIMER_MSEC(SCC_OUTPUT) / 1000. << "s";
|
||||
|
||||
osrm::util::SimpleLogger().Write() << "total network distance: "
|
||||
<< static_cast<uint64_t>(total_network_length / 100 / 1000.)
|
||||
<< " km";
|
||||
osrm::util::SimpleLogger().Write()
|
||||
<< "total network distance: "
|
||||
<< static_cast<uint64_t>(total_network_length / 100 / 1000.) << " km";
|
||||
|
||||
osrm::util::SimpleLogger().Write() << "finished component analysis";
|
||||
}
|
||||
|
||||
+10
-8
@@ -18,7 +18,8 @@ int main(int argc, char *argv[]) try
|
||||
util::LogPolicy::GetInstance().Unmute();
|
||||
contractor::ContractorConfig contractor_config;
|
||||
|
||||
const contractor::return_code result = contractor::ContractorOptions::ParseArguments(argc, argv, contractor_config);
|
||||
const contractor::return_code result =
|
||||
contractor::ContractorOptions::ParseArguments(argc, argv, contractor_config);
|
||||
|
||||
if (contractor::return_code::fail == result)
|
||||
{
|
||||
@@ -42,9 +43,9 @@ int main(int argc, char *argv[]) try
|
||||
|
||||
if (recommended_num_threads != contractor_config.requested_num_threads)
|
||||
{
|
||||
util::SimpleLogger().Write(logWARNING) << "The recommended number of threads is "
|
||||
<< recommended_num_threads
|
||||
<< "! This setting may have performance side-effects.";
|
||||
util::SimpleLogger().Write(logWARNING)
|
||||
<< "The recommended number of threads is " << recommended_num_threads
|
||||
<< "! This setting may have performance side-effects.";
|
||||
}
|
||||
|
||||
if (!boost::filesystem::is_regular_file(contractor_config.osrm_input_path))
|
||||
@@ -56,14 +57,15 @@ int main(int argc, char *argv[]) try
|
||||
|
||||
if (!boost::filesystem::is_regular_file(contractor_config.profile_path))
|
||||
{
|
||||
util::SimpleLogger().Write(logWARNING) << "Profile " << contractor_config.profile_path.string()
|
||||
<< " not found!";
|
||||
util::SimpleLogger().Write(logWARNING)
|
||||
<< "Profile " << contractor_config.profile_path.string() << " not found!";
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
util::SimpleLogger().Write() << "Input file: "
|
||||
<< contractor_config.osrm_input_path.filename().string();
|
||||
util::SimpleLogger().Write() << "Profile: " << contractor_config.profile_path.filename().string();
|
||||
<< contractor_config.osrm_input_path.filename().string();
|
||||
util::SimpleLogger().Write() << "Profile: "
|
||||
<< contractor_config.profile_path.filename().string();
|
||||
util::SimpleLogger().Write() << "Threads: " << contractor_config.requested_num_threads;
|
||||
|
||||
tbb::task_scheduler_init init(contractor_config.requested_num_threads);
|
||||
|
||||
+24
-17
@@ -37,8 +37,11 @@ using namespace osrm::engine::datafacade;
|
||||
using namespace osrm::datastore;
|
||||
using namespace osrm;
|
||||
|
||||
using RTreeLeaf = typename engine::datafacade::BaseDataFacade<contractor::QueryEdge::EdgeData>::RTreeLeaf;
|
||||
using RTreeNode = util::StaticRTree<RTreeLeaf, util::ShM<util::FixedPointCoordinate, true>::vector, true>::TreeNode;
|
||||
using RTreeLeaf =
|
||||
typename engine::datafacade::BaseDataFacade<contractor::QueryEdge::EdgeData>::RTreeLeaf;
|
||||
using RTreeNode = util::StaticRTree<RTreeLeaf,
|
||||
util::ShM<util::FixedPointCoordinate, true>::vector,
|
||||
true>::TreeNode;
|
||||
using QueryGraph = util::StaticGraph<contractor::QueryEdge::EdgeData>;
|
||||
|
||||
namespace osrm
|
||||
@@ -75,7 +78,6 @@ void deleteRegion(const SharedDataType region)
|
||||
util::SimpleLogger().Write(logWARNING) << "could not delete shared memory region " << name;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,7 +91,8 @@ int main(const int argc, const char *argv[]) try
|
||||
const bool lock_flags = MCL_CURRENT | MCL_FUTURE;
|
||||
if (-1 == mlockall(lock_flags))
|
||||
{
|
||||
util::SimpleLogger().Write(logWARNING) << "Process " << argv[0] << " could not request RAM lock";
|
||||
util::SimpleLogger().Write(logWARNING) << "Process " << argv[0]
|
||||
<< " could not request RAM lock";
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -237,9 +240,9 @@ int main(const int argc, const char *argv[]) try
|
||||
shared_layout_ptr->SetBlockSize<unsigned>(SharedDataLayout::NAME_ID_LIST,
|
||||
number_of_original_edges);
|
||||
shared_layout_ptr->SetBlockSize<extractor::TravelMode>(SharedDataLayout::TRAVEL_MODE,
|
||||
number_of_original_edges);
|
||||
number_of_original_edges);
|
||||
shared_layout_ptr->SetBlockSize<extractor::TurnInstruction>(SharedDataLayout::TURN_INSTRUCTION,
|
||||
number_of_original_edges);
|
||||
number_of_original_edges);
|
||||
// note: there are 32 geometry indicators in one unsigned block
|
||||
shared_layout_ptr->SetBlockSize<unsigned>(SharedDataLayout::GEOMETRIES_INDICATORS,
|
||||
number_of_original_edges);
|
||||
@@ -256,7 +259,7 @@ int main(const int argc, const char *argv[]) try
|
||||
else
|
||||
{
|
||||
util::SimpleLogger().Write(logWARNING) << ".hsgr was prepared with different build. "
|
||||
"Reprocess to get rid of this warning.";
|
||||
"Reprocess to get rid of this warning.";
|
||||
}
|
||||
|
||||
// load checksum
|
||||
@@ -292,7 +295,8 @@ int main(const int argc, const char *argv[]) try
|
||||
boost::filesystem::ifstream timestamp_stream(timestamp_path);
|
||||
if (!timestamp_stream)
|
||||
{
|
||||
util::SimpleLogger().Write(logWARNING) << timestamp_path << " not found. setting to default";
|
||||
util::SimpleLogger().Write(logWARNING) << timestamp_path
|
||||
<< " not found. setting to default";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -323,7 +327,7 @@ int main(const int argc, const char *argv[]) try
|
||||
unsigned coordinate_list_size = 0;
|
||||
nodes_input_stream.read((char *)&coordinate_list_size, sizeof(unsigned));
|
||||
shared_layout_ptr->SetBlockSize<util::FixedPointCoordinate>(SharedDataLayout::COORDINATE_LIST,
|
||||
coordinate_list_size);
|
||||
coordinate_list_size);
|
||||
|
||||
// load geometries sizes
|
||||
std::ifstream geometry_input_stream(geometries_data_path.string().c_str(), std::ios::binary);
|
||||
@@ -339,8 +343,8 @@ int main(const int argc, const char *argv[]) try
|
||||
shared_layout_ptr->SetBlockSize<unsigned>(SharedDataLayout::GEOMETRIES_LIST,
|
||||
number_of_compressed_geometries);
|
||||
// allocate shared memory block
|
||||
util::SimpleLogger().Write() << "allocating shared memory of " << shared_layout_ptr->GetSizeOfLayout()
|
||||
<< " bytes";
|
||||
util::SimpleLogger().Write() << "allocating shared memory of "
|
||||
<< shared_layout_ptr->GetSizeOfLayout() << " bytes";
|
||||
SharedMemory *shared_memory =
|
||||
SharedMemoryFactory::Get(data_region, shared_layout_ptr->GetSizeOfLayout());
|
||||
char *shared_memory_ptr = static_cast<char *>(shared_memory->Ptr());
|
||||
@@ -403,11 +407,13 @@ int main(const int argc, const char *argv[]) try
|
||||
unsigned *name_id_ptr = shared_layout_ptr->GetBlockPtr<unsigned, true>(
|
||||
shared_memory_ptr, SharedDataLayout::NAME_ID_LIST);
|
||||
|
||||
extractor::TravelMode *travel_mode_ptr = shared_layout_ptr->GetBlockPtr<extractor::TravelMode, true>(
|
||||
shared_memory_ptr, SharedDataLayout::TRAVEL_MODE);
|
||||
extractor::TravelMode *travel_mode_ptr =
|
||||
shared_layout_ptr->GetBlockPtr<extractor::TravelMode, true>(shared_memory_ptr,
|
||||
SharedDataLayout::TRAVEL_MODE);
|
||||
|
||||
extractor::TurnInstruction *turn_instructions_ptr = shared_layout_ptr->GetBlockPtr<extractor::TurnInstruction, true>(
|
||||
shared_memory_ptr, SharedDataLayout::TURN_INSTRUCTION);
|
||||
extractor::TurnInstruction *turn_instructions_ptr =
|
||||
shared_layout_ptr->GetBlockPtr<extractor::TurnInstruction, true>(
|
||||
shared_memory_ptr, SharedDataLayout::TURN_INSTRUCTION);
|
||||
|
||||
unsigned *geometries_indicator_ptr = shared_layout_ptr->GetBlockPtr<unsigned, true>(
|
||||
shared_memory_ptr, SharedDataLayout::GEOMETRIES_INDICATORS);
|
||||
@@ -575,8 +581,9 @@ int main(const int argc, const char *argv[]) try
|
||||
catch (const std::bad_alloc &e)
|
||||
{
|
||||
util::SimpleLogger().Write(logWARNING) << "[exception] " << e.what();
|
||||
util::SimpleLogger().Write(logWARNING) << "Please provide more memory or disable locking the virtual "
|
||||
"address space (note: this makes OSRM swap, i.e. slow)";
|
||||
util::SimpleLogger().Write(logWARNING)
|
||||
<< "Please provide more memory or disable locking the virtual "
|
||||
"address space (note: this makes OSRM swap, i.e. slow)";
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
|
||||
@@ -15,7 +15,8 @@ int main(int argc, char *argv[]) try
|
||||
util::LogPolicy::GetInstance().Unmute();
|
||||
extractor::ExtractorConfig extractor_config;
|
||||
|
||||
const extractor::return_code result = extractor::ExtractorOptions::ParseArguments(argc, argv, extractor_config);
|
||||
const extractor::return_code result =
|
||||
extractor::ExtractorOptions::ParseArguments(argc, argv, extractor_config);
|
||||
|
||||
if (extractor::return_code::fail == result)
|
||||
{
|
||||
@@ -37,15 +38,15 @@ int main(int argc, char *argv[]) try
|
||||
|
||||
if (!boost::filesystem::is_regular_file(extractor_config.input_path))
|
||||
{
|
||||
util::SimpleLogger().Write(logWARNING) << "Input file " << extractor_config.input_path.string()
|
||||
<< " not found!";
|
||||
util::SimpleLogger().Write(logWARNING)
|
||||
<< "Input file " << extractor_config.input_path.string() << " not found!";
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (!boost::filesystem::is_regular_file(extractor_config.profile_path))
|
||||
{
|
||||
util::SimpleLogger().Write(logWARNING) << "Profile " << extractor_config.profile_path.string()
|
||||
<< " not found!";
|
||||
util::SimpleLogger().Write(logWARNING)
|
||||
<< "Profile " << extractor_config.profile_path.string() << " not found!";
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
return extractor::extractor(extractor_config).run();
|
||||
|
||||
+42
-30
@@ -44,7 +44,6 @@ void runStatistics(std::vector<double> &timings_vector, Statistics &stats)
|
||||
timings_vector.begin(), 0.0);
|
||||
stats.dev = std::sqrt(primary_sq_sum / timings_vector.size() - (stats.mean * stats.mean));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +65,8 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
if (1 == argc)
|
||||
{
|
||||
osrm::util::SimpleLogger().Write(logWARNING) << "usage: " << argv[0] << " /path/on/device";
|
||||
osrm::util::SimpleLogger().Write(logWARNING) << "usage: " << argv[0]
|
||||
<< " /path/on/device";
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -90,7 +90,8 @@ int main(int argc, char *argv[])
|
||||
fcntl(fileno(fd), F_NOCACHE, 1);
|
||||
fcntl(fileno(fd), F_RDAHEAD, 0);
|
||||
TIMER_START(write_1gb);
|
||||
write(fileno(fd), (char *)random_array, osrm::tools::NUMBER_OF_ELEMENTS * sizeof(unsigned));
|
||||
write(fileno(fd), (char *)random_array,
|
||||
osrm::tools::NUMBER_OF_ELEMENTS * sizeof(unsigned));
|
||||
TIMER_STOP(write_1gb);
|
||||
fclose(fd);
|
||||
#endif
|
||||
@@ -102,7 +103,8 @@ int main(int argc, char *argv[])
|
||||
throw osrm::util::exception("Could not open random data file");
|
||||
}
|
||||
TIMER_START(write_1gb);
|
||||
int ret = write(file_desc, random_array, osrm::tools::NUMBER_OF_ELEMENTS * sizeof(unsigned));
|
||||
int ret =
|
||||
write(file_desc, random_array, osrm::tools::NUMBER_OF_ELEMENTS * sizeof(unsigned));
|
||||
if (0 > ret)
|
||||
{
|
||||
throw osrm::util::exception("could not write random data file");
|
||||
@@ -111,10 +113,11 @@ int main(int argc, char *argv[])
|
||||
close(file_desc);
|
||||
#endif
|
||||
delete[] random_array;
|
||||
osrm::util::SimpleLogger().Write(logDEBUG) << "writing raw 1GB took " << TIMER_SEC(write_1gb)
|
||||
<< "s";
|
||||
osrm::util::SimpleLogger().Write(logDEBUG) << "writing raw 1GB took "
|
||||
<< TIMER_SEC(write_1gb) << "s";
|
||||
osrm::util::SimpleLogger().Write() << "raw write performance: " << std::setprecision(5)
|
||||
<< std::fixed << 1024 * 1024 / TIMER_SEC(write_1gb) << "MB/sec";
|
||||
<< std::fixed << 1024 * 1024 / TIMER_SEC(write_1gb)
|
||||
<< "MB/sec";
|
||||
|
||||
osrm::util::SimpleLogger().Write(logDEBUG)
|
||||
<< "finished creation of random data. Flush disk cache now!";
|
||||
@@ -146,7 +149,8 @@ int main(int argc, char *argv[])
|
||||
osrm::util::SimpleLogger().Write(logDEBUG) << "opened, error: " << strerror(errno);
|
||||
return -1;
|
||||
}
|
||||
char *raw_array = (char *)memalign(512, osrm::tools::NUMBER_OF_ELEMENTS * sizeof(unsigned));
|
||||
char *raw_array =
|
||||
(char *)memalign(512, osrm::tools::NUMBER_OF_ELEMENTS * sizeof(unsigned));
|
||||
#endif
|
||||
TIMER_START(read_1gb);
|
||||
#ifdef __APPLE__
|
||||
@@ -155,18 +159,21 @@ int main(int argc, char *argv[])
|
||||
fd = fopen(test_path.string().c_str(), "r");
|
||||
#endif
|
||||
#ifdef __linux__
|
||||
int ret = read(file_desc, raw_array, osrm::tools::NUMBER_OF_ELEMENTS * sizeof(unsigned));
|
||||
int ret =
|
||||
read(file_desc, raw_array, osrm::tools::NUMBER_OF_ELEMENTS * sizeof(unsigned));
|
||||
osrm::util::SimpleLogger().Write(logDEBUG) << "read " << ret
|
||||
<< " bytes, error: " << strerror(errno);
|
||||
<< " bytes, error: " << strerror(errno);
|
||||
close(file_desc);
|
||||
file_desc = open(test_path.string().c_str(), O_RDONLY | O_DIRECT | O_SYNC);
|
||||
osrm::util::SimpleLogger().Write(logDEBUG) << "opened, error: " << strerror(errno);
|
||||
#endif
|
||||
TIMER_STOP(read_1gb);
|
||||
|
||||
osrm::util::SimpleLogger().Write(logDEBUG) << "reading raw 1GB took " << TIMER_SEC(read_1gb) << "s";
|
||||
osrm::util::SimpleLogger().Write() << "raw read performance: " << std::setprecision(5) << std::fixed
|
||||
<< 1024 * 1024 / TIMER_SEC(read_1gb) << "MB/sec";
|
||||
osrm::util::SimpleLogger().Write(logDEBUG) << "reading raw 1GB took "
|
||||
<< TIMER_SEC(read_1gb) << "s";
|
||||
osrm::util::SimpleLogger().Write() << "raw read performance: " << std::setprecision(5)
|
||||
<< std::fixed << 1024 * 1024 / TIMER_SEC(read_1gb)
|
||||
<< "MB/sec";
|
||||
|
||||
std::vector<double> timing_results_raw_random;
|
||||
osrm::util::SimpleLogger().Write(logDEBUG) << "running 1000 random I/Os of 4KB";
|
||||
@@ -178,7 +185,8 @@ int main(int argc, char *argv[])
|
||||
lseek(file_desc, 0, SEEK_SET);
|
||||
#endif
|
||||
// make 1000 random access, time each I/O seperately
|
||||
unsigned number_of_blocks = (osrm::tools::NUMBER_OF_ELEMENTS * sizeof(unsigned) - 1) / 4096;
|
||||
unsigned number_of_blocks =
|
||||
(osrm::tools::NUMBER_OF_ELEMENTS * sizeof(unsigned) - 1) / 4096;
|
||||
std::random_device rd;
|
||||
std::default_random_engine e1(rd());
|
||||
std::uniform_int_distribution<unsigned> uniform_dist(0, number_of_blocks - 1);
|
||||
@@ -205,13 +213,15 @@ int main(int argc, char *argv[])
|
||||
if (((off_t)-1) == ret1)
|
||||
{
|
||||
osrm::util::SimpleLogger().Write(logWARNING) << "offset: " << current_offset;
|
||||
osrm::util::SimpleLogger().Write(logWARNING) << "seek error " << strerror(errno);
|
||||
osrm::util::SimpleLogger().Write(logWARNING) << "seek error "
|
||||
<< strerror(errno);
|
||||
throw osrm::util::exception("seek error");
|
||||
}
|
||||
if (-1 == ret2)
|
||||
{
|
||||
osrm::util::SimpleLogger().Write(logWARNING) << "offset: " << current_offset;
|
||||
osrm::util::SimpleLogger().Write(logWARNING) << "read error " << strerror(errno);
|
||||
osrm::util::SimpleLogger().Write(logWARNING) << "read error "
|
||||
<< strerror(errno);
|
||||
throw osrm::util::exception("read error");
|
||||
}
|
||||
timing_results_raw_random.push_back(TIMER_SEC(random_access));
|
||||
@@ -227,12 +237,12 @@ int main(int argc, char *argv[])
|
||||
random_csv.close();
|
||||
osrm::tools::runStatistics(timing_results_raw_random, stats);
|
||||
|
||||
osrm::util::SimpleLogger().Write() << "raw random I/O: " << std::setprecision(5) << std::fixed
|
||||
<< "min: " << stats.min << "ms, "
|
||||
<< "mean: " << stats.mean << "ms, "
|
||||
<< "med: " << stats.med << "ms, "
|
||||
<< "max: " << stats.max << "ms, "
|
||||
<< "dev: " << stats.dev << "ms";
|
||||
osrm::util::SimpleLogger().Write() << "raw random I/O: " << std::setprecision(5)
|
||||
<< std::fixed << "min: " << stats.min << "ms, "
|
||||
<< "mean: " << stats.mean << "ms, "
|
||||
<< "med: " << stats.med << "ms, "
|
||||
<< "max: " << stats.max << "ms, "
|
||||
<< "dev: " << stats.dev << "ms";
|
||||
|
||||
std::vector<double> timing_results_raw_seq;
|
||||
#ifdef __APPLE__
|
||||
@@ -266,13 +276,15 @@ int main(int argc, char *argv[])
|
||||
if (((off_t)-1) == ret1)
|
||||
{
|
||||
osrm::util::SimpleLogger().Write(logWARNING) << "offset: " << current_offset;
|
||||
osrm::util::SimpleLogger().Write(logWARNING) << "seek error " << strerror(errno);
|
||||
osrm::util::SimpleLogger().Write(logWARNING) << "seek error "
|
||||
<< strerror(errno);
|
||||
throw osrm::util::exception("seek error");
|
||||
}
|
||||
if (-1 == ret2)
|
||||
{
|
||||
osrm::util::SimpleLogger().Write(logWARNING) << "offset: " << current_offset;
|
||||
osrm::util::SimpleLogger().Write(logWARNING) << "read error " << strerror(errno);
|
||||
osrm::util::SimpleLogger().Write(logWARNING) << "read error "
|
||||
<< strerror(errno);
|
||||
throw osrm::util::exception("read error");
|
||||
}
|
||||
timing_results_raw_seq.push_back(TIMER_SEC(read_every_100));
|
||||
@@ -296,12 +308,12 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
seq_csv.close();
|
||||
osrm::tools::runStatistics(timing_results_raw_seq, stats);
|
||||
osrm::util::SimpleLogger().Write() << "raw sequential I/O: " << std::setprecision(5) << std::fixed
|
||||
<< "min: " << stats.min << "ms, "
|
||||
<< "mean: " << stats.mean << "ms, "
|
||||
<< "med: " << stats.med << "ms, "
|
||||
<< "max: " << stats.max << "ms, "
|
||||
<< "dev: " << stats.dev << "ms";
|
||||
osrm::util::SimpleLogger().Write() << "raw sequential I/O: " << std::setprecision(5)
|
||||
<< std::fixed << "min: " << stats.min << "ms, "
|
||||
<< "mean: " << stats.mean << "ms, "
|
||||
<< "med: " << stats.med << "ms, "
|
||||
<< "max: " << stats.max << "ms, "
|
||||
<< "dev: " << stats.dev << "ms";
|
||||
|
||||
if (boost::filesystem::exists(test_path))
|
||||
{
|
||||
|
||||
@@ -61,7 +61,8 @@ int main(int argc, const char *argv[])
|
||||
}
|
||||
catch (std::exception ¤t_exception)
|
||||
{
|
||||
osrm::util::SimpleLogger().Write(logWARNING) << "caught exception: " << current_exception.what();
|
||||
osrm::util::SimpleLogger().Write(logWARNING) << "caught exception: "
|
||||
<< current_exception.what();
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
||||
@@ -63,10 +63,13 @@ int main()
|
||||
osrm::util::SimpleLogger().Write() << "Releasing all locks";
|
||||
osrm::util::SimpleLogger().Write() << "ATTENTION! BE CAREFUL!";
|
||||
osrm::util::SimpleLogger().Write() << "----------------------";
|
||||
osrm::util::SimpleLogger().Write() << "This tool may put osrm-routed into an undefined state!";
|
||||
osrm::util::SimpleLogger().Write() << "Type 'Y' to acknowledge that you know what your are doing.";
|
||||
osrm::util::SimpleLogger().Write() << "\n\nDo you want to purge all shared memory allocated "
|
||||
<< "by osrm-datastore? [type 'Y' to confirm]";
|
||||
osrm::util::SimpleLogger().Write()
|
||||
<< "This tool may put osrm-routed into an undefined state!";
|
||||
osrm::util::SimpleLogger().Write()
|
||||
<< "Type 'Y' to acknowledge that you know what your are doing.";
|
||||
osrm::util::SimpleLogger().Write()
|
||||
<< "\n\nDo you want to purge all shared memory allocated "
|
||||
<< "by osrm-datastore? [type 'Y' to confirm]";
|
||||
|
||||
const auto letter = getchar();
|
||||
if (letter != 'Y')
|
||||
|
||||
Reference in New Issue
Block a user