Merge commit '788bc67faa7738cf7c6b2a192ecf3e3567d1c20e' into develop
This commit is contained in:
@@ -13,6 +13,7 @@ set(BENCHMARKS
|
||||
count_tag
|
||||
index_map
|
||||
static_vs_dynamic_index
|
||||
write_pbf
|
||||
CACHE STRING "Benchmark programs"
|
||||
)
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
*/
|
||||
|
||||
#include <cstdint>
|
||||
#include <iostream>
|
||||
|
||||
#include <osmium/io/any_input.hpp>
|
||||
@@ -12,9 +13,9 @@
|
||||
|
||||
struct CountHandler : public osmium::handler::Handler {
|
||||
|
||||
int nodes = 0;
|
||||
int ways = 0;
|
||||
int relations = 0;
|
||||
uint64_t nodes = 0;
|
||||
uint64_t ways = 0;
|
||||
uint64_t relations = 0;
|
||||
|
||||
void node(osmium::Node&) {
|
||||
++nodes;
|
||||
@@ -48,7 +49,5 @@ int main(int argc, char* argv[]) {
|
||||
std::cout << "Nodes: " << handler.nodes << "\n";
|
||||
std::cout << "Ways: " << handler.ways << "\n";
|
||||
std::cout << "Relations: " << handler.relations << "\n";
|
||||
|
||||
google::protobuf::ShutdownProtobufLibrary();
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
*/
|
||||
|
||||
#include <cstdint>
|
||||
#include <iostream>
|
||||
|
||||
#include <osmium/io/any_input.hpp>
|
||||
@@ -12,8 +13,8 @@
|
||||
|
||||
struct CountHandler : public osmium::handler::Handler {
|
||||
|
||||
int counter = 0;
|
||||
int all = 0;
|
||||
uint64_t counter = 0;
|
||||
uint64_t all = 0;
|
||||
|
||||
void node(osmium::Node& node) {
|
||||
++all;
|
||||
@@ -49,7 +50,5 @@ int main(int argc, char* argv[]) {
|
||||
reader.close();
|
||||
|
||||
std::cout << "r_all=" << handler.all << " r_counter=" << handler.counter << "\n";
|
||||
|
||||
google::protobuf::ShutdownProtobufLibrary();
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,5 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
osmium::apply(reader, location_handler);
|
||||
reader.close();
|
||||
|
||||
google::protobuf::ShutdownProtobufLibrary();
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,6 @@ int main(int argc, char* argv[]) {
|
||||
std::string input_filename = argv[1];
|
||||
|
||||
osmium::memory::Buffer buffer = osmium::io::read_file(input_filename);
|
||||
google::protobuf::ShutdownProtobufLibrary();
|
||||
|
||||
const auto& map_factory = osmium::index::MapFactory<osmium::unsigned_object_id_type, osmium::Location>::instance();
|
||||
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
|
||||
The code in this file is released into the Public Domain.
|
||||
|
||||
*/
|
||||
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
#include <osmium/io/any_input.hpp>
|
||||
#include <osmium/io/any_output.hpp>
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
if (argc != 3) {
|
||||
std::cerr << "Usage: " << argv[0] << " INPUT-FILE OUTPUT-FILE\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
std::string input_filename = argv[1];
|
||||
std::string output_filename = argv[2];
|
||||
|
||||
osmium::io::Reader reader(input_filename);
|
||||
osmium::io::File output_file(output_filename, "pbf");
|
||||
osmium::io::Header header;
|
||||
osmium::io::Writer writer(output_file, header, osmium::io::overwrite::allow);
|
||||
|
||||
while (osmium::memory::Buffer buffer = reader.read()) {
|
||||
writer(std::move(buffer));
|
||||
}
|
||||
|
||||
writer.close();
|
||||
reader.close();
|
||||
}
|
||||
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# run_benchmark_write_pbf.sh
|
||||
#
|
||||
# Will read the input file and after reading it into memory completely,
|
||||
# write it to /dev/null. Because this will need the time to read *and* write
|
||||
# the file, it will report the times for reading and writing. You can
|
||||
# subtract the times needed for the "count" benchmark to (roughly) get the
|
||||
# write times.
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
BENCHMARK_NAME=write_pbf
|
||||
|
||||
. @CMAKE_BINARY_DIR@/benchmarks/setup.sh
|
||||
|
||||
CMD=$OB_DIR/osmium_benchmark_$BENCHMARK_NAME
|
||||
|
||||
echo "# file size num mem time cpu_kernel cpu_user cpu_percent cmd options"
|
||||
for data in $OB_DATA_FILES; do
|
||||
filename=`basename $data`
|
||||
filesize=`stat --format="%s" --dereference $data`
|
||||
for n in $OB_SEQ; do
|
||||
$OB_TIME_CMD -f "$filename $filesize $n $OB_TIME_FORMAT" $CMD $data /dev/null 2>&1 >/dev/null | sed -e "s%$DATA_DIR/%%" | sed -e "s%$OB_DIR/%%"
|
||||
done
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user