Runs scripts/format.sh

This commit is contained in:
Daniel J. Hofmann
2016-03-03 14:26:13 +01:00
committed by Patrick Niklaus
parent bb06e044f5
commit 7c30ea32bf
70 changed files with 457 additions and 399 deletions
+5 -8
View File
@@ -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;
+8 -6
View File
@@ -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
View File
@@ -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));
+3 -5
View File
@@ -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')