Runs scripts/format.sh
This commit is contained in:
committed by
Patrick Niklaus
parent
bb06e044f5
commit
7c30ea32bf
@@ -28,14 +28,8 @@ namespace json
|
||||
namespace detail
|
||||
{
|
||||
|
||||
const constexpr char *modifier_names[] = {"uturn",
|
||||
"sharp right",
|
||||
"right",
|
||||
"slight right",
|
||||
"straight",
|
||||
"slight left",
|
||||
"left",
|
||||
"sharp left"};
|
||||
const constexpr char *modifier_names[] = {"uturn", "sharp right", "right", "slight right",
|
||||
"straight", "slight left", "left", "sharp left"};
|
||||
|
||||
// translations of TurnTypes. Not all types are exposed to the outside world.
|
||||
// invalid types should never be returned as part of the API
|
||||
|
||||
@@ -59,8 +59,8 @@ Status ViaRoutePlugin::HandleRequest(const api::RouteParameters &route_parameter
|
||||
auto snapped_phantoms = SnapPhantomNodes(phantom_node_pairs);
|
||||
|
||||
InternalRouteResult raw_route;
|
||||
auto build_phantom_pairs =
|
||||
[&raw_route](const PhantomNode &first_node, const PhantomNode &second_node)
|
||||
auto build_phantom_pairs = [&raw_route](const PhantomNode &first_node,
|
||||
const PhantomNode &second_node)
|
||||
{
|
||||
raw_route.segment_end_coordinates.push_back(PhantomNodes{first_node, second_node});
|
||||
};
|
||||
|
||||
@@ -70,10 +70,15 @@ std::string encodePolyline(CoordVectorForwardIter begin, CoordVectorForwardIter
|
||||
delta_numbers.reserve((size - 1) * 2);
|
||||
int current_lat = 0;
|
||||
int current_lon = 0;
|
||||
std::for_each(begin, end, [&delta_numbers, ¤t_lat, ¤t_lon](const util::Coordinate loc)
|
||||
std::for_each(begin, end,
|
||||
[&delta_numbers, ¤t_lat, ¤t_lon](const util::Coordinate loc)
|
||||
{
|
||||
const int lat_diff = std::round(static_cast<int>(loc.lat) * detail::COORDINATE_TO_POLYLINE) - current_lat;
|
||||
const int lon_diff = std::round(static_cast<int>(loc.lon) * detail::COORDINATE_TO_POLYLINE) - current_lon;
|
||||
const int lat_diff =
|
||||
std::round(static_cast<int>(loc.lat) * detail::COORDINATE_TO_POLYLINE) -
|
||||
current_lat;
|
||||
const int lon_diff =
|
||||
std::round(static_cast<int>(loc.lon) * detail::COORDINATE_TO_POLYLINE) -
|
||||
current_lon;
|
||||
delta_numbers.emplace_back(lat_diff);
|
||||
delta_numbers.emplace_back(lon_diff);
|
||||
current_lat += lat_diff;
|
||||
|
||||
@@ -78,7 +78,7 @@ void CompressedEdgeContainer::SerializeInternalVector(const std::string &path) c
|
||||
const unsigned unpacked_size = current_vector.size();
|
||||
control_sum += unpacked_size;
|
||||
BOOST_ASSERT(std::numeric_limits<unsigned>::max() != unpacked_size);
|
||||
for (const auto & current_node : current_vector)
|
||||
for (const auto ¤t_node : current_vector)
|
||||
{
|
||||
geometry_out_stream.write((char *)&(current_node), sizeof(CompressedEdge));
|
||||
}
|
||||
@@ -143,7 +143,7 @@ void CompressedEdgeContainer::CompressEdge(const EdgeID edge_id_1,
|
||||
// weight1 is the distance to the (currently) last coordinate in the bucket
|
||||
if (edge_bucket_list1.empty())
|
||||
{
|
||||
edge_bucket_list1.emplace_back(CompressedEdge { via_node_id, weight1 });
|
||||
edge_bucket_list1.emplace_back(CompressedEdge{via_node_id, weight1});
|
||||
}
|
||||
|
||||
BOOST_ASSERT(0 < edge_bucket_list1.size());
|
||||
@@ -174,11 +174,11 @@ void CompressedEdgeContainer::CompressEdge(const EdgeID edge_id_1,
|
||||
else
|
||||
{
|
||||
// we are certain that the second edge is atomic.
|
||||
edge_bucket_list1.emplace_back( CompressedEdge { target_node_id, weight2 });
|
||||
edge_bucket_list1.emplace_back(CompressedEdge{target_node_id, weight2});
|
||||
}
|
||||
}
|
||||
|
||||
void CompressedEdgeContainer::AddUncompressedEdge(const EdgeID edge_id,
|
||||
void CompressedEdgeContainer::AddUncompressedEdge(const EdgeID edge_id,
|
||||
const NodeID target_node_id,
|
||||
const EdgeWeight weight)
|
||||
{
|
||||
@@ -215,12 +215,10 @@ void CompressedEdgeContainer::AddUncompressedEdge(const EdgeID edge_id,
|
||||
// Don't re-add this if it's already in there.
|
||||
if (edge_bucket_list.empty())
|
||||
{
|
||||
edge_bucket_list.emplace_back(CompressedEdge { target_node_id, weight });
|
||||
edge_bucket_list.emplace_back(CompressedEdge{target_node_id, weight});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CompressedEdgeContainer::PrintStatistics() const
|
||||
{
|
||||
const uint64_t compressed_edges = m_compressed_geometries.size();
|
||||
|
||||
@@ -278,8 +278,7 @@ int Extractor::run()
|
||||
|
||||
util::SimpleLogger().Write() << "Saving edge-based node weights to file.";
|
||||
TIMER_START(timer_write_node_weights);
|
||||
util::serializeVector(config.edge_based_node_weights_output_path,
|
||||
edge_based_node_weights);
|
||||
util::serializeVector(config.edge_based_node_weights_output_path, edge_based_node_weights);
|
||||
TIMER_STOP(timer_write_node_weights);
|
||||
util::SimpleLogger().Write() << "Done writing. (" << TIMER_SEC(timer_write_node_weights)
|
||||
<< ")";
|
||||
|
||||
@@ -41,9 +41,7 @@ void ExtractorCallbacks::ProcessNode(const osmium::Node &input_node,
|
||||
external_memory.all_nodes_list.push_back(
|
||||
{util::toFixed(util::FloatLongitude(input_node.location().lon())),
|
||||
util::toFixed(util::FloatLatitude(input_node.location().lat())),
|
||||
OSMNodeID(input_node.id()),
|
||||
result_node.barrier,
|
||||
result_node.traffic_lights});
|
||||
OSMNodeID(input_node.id()), result_node.barrier, result_node.traffic_lights});
|
||||
}
|
||||
|
||||
void ExtractorCallbacks::ProcessRestriction(
|
||||
@@ -125,8 +123,8 @@ void ExtractorCallbacks::ProcessWay(const osmium::Way &input_way, const Extracti
|
||||
if (forward_weight_data.type == InternalExtractorEdge::WeightType::INVALID &&
|
||||
backward_weight_data.type == InternalExtractorEdge::WeightType::INVALID)
|
||||
{
|
||||
util::SimpleLogger().Write(logDEBUG)
|
||||
<< "found way with bogus speed, id: " << input_way.id();
|
||||
util::SimpleLogger().Write(logDEBUG) << "found way with bogus speed, id: "
|
||||
<< input_way.id();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -187,11 +185,9 @@ void ExtractorCallbacks::ProcessWay(const osmium::Way &input_way, const Extracti
|
||||
});
|
||||
|
||||
external_memory.way_start_end_id_list.push_back(
|
||||
{OSMWayID(input_way.id()),
|
||||
OSMNodeID(input_way.nodes().back().ref()),
|
||||
{OSMWayID(input_way.id()), OSMNodeID(input_way.nodes().back().ref()),
|
||||
OSMNodeID(input_way.nodes()[input_way.nodes().size() - 2].ref()),
|
||||
OSMNodeID(input_way.nodes()[1].ref()),
|
||||
OSMNodeID(input_way.nodes()[0].ref())});
|
||||
OSMNodeID(input_way.nodes()[1].ref()), OSMNodeID(input_way.nodes()[0].ref())});
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -223,11 +219,9 @@ void ExtractorCallbacks::ProcessWay(const osmium::Way &input_way, const Extracti
|
||||
}
|
||||
|
||||
external_memory.way_start_end_id_list.push_back(
|
||||
{OSMWayID(input_way.id()),
|
||||
OSMNodeID(input_way.nodes().back().ref()),
|
||||
{OSMWayID(input_way.id()), OSMNodeID(input_way.nodes().back().ref()),
|
||||
OSMNodeID(input_way.nodes()[input_way.nodes().size() - 2].ref()),
|
||||
OSMNodeID(input_way.nodes()[1].ref()),
|
||||
OSMNodeID(input_way.nodes()[0].ref())});
|
||||
OSMNodeID(input_way.nodes()[1].ref()), OSMNodeID(input_way.nodes()[0].ref())});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,12 +156,10 @@ void GraphCompressor::Compress(const std::unordered_set<NodeID> &barrier_nodes,
|
||||
restriction_map.FixupArrivingTurnRestriction(node_w, node_v, node_u, graph);
|
||||
|
||||
// store compressed geometry in container
|
||||
geometry_compressor.CompressEdge(
|
||||
forward_e1, forward_e2, node_v, node_w,
|
||||
forward_weight1, forward_weight2);
|
||||
geometry_compressor.CompressEdge(
|
||||
reverse_e1, reverse_e2, node_v, node_u,
|
||||
reverse_weight1, reverse_weight2);
|
||||
geometry_compressor.CompressEdge(forward_e1, forward_e2, node_v, node_w,
|
||||
forward_weight1, forward_weight2);
|
||||
geometry_compressor.CompressEdge(reverse_e1, reverse_e2, node_v, node_u,
|
||||
reverse_weight1, reverse_weight2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,7 +177,6 @@ void GraphCompressor::Compress(const std::unordered_set<NodeID> &barrier_nodes,
|
||||
geometry_compressor.AddUncompressedEdge(edge_id, target, data.distance);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void GraphCompressor::PrintStatistics(unsigned original_number_of_nodes,
|
||||
|
||||
@@ -29,14 +29,12 @@ namespace osrm
|
||||
namespace server
|
||||
{
|
||||
|
||||
|
||||
void RequestHandler::RegisterServiceHandler(std::unique_ptr<ServiceHandler> service_handler_)
|
||||
{
|
||||
service_handler = std::move(service_handler_);
|
||||
}
|
||||
|
||||
void RequestHandler::HandleRequest(const http::request ¤t_request,
|
||||
http::reply ¤t_reply)
|
||||
void RequestHandler::HandleRequest(const http::request ¤t_request, http::reply ¤t_reply)
|
||||
{
|
||||
if (!service_handler)
|
||||
{
|
||||
@@ -78,15 +76,16 @@ void RequestHandler::HandleRequest(const http::request ¤t_request,
|
||||
<< request_string;
|
||||
|
||||
auto api_iterator = request_string.begin();
|
||||
auto maybe_parsed_url = api::parseURL(api_iterator, request_string.end());;
|
||||
auto maybe_parsed_url = api::parseURL(api_iterator, request_string.end());
|
||||
;
|
||||
ServiceHandler::ResultT result;
|
||||
|
||||
|
||||
// check if the was an error with the request
|
||||
if (maybe_parsed_url && api_iterator == request_string.end())
|
||||
{
|
||||
|
||||
const engine::Status status = service_handler->RunQuery(std::move(*maybe_parsed_url), result);
|
||||
const engine::Status status =
|
||||
service_handler->RunQuery(std::move(*maybe_parsed_url), result);
|
||||
if (status != engine::Status::Ok)
|
||||
{
|
||||
// 4xx bad request return code
|
||||
@@ -101,18 +100,18 @@ void RequestHandler::HandleRequest(const http::request ¤t_request,
|
||||
{
|
||||
const auto position = std::distance(request_string.begin(), api_iterator);
|
||||
const auto context_begin = request_string.begin() + std::max(position - 3UL, 0UL);
|
||||
const auto context_end = request_string.begin() + std::min(position + 3UL, request_string.size());
|
||||
const auto context_end =
|
||||
request_string.begin() + std::min(position + 3UL, request_string.size());
|
||||
std::string context(context_begin, context_end);
|
||||
|
||||
current_reply.status = http::reply::bad_request;
|
||||
result = util::json::Object();
|
||||
auto& json_result = result.get<util::json::Object>();
|
||||
auto &json_result = result.get<util::json::Object>();
|
||||
json_result.values["code"] = "invalid-url";
|
||||
json_result.values["message"] =
|
||||
"URL string malformed close to position " + std::to_string(position) + ": \"" + context + "\"";
|
||||
json_result.values["message"] = "URL string malformed close to position " +
|
||||
std::to_string(position) + ": \"" + context + "\"";
|
||||
}
|
||||
|
||||
|
||||
current_reply.headers.emplace_back("Access-Control-Allow-Origin", "*");
|
||||
current_reply.headers.emplace_back("Access-Control-Allow-Methods", "GET");
|
||||
current_reply.headers.emplace_back("Access-Control-Allow-Headers",
|
||||
@@ -121,14 +120,15 @@ void RequestHandler::HandleRequest(const http::request ¤t_request,
|
||||
{
|
||||
current_reply.headers.emplace_back("Content-Type", "application/json; charset=UTF-8");
|
||||
current_reply.headers.emplace_back("Content-Disposition",
|
||||
"inline; filename=\"response.json\"");
|
||||
"inline; filename=\"response.json\"");
|
||||
|
||||
util::json::render(current_reply.content, result.get<util::json::Object>());
|
||||
}
|
||||
else
|
||||
{
|
||||
BOOST_ASSERT(result.is<std::string>());
|
||||
std::copy(result.get<std::string>().cbegin(), result.get<std::string>().cend(), std::back_inserter(current_reply.content));
|
||||
std::copy(result.get<std::string>().cbegin(), result.get<std::string>().cend(),
|
||||
std::back_inserter(current_reply.content));
|
||||
|
||||
current_reply.headers.emplace_back("Content-Type", "application/x-protobuf");
|
||||
}
|
||||
@@ -144,6 +144,5 @@ void RequestHandler::HandleRequest(const http::request ¤t_request,
|
||||
<< ", uri: " << current_request.uri;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,8 @@ RequestParser::parse(http::request ¤t_request, char *begin, char *end)
|
||||
return std::make_tuple(result, selected_compression);
|
||||
}
|
||||
|
||||
RequestParser::RequestStatus RequestParser::consume(http::request ¤t_request, const char input)
|
||||
RequestParser::RequestStatus RequestParser::consume(http::request ¤t_request,
|
||||
const char input)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
|
||||
@@ -43,7 +43,7 @@ std::string getWrongOptionHelp(const engine::api::MatchParameters ¶meters)
|
||||
engine::Status MatchService::RunQuery(std::string &query, ResultT &result)
|
||||
{
|
||||
result = util::json::Object();
|
||||
auto& json_result = result.get<util::json::Object>();
|
||||
auto &json_result = result.get<util::json::Object>();
|
||||
|
||||
auto query_iterator = query.begin();
|
||||
auto parameters =
|
||||
|
||||
@@ -42,7 +42,7 @@ std::string getWrongOptionHelp(const engine::api::NearestParameters ¶meters)
|
||||
engine::Status NearestService::RunQuery(std::string &query, ResultT &result)
|
||||
{
|
||||
result = util::json::Object();
|
||||
auto& json_result = result.get<util::json::Object>();
|
||||
auto &json_result = result.get<util::json::Object>();
|
||||
|
||||
auto query_iterator = query.begin();
|
||||
auto parameters =
|
||||
|
||||
@@ -25,7 +25,8 @@ ServiceHandler::ServiceHandler(osrm::EngineConfig &config) : routing_machine(con
|
||||
service_map["tile"] = util::make_unique<service::TileService>(routing_machine);
|
||||
}
|
||||
|
||||
engine::Status ServiceHandler::RunQuery(api::ParsedURL parsed_url, service::BaseService::ResultT &result)
|
||||
engine::Status ServiceHandler::RunQuery(api::ParsedURL parsed_url,
|
||||
service::BaseService::ResultT &result)
|
||||
{
|
||||
const auto &service_iter = service_map.find(parsed_url.service);
|
||||
if (service_iter == service_map.end())
|
||||
|
||||
@@ -320,8 +320,8 @@ int Storage::Run()
|
||||
boost::iostreams::seek(geometry_input_stream, number_of_geometries_indices * sizeof(unsigned),
|
||||
BOOST_IOS::cur);
|
||||
geometry_input_stream.read((char *)&number_of_compressed_geometries, sizeof(unsigned));
|
||||
shared_layout_ptr->SetBlockSize<extractor::CompressedEdgeContainer::CompressedEdge>(SharedDataLayout::GEOMETRIES_LIST,
|
||||
number_of_compressed_geometries);
|
||||
shared_layout_ptr->SetBlockSize<extractor::CompressedEdgeContainer::CompressedEdge>(
|
||||
SharedDataLayout::GEOMETRIES_LIST, number_of_compressed_geometries);
|
||||
// allocate shared memory block
|
||||
util::SimpleLogger().Write() << "allocating shared memory of "
|
||||
<< shared_layout_ptr->GetSizeOfLayout() << " bytes";
|
||||
@@ -420,8 +420,9 @@ int Storage::Run()
|
||||
(char *)geometries_index_ptr,
|
||||
shared_layout_ptr->GetBlockSize(SharedDataLayout::GEOMETRIES_INDEX));
|
||||
}
|
||||
extractor::CompressedEdgeContainer::CompressedEdge *geometries_list_ptr = shared_layout_ptr->GetBlockPtr<extractor::CompressedEdgeContainer::CompressedEdge, true>(
|
||||
shared_memory_ptr, SharedDataLayout::GEOMETRIES_LIST);
|
||||
extractor::CompressedEdgeContainer::CompressedEdge *geometries_list_ptr =
|
||||
shared_layout_ptr->GetBlockPtr<extractor::CompressedEdgeContainer::CompressedEdge, true>(
|
||||
shared_memory_ptr, SharedDataLayout::GEOMETRIES_LIST);
|
||||
|
||||
geometry_input_stream.read((char *)&temporary_value, sizeof(unsigned));
|
||||
BOOST_ASSERT(temporary_value ==
|
||||
|
||||
@@ -114,8 +114,7 @@ int main(int argc, char *argv[]) try
|
||||
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();
|
||||
|
||||
@@ -181,8 +180,7 @@ int main(int argc, char *argv[]) try
|
||||
{
|
||||
total_network_length +=
|
||||
100 * osrm::util::coordinate_calculation::greatCircleDistance(
|
||||
coordinate_list[source],
|
||||
coordinate_list[target]);
|
||||
coordinate_list[source], coordinate_list[target]);
|
||||
|
||||
BOOST_ASSERT(current_edge != SPECIAL_EDGEID);
|
||||
BOOST_ASSERT(source != SPECIAL_NODEID);
|
||||
@@ -203,8 +201,7 @@ int main(int argc, char *argv[]) try
|
||||
static_cast<double>(osrm::util::toFloating(coordinate_list[target].lon)),
|
||||
static_cast<double>(osrm::util::toFloating(coordinate_list[target].lat)));
|
||||
|
||||
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))
|
||||
@@ -223,8 +220,8 @@ int main(int argc, char *argv[]) try
|
||||
<< "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";
|
||||
<< "total network distance: " << static_cast<uint64_t>(total_network_length / 100 / 1000.)
|
||||
<< " km";
|
||||
|
||||
osrm::util::SimpleLogger().Write() << "finished component analysis";
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
@@ -29,10 +29,11 @@ return_code parseArguments(int argc, char *argv[], extractor::ExtractorConfig &e
|
||||
|
||||
// declare a group of options that will be allowed both on command line
|
||||
boost::program_options::options_description config_options("Configuration");
|
||||
config_options.add_options()("profile,p",
|
||||
boost::program_options::value<boost::filesystem::path>(
|
||||
&extractor_config.profile_path)->default_value("profile.lua"),
|
||||
"Path to LUA routing profile")(
|
||||
config_options.add_options()(
|
||||
"profile,p",
|
||||
boost::program_options::value<boost::filesystem::path>(&extractor_config.profile_path)
|
||||
->default_value("profile.lua"),
|
||||
"Path to LUA routing profile")(
|
||||
"threads,t",
|
||||
boost::program_options::value<unsigned int>(&extractor_config.requested_num_threads)
|
||||
->default_value(tbb::task_scheduler_init::default_num_threads()),
|
||||
@@ -42,8 +43,9 @@ return_code parseArguments(int argc, char *argv[], extractor::ExtractorConfig &e
|
||||
->implicit_value(true)
|
||||
->default_value(false),
|
||||
"Generate a lookup table for internal edge-expanded-edge IDs to OSM node pairs")(
|
||||
"small-component-size", boost::program_options::value<unsigned int>(
|
||||
&extractor_config.small_component_size)->default_value(1000),
|
||||
"small-component-size",
|
||||
boost::program_options::value<unsigned int>(&extractor_config.small_component_size)
|
||||
->default_value(1000),
|
||||
"Number of nodes required before a strongly-connected-componennt is considered big "
|
||||
"(affects nearest neighbor snapping)");
|
||||
|
||||
|
||||
+11
-20
@@ -64,8 +64,7 @@ int main(int argc, char *argv[]) try
|
||||
osrm::util::LogPolicy::GetInstance().Unmute();
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -89,8 +88,7 @@ int main(int argc, char *argv[]) try
|
||||
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
|
||||
@@ -148,8 +146,7 @@ int main(int argc, char *argv[]) try
|
||||
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__
|
||||
@@ -158,8 +155,7 @@ int main(int argc, char *argv[]) try
|
||||
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);
|
||||
close(file_desc);
|
||||
@@ -168,8 +164,8 @@ int main(int argc, char *argv[]) try
|
||||
#endif
|
||||
TIMER_STOP(read_1gb);
|
||||
|
||||
osrm::util::SimpleLogger().Write(logDEBUG) << "reading raw 1GB took "
|
||||
<< TIMER_SEC(read_1gb) << "s";
|
||||
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";
|
||||
@@ -184,8 +180,7 @@ int main(int argc, char *argv[]) try
|
||||
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);
|
||||
@@ -212,15 +207,13 @@ int main(int argc, char *argv[]) try
|
||||
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));
|
||||
@@ -274,15 +267,13 @@ int main(int argc, char *argv[]) try
|
||||
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));
|
||||
|
||||
@@ -60,13 +60,11 @@ int main() try
|
||||
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() << "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() << "\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