Merge commit 'babbda98a6ea1d53a8bc5015ef5dfb313c47186a' into libosmium-2.10.0
This commit is contained in:
@@ -12,6 +12,7 @@ set(BENCHMARKS
|
||||
count
|
||||
count_tag
|
||||
index_map
|
||||
mercator
|
||||
static_vs_dynamic_index
|
||||
write_pbf
|
||||
CACHE STRING "Benchmark programs"
|
||||
@@ -37,6 +38,8 @@ foreach(benchmark ${BENCHMARKS})
|
||||
@ONLY)
|
||||
endforeach()
|
||||
|
||||
string(TOUPPER "${CMAKE_BUILD_TYPE}" _cmake_build_type)
|
||||
set(_cxx_flags "${CMAKE_CXX_FLAGS_${_cmake_build_type}}")
|
||||
foreach(file setup run_benchmarks)
|
||||
configure_file(${file}.sh ${CMAKE_CURRENT_BINARY_DIR}/${file}.sh @ONLY)
|
||||
endforeach()
|
||||
|
||||
+5
-5
@@ -4,9 +4,9 @@
|
||||
#
|
||||
|
||||
cd $DATA_DIR
|
||||
curl --location --output 1_liechtenstein.osm.pbf http://download.geofabrik.de/europe/liechtenstein-latest.osm.pbf # about 1 MB
|
||||
curl --location --output 2_bremen.osm.pbf http://download.geofabrik.de/europe/germany/bremen-latest.osm.pbf # about 13 MB
|
||||
curl --location --output 3_sachsen.osm.pbf http://download.geofabrik.de/europe/germany/sachsen-latest.osm.pbf # about 120 MB
|
||||
curl --location --output 4_germany.osm.pbf http://download.geofabrik.de/europe/germany-latest.osm.pbf # about 2 GB
|
||||
curl --location --output 5_planet.osm.pbf http://planet.osm.org/pbf/planet-latest.osm.pbf # about 26 GB
|
||||
curl --location --output 1_liechtenstein.osm.pbf http://download.geofabrik.de/europe/liechtenstein-latest.osm.pbf # about 2 MB
|
||||
curl --location --output 2_bremen.osm.pbf http://download.geofabrik.de/europe/germany/bremen-latest.osm.pbf # about 16 MB
|
||||
curl --location --output 3_sachsen.osm.pbf http://download.geofabrik.de/europe/germany/sachsen-latest.osm.pbf # about 160 MB
|
||||
curl --location --output 4_germany.osm.pbf http://download.geofabrik.de/europe/germany-latest.osm.pbf # about 3 GB
|
||||
curl --location --output 5_planet.osm.pbf http://planet.osm.org/pbf/planet-latest.osm.pbf # about 35 GB
|
||||
|
||||
|
||||
@@ -19,15 +19,15 @@ struct CountHandler : public osmium::handler::Handler {
|
||||
uint64_t ways = 0;
|
||||
uint64_t relations = 0;
|
||||
|
||||
void node(osmium::Node&) {
|
||||
void node(const osmium::Node&) {
|
||||
++nodes;
|
||||
}
|
||||
|
||||
void way(osmium::Way&) {
|
||||
void way(const osmium::Way&) {
|
||||
++ways;
|
||||
}
|
||||
|
||||
void relation(osmium::Relation&) {
|
||||
void relation(const osmium::Relation&) {
|
||||
++relations;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ struct CountHandler : public osmium::handler::Handler {
|
||||
uint64_t counter = 0;
|
||||
uint64_t all = 0;
|
||||
|
||||
void node(osmium::Node& node) {
|
||||
void node(const osmium::Node& node) {
|
||||
++all;
|
||||
const char* amenity = node.tags().get_value_by_key("amenity");
|
||||
if (amenity && !strcmp(amenity, "post_box")) {
|
||||
@@ -26,11 +26,11 @@ struct CountHandler : public osmium::handler::Handler {
|
||||
}
|
||||
}
|
||||
|
||||
void way(osmium::Way&) {
|
||||
void way(const osmium::Way&) {
|
||||
++all;
|
||||
}
|
||||
|
||||
void relation(osmium::Relation&) {
|
||||
void relation(const osmium::Relation&) {
|
||||
++all;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
|
||||
The code in this file is released into the Public Domain.
|
||||
|
||||
*/
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <osmium/io/any_input.hpp>
|
||||
#include <osmium/handler.hpp>
|
||||
#include <osmium/visitor.hpp>
|
||||
#include <osmium/geom/wkb.hpp>
|
||||
#include <osmium/geom/mercator_projection.hpp>
|
||||
|
||||
struct GeomHandler : public osmium::handler::Handler {
|
||||
|
||||
osmium::geom::WKBFactory<osmium::geom::MercatorProjection> factory;
|
||||
|
||||
void node(const osmium::Node& node) {
|
||||
const std::string geom = factory.create_point(node);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
if (argc != 2) {
|
||||
std::cerr << "Usage: " << argv[0] << " OSMFILE\n";
|
||||
std::exit(1);
|
||||
}
|
||||
|
||||
const std::string input_filename{argv[1]};
|
||||
|
||||
osmium::io::Reader reader{input_filename};
|
||||
|
||||
GeomHandler handler;
|
||||
osmium::apply(reader, handler);
|
||||
reader.close();
|
||||
}
|
||||
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# run_benchmark_mercator.sh
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
BENCHMARK_NAME=mercator
|
||||
|
||||
. @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 2>&1 >/dev/null | sed -e "s%$DATA_DIR/%%" | sed -e "s%$OB_DIR/%%"
|
||||
done
|
||||
done
|
||||
|
||||
+13
-3
@@ -9,6 +9,10 @@ if [ -z $DATA_DIR ]; then
|
||||
fi
|
||||
|
||||
OB_DIR=@CMAKE_BINARY_DIR@/benchmarks
|
||||
OB_BUILD_TYPE=@CMAKE_BUILD_TYPE@
|
||||
OB_COMPILER=@CMAKE_CXX_COMPILER@
|
||||
OB_COMPILER_VERSION=`$OB_COMPILER --version | head -1`
|
||||
OB_CXXFLAGS="@_cxx_flags@"
|
||||
|
||||
OB_RUNS=3
|
||||
OB_SEQ=`seq -s' ' 1 $OB_RUNS`
|
||||
@@ -20,11 +24,17 @@ OB_DATA_FILES=`find -L $DATA_DIR -mindepth 1 -maxdepth 1 -type f | sort`
|
||||
|
||||
echo "BENCHMARK: $BENCHMARK_NAME"
|
||||
echo "---------------------"
|
||||
echo "BUILD:"
|
||||
echo "build type\t: $OB_BUILD_TYPE"
|
||||
echo "compiler\t: $OB_COMPILER"
|
||||
echo "CXX version\t: $OB_COMPILER_VERSION"
|
||||
echo "CXX flags\t: $OB_CXXFLAGS"
|
||||
echo "---------------------"
|
||||
echo "CPU:"
|
||||
grep '^model name' /proc/cpuinfo | tail -1
|
||||
grep '^cpu MHz' /proc/cpuinfo | tail -1
|
||||
grep '^cpu cores' /proc/cpuinfo | tail -1
|
||||
grep '^siblings' /proc/cpuinfo | tail -1
|
||||
grep '^cpu MHz' /proc/cpuinfo | tail -1
|
||||
grep '^cpu cores' /proc/cpuinfo | tail -1
|
||||
grep '^siblings' /proc/cpuinfo | tail -1
|
||||
|
||||
echo "---------------------"
|
||||
echo "MEMORY:"
|
||||
|
||||
Reference in New Issue
Block a user