[libosmium] 01/04: Imported Upstream version 2.5.2
Sebastiaan Couwenberg
sebastic at moszumanska.debian.org
Sat Nov 7 00:24:26 UTC 2015
This is an automated email from the git hooks/post-receive script.
sebastic pushed a commit to branch master
in repository libosmium.
commit b5afa8d5243fb4770c85357dd9efe13bac14722d
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date: Sat Nov 7 01:10:28 2015 +0100
Imported Upstream version 2.5.2
---
CHANGELOG.md | 11 ++++++++++-
CMakeLists.txt | 3 ++-
include/osmium/diff_iterator.hpp | 21 +++++++++------------
include/osmium/io/writer.hpp | 2 +-
include/osmium/thread/queue.hpp | 9 ++++++++-
5 files changed, 30 insertions(+), 16 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 715280f..781a04a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,14 @@ This project adheres to [Semantic Versioning](http://semver.org/).
### Fixed
+## [2.5.2] - 2015-11-06
+
+# Fixed
+
+- Writing data through an OutputIterator was extremly slow due to
+ lock contention.
+
+
## [2.5.1] - 2015-11-05
### Added
@@ -188,7 +196,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
Doxygen (up to version 1.8.8). This version contains a workaround to fix
this.
-[unreleased]: https://github.com/osmcode/libosmium/compare/v2.5.1...HEAD
+[unreleased]: https://github.com/osmcode/libosmium/compare/v2.5.2...HEAD
+[2.5.2]: https://github.com/osmcode/libosmium/compare/v2.5.1...v2.5.2
[2.5.1]: https://github.com/osmcode/libosmium/compare/v2.5.0...v2.5.1
[2.5.0]: https://github.com/osmcode/libosmium/compare/v2.4.1...v2.5.0
[2.4.1]: https://github.com/osmcode/libosmium/compare/v2.4.0...v2.4.1
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4382311..f28e2aa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -27,7 +27,7 @@ project(libosmium)
set(LIBOSMIUM_VERSION_MAJOR 2)
set(LIBOSMIUM_VERSION_MINOR 5)
-set(LIBOSMIUM_VERSION_PATCH 1)
+set(LIBOSMIUM_VERSION_PATCH 2)
set(LIBOSMIUM_VERSION
"${LIBOSMIUM_VERSION_MAJOR}.${LIBOSMIUM_VERSION_MINOR}.${LIBOSMIUM_VERSION_PATCH}")
@@ -217,6 +217,7 @@ if(CMAKE_BUILD_TYPE STREQUAL "Dev")
add_definitions(-Werror)
endif()
add_definitions(${OSMIUM_WARNING_OPTIONS})
+# add_definitions(${OSMIUM_WARNING_OPTIONS} ${OSMIUM_DRACONIC_CLANG_OPTIONS} -Wno-documentation -Wno-format-nonliteral -Wno-deprecated -Wno-covered-switch-default -Wno-shadow)
endif()
# Force RelWithDebInfo build type if none was given
diff --git a/include/osmium/diff_iterator.hpp b/include/osmium/diff_iterator.hpp
index 4ee67f7..ae80afb 100644
--- a/include/osmium/diff_iterator.hpp
+++ b/include/osmium/diff_iterator.hpp
@@ -59,17 +59,14 @@ namespace osmium {
void set_diff() const {
assert(m_curr != m_end);
- TBasicIterator prev = m_prev;
- if (prev->type() != m_curr->type() || prev->id() != m_curr->id()) {
- prev = m_curr;
- }
-
- TBasicIterator next = m_next;
- if (next == m_end || next->type() != m_curr->type() || next->id() != m_curr->id()) {
- next = m_curr;
- }
-
- m_diff = osmium::DiffObject(*prev, *m_curr, *next);
+ bool use_curr_for_prev = m_prev->type() != m_curr->type() || m_prev->id() != m_curr->id();
+ bool use_curr_for_next = m_next == m_end || m_next->type() != m_curr->type() || m_next->id() != m_curr->id();
+
+ m_diff = std::move(osmium::DiffObject{
+ *(use_curr_for_prev ? m_curr : m_prev),
+ *m_curr,
+ *(use_curr_for_next ? m_curr : m_next)
+ });
}
public:
@@ -78,7 +75,7 @@ namespace osmium {
m_prev(begin),
m_curr(begin),
m_next(begin == end ? begin : ++begin),
- m_end(end) {
+ m_end(std::move(end)) {
}
DiffIterator(const DiffIterator&) = default;
diff --git a/include/osmium/io/writer.hpp b/include/osmium/io/writer.hpp
index 09c605c..7cd133d 100644
--- a/include/osmium/io/writer.hpp
+++ b/include/osmium/io/writer.hpp
@@ -121,6 +121,7 @@ namespace osmium {
}
void do_flush() {
+ osmium::thread::check_for_exception(m_write_future);
if (m_buffer && m_buffer.committed() > 0) {
osmium::memory::Buffer buffer{m_buffer_size,
osmium::memory::Buffer::auto_grow::no};
@@ -138,7 +139,6 @@ namespace osmium {
}
try {
- osmium::thread::check_for_exception(m_write_future);
func(std::forward<TArgs>(args)...);
} catch (...) {
m_status = status::error;
diff --git a/include/osmium/thread/queue.hpp b/include/osmium/thread/queue.hpp
index 76ad9a0..2837a6e 100644
--- a/include/osmium/thread/queue.hpp
+++ b/include/osmium/thread/queue.hpp
@@ -75,6 +75,9 @@ namespace osmium {
/// The largest size the queue has been so far.
size_t m_largest_size;
+ /// The number of times push() was called on the queue.
+ std::atomic<int> m_push_counter;
+
/// The number of times the queue was full and a thread pushing
/// to the queue was blocked.
std::atomic<int> m_full_counter;
@@ -99,6 +102,7 @@ namespace osmium {
#ifdef OSMIUM_DEBUG_QUEUE_SIZE
,
m_largest_size(0),
+ m_push_counter(0),
m_full_counter(0)
#endif
{
@@ -107,7 +111,7 @@ namespace osmium {
~Queue() {
shutdown();
#ifdef OSMIUM_DEBUG_QUEUE_SIZE
- std::cerr << "queue '" << m_name << "' with max_size=" << m_max_size << " had largest size " << m_largest_size << " and was full " << m_full_counter << " times\n";
+ std::cerr << "queue '" << m_name << "' with max_size=" << m_max_size << " had largest size " << m_largest_size << " and was full " << m_full_counter << " times in " << m_push_counter << " push() calls\n";
#endif
}
@@ -116,6 +120,9 @@ namespace osmium {
* call will block if the queue is full.
*/
void push(T value) {
+#ifdef OSMIUM_DEBUG_QUEUE_SIZE
+ ++m_push_counter;
+#endif
if (m_max_size) {
while (size() >= m_max_size) {
std::this_thread::sleep_for(full_queue_sleep_duration);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/libosmium.git
More information about the Pkg-grass-devel
mailing list