Run clang-format

This commit is contained in:
Patrick Niklaus
2016-01-08 01:31:57 +01:00
parent 6b18e4f7e9
commit 6991a38703
149 changed files with 457 additions and 498 deletions
+3 -2
View File
@@ -23,7 +23,8 @@ constexpr int32_t WORLD_MAX_LON = 180 * COORDINATE_PRECISION;
using RTreeLeaf = extractor::EdgeBasedNode;
using FixedPointCoordinateListPtr = std::shared_ptr<std::vector<util::FixedPointCoordinate>>;
using BenchStaticRTree = util::StaticRTree<RTreeLeaf, util::ShM<util::FixedPointCoordinate, false>::vector, false>;
using BenchStaticRTree =
util::StaticRTree<RTreeLeaf, util::ShM<util::FixedPointCoordinate, false>::vector, false>;
using BenchQuery = engine::GeospatialQuery<BenchStaticRTree>;
FixedPointCoordinateListPtr loadCoordinates(const boost::filesystem::path &nodes_file)
@@ -56,7 +57,7 @@ void benchmarkQuery(const std::vector<FixedPointCoordinate> &queries,
for (const auto &q : queries)
{
auto result = query(q);
(void) result;
(void)result;
}
TIMER_STOP(query);
+36 -30
View File
@@ -42,7 +42,6 @@ template <> struct hash<std::pair<OSMNodeID, OSMNodeID>>
};
}
namespace osrm
{
namespace contractor
@@ -105,19 +104,20 @@ int Prepare::Run()
util::SimpleLogger().Write() << "Preprocessing : " << TIMER_SEC(preparing) << " seconds";
util::SimpleLogger().Write() << "Contraction: " << ((max_edge_id + 1) / TIMER_SEC(contraction))
<< " nodes/sec and " << number_of_used_edges / TIMER_SEC(contraction)
<< " edges/sec";
<< " nodes/sec and "
<< number_of_used_edges / TIMER_SEC(contraction) << " edges/sec";
util::SimpleLogger().Write() << "finished preprocessing";
return 0;
}
std::size_t Prepare::LoadEdgeExpandedGraph(std::string const &edge_based_graph_filename,
util::DeallocatingVector<extractor::EdgeBasedEdge> &edge_based_edge_list,
const std::string &edge_segment_lookup_filename,
const std::string &edge_penalty_filename,
const std::string &segment_speed_filename)
std::size_t Prepare::LoadEdgeExpandedGraph(
std::string const &edge_based_graph_filename,
util::DeallocatingVector<extractor::EdgeBasedEdge> &edge_based_edge_list,
const std::string &edge_segment_lookup_filename,
const std::string &edge_penalty_filename,
const std::string &segment_speed_filename)
{
util::SimpleLogger().Write() << "Opening " << edge_based_graph_filename;
boost::filesystem::ifstream input_stream(edge_based_graph_filename, std::ios::binary);
@@ -149,14 +149,16 @@ std::size_t Prepare::LoadEdgeExpandedGraph(std::string const &edge_based_graph_f
input_stream.read((char *)&max_edge_id, sizeof(size_t));
edge_based_edge_list.resize(number_of_edges);
util::SimpleLogger().Write() << "Reading " << number_of_edges << " edges from the edge based graph";
util::SimpleLogger().Write() << "Reading " << number_of_edges
<< " edges from the edge based graph";
std::unordered_map<std::pair<OSMNodeID, OSMNodeID>, unsigned> segment_speed_lookup;
if (update_edge_weights)
{
util::SimpleLogger().Write() << "Segment speed data supplied, will update edge weights from "
<< segment_speed_filename;
util::SimpleLogger().Write()
<< "Segment speed data supplied, will update edge weights from "
<< segment_speed_filename;
io::CSVReader<3> csv_in(segment_speed_filename);
csv_in.set_header("from_node", "to_node", "speed");
uint64_t from_node_id{};
@@ -218,8 +220,8 @@ std::size_t Prepare::LoadEdgeExpandedGraph(std::string const &edge_based_graph_f
(segment_length * 10.) / (speed_iter->second / 3.6) + .5)));
new_weight += new_segment_weight;
util::DEBUG_GEOMETRY_EDGE(new_segment_weight, segment_length, previous_osm_node_id,
this_osm_node_id);
util::DEBUG_GEOMETRY_EDGE(new_segment_weight, segment_length,
previous_osm_node_id, this_osm_node_id);
}
else
{
@@ -227,7 +229,7 @@ std::size_t Prepare::LoadEdgeExpandedGraph(std::string const &edge_based_graph_f
new_weight += segment_weight;
util::DEBUG_GEOMETRY_EDGE(segment_weight, segment_length, previous_osm_node_id,
this_osm_node_id);
this_osm_node_id);
}
previous_osm_node_id = this_osm_node_id;
@@ -282,14 +284,15 @@ void Prepare::WriteCoreNodeMarker(std::vector<bool> &&in_is_core_node) const
sizeof(char) * unpacked_bool_flags.size());
}
std::size_t Prepare::WriteContractedGraph(unsigned max_node_id,
const util::DeallocatingVector<QueryEdge> &contracted_edge_list)
std::size_t
Prepare::WriteContractedGraph(unsigned max_node_id,
const util::DeallocatingVector<QueryEdge> &contracted_edge_list)
{
// Sorting contracted edges in a way that the static query graph can read some in in-place.
tbb::parallel_sort(contracted_edge_list.begin(), contracted_edge_list.end());
const unsigned contracted_edge_count = contracted_edge_list.size();
util::SimpleLogger().Write() << "Serializing compacted graph of " << contracted_edge_count
<< " edges";
<< " edges";
const util::FingerPrint fingerprint = util::FingerPrint::GetValid();
boost::filesystem::ofstream hsgr_output_stream(config.graph_output_path, std::ios::binary);
@@ -308,7 +311,8 @@ std::size_t Prepare::WriteContractedGraph(unsigned max_node_id,
}();
util::SimpleLogger().Write(logDEBUG) << "input graph has " << (max_node_id + 1) << " nodes";
util::SimpleLogger().Write(logDEBUG) << "contracted graph has " << (max_used_node_id + 1) << " nodes";
util::SimpleLogger().Write(logDEBUG) << "contracted graph has " << (max_used_node_id + 1)
<< " nodes";
std::vector<util::StaticGraph<EdgeData>::NodeArrayEntry> node_array;
// make sure we have at least one sentinel
@@ -355,7 +359,8 @@ std::size_t Prepare::WriteContractedGraph(unsigned max_node_id,
if (node_array_size > 0)
{
hsgr_output_stream.write((char *)&node_array[0],
sizeof(util::StaticGraph<EdgeData>::NodeArrayEntry) * node_array_size);
sizeof(util::StaticGraph<EdgeData>::NodeArrayEntry) *
node_array_size);
}
// serialize all edges
@@ -375,14 +380,14 @@ std::size_t Prepare::WriteContractedGraph(unsigned max_node_id,
#ifndef NDEBUG
if (current_edge.data.distance <= 0)
{
util::SimpleLogger().Write(logWARNING) << "Edge: " << edge
<< ",source: " << contracted_edge_list[edge].source
<< ", target: " << contracted_edge_list[edge].target
<< ", dist: " << current_edge.data.distance;
util::SimpleLogger().Write(logWARNING)
<< "Edge: " << edge << ",source: " << contracted_edge_list[edge].source
<< ", target: " << contracted_edge_list[edge].target
<< ", dist: " << current_edge.data.distance;
util::SimpleLogger().Write(logWARNING) << "Failed at adjacency list of node "
<< contracted_edge_list[edge].source << "/"
<< node_array.size() - 1;
<< contracted_edge_list[edge].source << "/"
<< node_array.size() - 1;
return 1;
}
#endif
@@ -398,11 +403,12 @@ std::size_t Prepare::WriteContractedGraph(unsigned max_node_id,
/**
\brief Build contracted graph.
*/
void Prepare::ContractGraph(const unsigned max_edge_id,
util::DeallocatingVector<extractor::EdgeBasedEdge> &edge_based_edge_list,
util::DeallocatingVector<QueryEdge> &contracted_edge_list,
std::vector<bool> &is_core_node,
std::vector<float> &inout_node_levels) const
void Prepare::ContractGraph(
const unsigned max_edge_id,
util::DeallocatingVector<extractor::EdgeBasedEdge> &edge_based_edge_list,
util::DeallocatingVector<QueryEdge> &contracted_edge_list,
std::vector<bool> &is_core_node,
std::vector<float> &inout_node_levels) const
{
std::vector<float> node_levels;
node_levels.swap(inout_node_levels);
+8 -10
View File
@@ -186,16 +186,14 @@ void CompressedEdgeContainer::PrintStatistics() const
longest_chain_length = std::max(longest_chain_length, (uint64_t)current_vector.size());
}
util::SimpleLogger().Write() << "Geometry successfully removed:"
"\n compressed edges: "
<< compressed_edges
<< "\n compressed geometries: " << compressed_geometries
<< "\n longest chain length: " << longest_chain_length
<< "\n cmpr ratio: " << ((float)compressed_edges /
std::max(compressed_geometries, (uint64_t)1))
<< "\n avg chain length: "
<< (float)compressed_geometries /
std::max((uint64_t)1, compressed_edges);
util::SimpleLogger().Write()
<< "Geometry successfully removed:"
"\n compressed edges: "
<< compressed_edges << "\n compressed geometries: " << compressed_geometries
<< "\n longest chain length: " << longest_chain_length << "\n cmpr ratio: "
<< ((float)compressed_edges / std::max(compressed_geometries, (uint64_t)1))
<< "\n avg chain length: "
<< (float)compressed_geometries / std::max((uint64_t)1, compressed_edges);
}
const CompressedEdgeContainer::EdgeBucket &
+20 -13
View File
@@ -37,7 +37,8 @@ EdgeBasedGraphFactory::EdgeBasedGraphFactory(
{
}
void EdgeBasedGraphFactory::GetEdgeBasedEdges(util::DeallocatingVector<EdgeBasedEdge> &output_edge_list)
void EdgeBasedGraphFactory::GetEdgeBasedEdges(
util::DeallocatingVector<EdgeBasedEdge> &output_edge_list)
{
BOOST_ASSERT_MSG(0 == output_edge_list.size(), "Vector is not empty");
using std::swap; // Koenig swap
@@ -321,7 +322,7 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedNodes()
BOOST_ASSERT(m_edge_based_node_list.size() == m_edge_based_node_is_startpoint.size());
util::SimpleLogger().Write() << "Generated " << m_edge_based_node_list.size()
<< " nodes in edge-expanded graph";
<< " nodes in edge-expanded graph";
}
/// Actually it also generates OriginalEdgeData and serializes them...
@@ -451,7 +452,8 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
{
distance += speed_profile.traffic_signal_penalty;
util::DEBUG_SIGNAL(node_v, m_node_info_list, speed_profile.traffic_signal_penalty);
util::DEBUG_SIGNAL(node_v, m_node_info_list,
speed_profile.traffic_signal_penalty);
}
// unpack last node of first segment if packed
@@ -478,7 +480,8 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
util::DEBUG_UTURN(node_v, m_node_info_list, speed_profile.u_turn_penalty);
}
util::DEBUG_TURN(node_v, m_node_info_list, first_coordinate, turn_angle, turn_penalty);
util::DEBUG_TURN(node_v, m_node_info_list, first_coordinate, turn_angle,
turn_penalty);
distance += turn_penalty;
@@ -546,8 +549,8 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
const QueryNode &from = m_node_info_list[previous];
const QueryNode &to = m_node_info_list[target_node.first];
const double segment_length =
util::coordinate_calculation::greatCircleDistance(from.lat, from.lon,
to.lat, to.lon);
util::coordinate_calculation::greatCircleDistance(
from.lat, from.lon, to.lat, to.lon);
edge_segment_file.write(reinterpret_cast<const char *>(&to.node_id),
sizeof(to.node_id));
@@ -564,8 +567,9 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
static const unsigned node_count = 2;
const QueryNode from = m_node_info_list[node_u];
const QueryNode to = m_node_info_list[node_v];
const double segment_length = util::coordinate_calculation::greatCircleDistance(
from.lat, from.lon, to.lat, to.lon);
const double segment_length =
util::coordinate_calculation::greatCircleDistance(from.lat, from.lon,
to.lat, to.lon);
edge_segment_file.write(reinterpret_cast<const char *>(&node_count),
sizeof(node_count));
edge_segment_file.write(reinterpret_cast<const char *>(&from.node_id),
@@ -591,15 +595,18 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
edge_data_file.write((char *)&original_edges_counter, sizeof(unsigned));
edge_data_file.close();
util::SimpleLogger().Write() << "Generated " << m_edge_based_node_list.size() << " edge based nodes";
util::SimpleLogger().Write() << "Node-based graph contains " << node_based_edge_counter << " edges";
util::SimpleLogger().Write() << "Generated " << m_edge_based_node_list.size()
<< " edge based nodes";
util::SimpleLogger().Write() << "Node-based graph contains " << node_based_edge_counter
<< " edges";
util::SimpleLogger().Write() << "Edge-expanded graph ...";
util::SimpleLogger().Write() << " contains " << m_edge_based_edge_list.size() << " edges";
util::SimpleLogger().Write() << " skips " << restricted_turns_counter << " turns, "
"defined by "
<< m_restriction_map->size() << " restrictions";
"defined by "
<< m_restriction_map->size() << " restrictions";
util::SimpleLogger().Write() << " skips " << skipped_uturns_counter << " U turns";
util::SimpleLogger().Write() << " skips " << skipped_barrier_turns_counter << " turns over barriers";
util::SimpleLogger().Write() << " skips " << skipped_barrier_turns_counter
<< " turns over barriers";
}
int EdgeBasedGraphFactory::GetTurnPenalty(double angle, lua_State *lua_state) const
+12 -9
View File
@@ -218,7 +218,7 @@ void ExtractionContainers::PrepareEdges(lua_State *segment_state)
if (edge_iterator->result.osm_source_id < node_iterator->node_id)
{
util::SimpleLogger().Write(LogLevel::logWARNING) << "Found invalid node reference "
<< edge_iterator->result.source;
<< edge_iterator->result.source;
edge_iterator->result.source = SPECIAL_NODEID;
++edge_iterator;
continue;
@@ -255,7 +255,7 @@ void ExtractionContainers::PrepareEdges(lua_State *segment_state)
auto markSourcesInvalid = [](InternalExtractorEdge &edge)
{
util::SimpleLogger().Write(LogLevel::logWARNING) << "Found invalid node reference "
<< edge.result.source;
<< edge.result.source;
edge.result.source = SPECIAL_NODEID;
edge.result.osm_source_id = SPECIAL_OSM_NODEID;
};
@@ -362,7 +362,7 @@ void ExtractionContainers::PrepareEdges(lua_State *segment_state)
auto markTargetsInvalid = [](InternalExtractorEdge &edge)
{
util::SimpleLogger().Write(LogLevel::logWARNING) << "Found invalid node reference "
<< edge.result.target;
<< edge.result.target;
edge.result.target = SPECIAL_NODEID;
};
std::for_each(edge_iterator, all_edges_list_end_, markTargetsInvalid);
@@ -614,8 +614,9 @@ void ExtractionContainers::PrepareRestrictions()
if (way_start_and_end_iterator->way_id >
OSMWayID(restrictions_iterator->restriction.from.way))
{
util::SimpleLogger().Write(LogLevel::logDEBUG) << "Restriction references invalid way: "
<< restrictions_iterator->restriction.from.way;
util::SimpleLogger().Write(LogLevel::logDEBUG)
<< "Restriction references invalid way: "
<< restrictions_iterator->restriction.from.way;
restrictions_iterator->restriction.from.node = SPECIAL_NODEID;
++restrictions_iterator;
continue;
@@ -630,8 +631,9 @@ void ExtractionContainers::PrepareRestrictions()
auto via_id_iter = external_to_internal_node_id_map.find(via_node_id);
if (via_id_iter == external_to_internal_node_id_map.end())
{
util::SimpleLogger().Write(LogLevel::logDEBUG) << "Restriction references invalid node: "
<< restrictions_iterator->restriction.via.node;
util::SimpleLogger().Write(LogLevel::logDEBUG)
<< "Restriction references invalid node: "
<< restrictions_iterator->restriction.via.node;
restrictions_iterator->restriction.via.node = SPECIAL_NODEID;
++restrictions_iterator;
continue;
@@ -691,8 +693,9 @@ void ExtractionContainers::PrepareRestrictions()
if (way_start_and_end_iterator->way_id >
OSMWayID(restrictions_iterator->restriction.to.way))
{
util::SimpleLogger().Write(LogLevel::logDEBUG) << "Restriction references invalid way: "
<< restrictions_iterator->restriction.to.way;
util::SimpleLogger().Write(LogLevel::logDEBUG)
<< "Restriction references invalid way: "
<< restrictions_iterator->restriction.to.way;
restrictions_iterator->restriction.to.way = SPECIAL_NODEID;
++restrictions_iterator;
continue;
+23 -20
View File
@@ -219,12 +219,13 @@ int extractor::run()
}
}
TIMER_STOP(parsing);
util::SimpleLogger().Write() << "Parsing finished after " << TIMER_SEC(parsing) << " seconds";
util::SimpleLogger().Write() << "Parsing finished after " << TIMER_SEC(parsing)
<< " seconds";
util::SimpleLogger().Write() << "Raw input contains " << number_of_nodes.load() << " nodes, "
<< number_of_ways.load() << " ways, and "
<< number_of_relations.load() << " relations, and "
<< number_of_others.load() << " unknown entities";
util::SimpleLogger().Write() << "Raw input contains " << number_of_nodes.load()
<< " nodes, " << number_of_ways.load() << " ways, and "
<< number_of_relations.load() << " relations, and "
<< number_of_others.load() << " unknown entities";
extractor_callbacks.reset();
@@ -238,7 +239,8 @@ int extractor::run()
config.names_file_name, segment_state);
TIMER_STOP(extracting);
util::SimpleLogger().Write() << "extraction finished after " << TIMER_SEC(extracting) << "s";
util::SimpleLogger().Write() << "extraction finished after " << TIMER_SEC(extracting)
<< "s";
}
catch (const std::exception &e)
{
@@ -287,12 +289,11 @@ int extractor::run()
WriteEdgeBasedGraph(config.edge_graph_output_path, max_edge_id, edge_based_edge_list);
util::SimpleLogger().Write() << "Expansion : "
<< (number_of_node_based_nodes / TIMER_SEC(expansion))
<< " nodes/sec and " << ((max_edge_id + 1) / TIMER_SEC(expansion))
<< " edges/sec";
util::SimpleLogger().Write()
<< "Expansion : " << (number_of_node_based_nodes / TIMER_SEC(expansion))
<< " nodes/sec and " << ((max_edge_id + 1) / TIMER_SEC(expansion)) << " edges/sec";
util::SimpleLogger().Write() << "To prepare the data for routing, run: "
<< "./osrm-prepare " << config.output_file_name << std::endl;
<< "./osrm-prepare " << config.output_file_name << std::endl;
}
catch (const std::exception &e)
{
@@ -332,7 +333,7 @@ void extractor::SetupScriptingEnvironment(lua_State *lua_state,
}
speed_profile.traffic_signal_penalty = 10 * lua_tointeger(lua_state, -1);
util::SimpleLogger().Write(logDEBUG) << "traffic_signal_penalty: "
<< speed_profile.traffic_signal_penalty;
<< speed_profile.traffic_signal_penalty;
if (0 != luaL_dostring(lua_state, "return u_turn_penalty\n"))
{
@@ -455,7 +456,7 @@ extractor::LoadNodeBasedGraph(std::unordered_set<NodeID> &barrier_nodes,
input_stream, barrier_list, traffic_light_list, internal_to_external_node_map);
util::SimpleLogger().Write() << " - " << barrier_list.size() << " bollard nodes, "
<< traffic_light_list.size() << " traffic lights";
<< traffic_light_list.size() << " traffic lights";
// insert into unordered sets for fast lookup
barrier_nodes.insert(barrier_list.begin(), barrier_list.end());
@@ -556,8 +557,8 @@ void extractor::BuildRTree(std::vector<EdgeBasedNode> node_based_edge_list,
const std::vector<QueryNode> &internal_to_external_node_map)
{
util::SimpleLogger().Write() << "constructing r-tree of " << node_based_edge_list.size()
<< " edge elements build on-top of "
<< internal_to_external_node_map.size() << " coordinates";
<< " edge elements build on-top of "
<< internal_to_external_node_map.size() << " coordinates";
BOOST_ASSERT(node_is_startpoint.size() == node_based_edge_list.size());
@@ -579,16 +580,18 @@ void extractor::BuildRTree(std::vector<EdgeBasedNode> node_based_edge_list,
TIMER_START(construction);
util::StaticRTree<EdgeBasedNode> rtree(node_based_edge_list, config.rtree_nodes_output_path,
config.rtree_leafs_output_path, internal_to_external_node_map);
config.rtree_leafs_output_path,
internal_to_external_node_map);
TIMER_STOP(construction);
util::SimpleLogger().Write() << "finished r-tree construction in " << TIMER_SEC(construction)
<< " seconds";
<< " seconds";
}
void extractor::WriteEdgeBasedGraph(std::string const &output_file_filename,
size_t const max_edge_id,
util::DeallocatingVector<EdgeBasedEdge> const &edge_based_edge_list)
void extractor::WriteEdgeBasedGraph(
std::string const &output_file_filename,
size_t const max_edge_id,
util::DeallocatingVector<EdgeBasedEdge> const &edge_based_edge_list)
{
std::ofstream file_out_stream;
+3 -2
View File
@@ -85,7 +85,7 @@ void ExtractorCallbacks::ProcessWay(const osmium::Way &input_way, const Extracti
if (std::numeric_limits<decltype(input_way.id())>::max() == input_way.id())
{
util::SimpleLogger().Write(logDEBUG) << "found bogus way with id: " << input_way.id()
<< " of size " << input_way.nodes().size();
<< " of size " << input_way.nodes().size();
return;
}
@@ -123,7 +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;
}
+1 -1
View File
@@ -108,7 +108,7 @@ ExtractorOptions::ParseArguments(int argc, char *argv[], ExtractorConfig &extrac
if (boost::filesystem::is_regular_file(extractor_config.config_file_path))
{
util::SimpleLogger().Write() << "Reading options from: "
<< extractor_config.config_file_path.string();
<< extractor_config.config_file_path.string();
std::string ini_file_contents =
util::read_file_lower_content(extractor_config.config_file_path);
std::stringstream config_stream(ini_file_contents);
+2 -2
View File
@@ -183,9 +183,9 @@ void GraphCompressor::PrintStatistics(unsigned original_number_of_nodes,
}
}
util::SimpleLogger().Write() << "Node compression ratio: "
<< new_node_count / (double)original_number_of_nodes;
<< new_node_count / (double)original_number_of_nodes;
util::SimpleLogger().Write() << "Edge compression ratio: "
<< new_edge_count / (double)original_number_of_edges;
<< new_edge_count / (double)original_number_of_edges;
}
}
}
+3 -2
View File
@@ -93,7 +93,7 @@ int SourceContainer::loadRasterSource(const std::string &path_string,
if (itr != LoadedSourcePaths.end())
{
util::SimpleLogger().Write() << "[source loader] Already loaded source '" << path_string
<< "' at source_id " << itr->second;
<< "' at source_id " << itr->second;
return itr->second;
}
@@ -115,7 +115,8 @@ int SourceContainer::loadRasterSource(const std::string &path_string,
LoadedSourcePaths.emplace(path_string, source_id);
LoadedSources.push_back(std::move(source));
util::SimpleLogger().Write() << "[source loader] ok, after " << TIMER_SEC(loading_source) << "s";
util::SimpleLogger().Write() << "[source loader] ok, after " << TIMER_SEC(loading_source)
<< "s";
return source_id;
}
+3 -2
View File
@@ -24,7 +24,8 @@ namespace osrm
namespace extractor
{
namespace {
namespace
{
int luaErrorCallback(lua_State *lua_state)
{
std::string error_msg = lua_tostring(lua_state, -1);
@@ -70,7 +71,7 @@ void RestrictionParser::ReadRestrictionExceptions(lua_State *lua_state)
boost::ref(restriction_exceptions));
const unsigned exception_count = restriction_exceptions.size();
util::SimpleLogger().Write() << "Found " << exception_count
<< " exceptions to turn restrictions:";
<< " exceptions to turn restrictions:";
for (const std::string &str : restriction_exceptions)
{
util::SimpleLogger().Write() << " " << str;
+11 -13
View File
@@ -53,18 +53,16 @@ void RequestHandler::handle_request(const http::request &current_request,
time_stamp = localtime(&ltime);
// log timestamp
util::SimpleLogger().Write() << (time_stamp->tm_mday < 10 ? "0" : "") << time_stamp->tm_mday
<< "-" << (time_stamp->tm_mon + 1 < 10 ? "0" : "")
<< (time_stamp->tm_mon + 1) << "-" << 1900 + time_stamp->tm_year
<< " " << (time_stamp->tm_hour < 10 ? "0" : "")
<< time_stamp->tm_hour << ":" << (time_stamp->tm_min < 10 ? "0" : "")
<< time_stamp->tm_min << ":" << (time_stamp->tm_sec < 10 ? "0" : "")
<< time_stamp->tm_sec << " " << current_request.endpoint.to_string()
<< " " << current_request.referrer
<< (0 == current_request.referrer.length() ? "- " : " ")
<< current_request.agent
<< (0 == current_request.agent.length() ? "- " : " ")
<< request_string;
util::SimpleLogger().Write()
<< (time_stamp->tm_mday < 10 ? "0" : "") << time_stamp->tm_mday << "-"
<< (time_stamp->tm_mon + 1 < 10 ? "0" : "") << (time_stamp->tm_mon + 1) << "-"
<< 1900 + time_stamp->tm_year << " " << (time_stamp->tm_hour < 10 ? "0" : "")
<< time_stamp->tm_hour << ":" << (time_stamp->tm_min < 10 ? "0" : "")
<< time_stamp->tm_min << ":" << (time_stamp->tm_sec < 10 ? "0" : "")
<< time_stamp->tm_sec << " " << current_request.endpoint.to_string() << " "
<< current_request.referrer << (0 == current_request.referrer.length() ? "- " : " ")
<< current_request.agent << (0 == current_request.agent.length() ? "- " : " ")
<< request_string;
engine::RouteParameters route_parameters;
APIGrammarParser api_parser(&route_parameters);
@@ -151,7 +149,7 @@ void RequestHandler::handle_request(const http::request &current_request,
current_reply = http::reply::stock_reply(http::reply::internal_server_error);
;
util::SimpleLogger().Write(logWARNING) << "[server error] code: " << e.what()
<< ", uri: " << current_request.uri;
<< ", uri: " << current_request.uri;
}
}
+11 -12
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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)
+6 -5
View File
@@ -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
View File
@@ -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))
{
+2 -1
View File
@@ -61,7 +61,8 @@ int main(int argc, const char *argv[])
}
catch (std::exception &current_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;
+7 -4
View File
@@ -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')
+2 -1
View File
@@ -52,7 +52,8 @@ bool FixedPointCoordinate::operator==(const FixedPointCoordinate &other) const
std::ostream &operator<<(std::ostream &out, const FixedPointCoordinate &coordinate)
{
out << "(" << static_cast<double>(coordinate.lat / COORDINATE_PRECISION) << "," << static_cast<double>(coordinate.lon / COORDINATE_PRECISION) << ")";
out << "(" << static_cast<double>(coordinate.lat / COORDINATE_PRECISION) << ","
<< static_cast<double>(coordinate.lon / COORDINATE_PRECISION) << ")";
return out;
}
}
-1
View File
@@ -17,6 +17,5 @@ namespace util
{
void exception::anchor() const {}
}
}