Skip to content

Commit 452ef8c

Browse files
committed
replace get_point_rate() hack with _search_count() hacks.
1 parent ebae515 commit 452ef8c

3 files changed

Lines changed: 24 additions & 21 deletions

File tree

include/bitcoin/database/impl/query/query.ipp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,6 @@ CLASS::query(Store& store) NOEXCEPT
7474
{
7575
}
7676

77-
TEMPLATE
78-
uint64_t CLASS::get_point_rate() const NOEXCEPT
79-
{
80-
const auto negative = (double)store_.point.negative_search_count();
81-
const auto positive = (double)store_.point.positive_search_count();
82-
return static_cast<uint64_t>(10'000.0 * (positive / (positive + negative)));
83-
}
84-
8577
TEMPLATE
8678
code CLASS::get_code() const NOEXCEPT
8779
{

include/bitcoin/database/primitives/hashmap.hpp

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,18 @@ class hashmap
4949

5050
hashmap(storage& header, storage& body, const Link& buckets) NOEXCEPT;
5151

52+
/// Count of puts resulting in table body search to detect duplication.
53+
size_t positive_search_count() const NOEXCEPT
54+
{
55+
return pcounter_.load(std::memory_order_relaxed);
56+
}
57+
58+
/// Count of puts not resulting in table body search to detect duplication.
59+
size_t negative_search_count() const NOEXCEPT
60+
{
61+
return ncounter_.load(std::memory_order_relaxed);
62+
}
63+
5264
/// Setup, not thread safe.
5365
/// -----------------------------------------------------------------------
5466

@@ -79,16 +91,6 @@ class hashmap
7991
/// Increase count as neccesary to specified.
8092
bool expand(const Link& count) NOEXCEPT;
8193

82-
/// Count of puts resulting in table body search to detect duplication.
83-
size_t negative_search_count() const NOEXCEPT
84-
{
85-
return ncounter_.load(std::memory_order_relaxed);
86-
}
87-
size_t positive_search_count() const NOEXCEPT
88-
{
89-
return pcounter_.load(std::memory_order_relaxed);
90-
}
91-
9294
/// Errors.
9395
/// -----------------------------------------------------------------------
9496

include/bitcoin/database/query.hpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,18 @@ class query
7676

7777
query(Store& store) NOEXCEPT;
7878

79+
/// Count of puts resulting in table body search to detect duplication.
80+
size_t positive_search_count() const NOEXCEPT
81+
{
82+
return store_.point.positive_search_count();
83+
}
84+
85+
/// Count of puts not resulting in table body search to detect duplication.
86+
size_t negative_search_count() const NOEXCEPT
87+
{
88+
return store_.point.negative_search_count();
89+
}
90+
7991
/// Store management from query-holder (not store owner) context.
8092
/// -----------------------------------------------------------------------
8193

@@ -85,9 +97,6 @@ class query
8597
/// Get first fault code.
8698
code get_fault() const NOEXCEPT;
8799

88-
// TESTING
89-
uint64_t get_point_rate() const NOEXCEPT;
90-
91100
/// True if there is a fault condition (disk full is not a fault).
92101
bool is_fault() const NOEXCEPT;
93102

0 commit comments

Comments
 (0)