summaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@oath.com>2018-11-22 13:05:08 +0100
committerHenning Baldersheim <balder@oath.com>2018-11-22 13:05:08 +0100
commitc8b10a17855ef27f3c956b7433b044b5c96e3c69 (patch)
tree74a0a640dcbb921473ea057561be9af77ac1bc99 /searchcore
parent9f8dba6c69a2315f784f68a61ee3f4f7991232ee (diff)
Move std::max to construction time.
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/vespa/searchcore/fdispatch/search/rowstate.cpp2
-rw-r--r--searchcore/src/vespa/searchcore/fdispatch/search/rowstate.h4
2 files changed, 3 insertions, 3 deletions
diff --git a/searchcore/src/vespa/searchcore/fdispatch/search/rowstate.cpp b/searchcore/src/vespa/searchcore/fdispatch/search/rowstate.cpp
index 73c0afe6bc6..b0ca9f3463b 100644
--- a/searchcore/src/vespa/searchcore/fdispatch/search/rowstate.cpp
+++ b/searchcore/src/vespa/searchcore/fdispatch/search/rowstate.cpp
@@ -7,7 +7,7 @@ namespace fdispatch {
void RowState::updateSearchTime(double searchTime)
{
_numQueries++;
- double decayRate = std::max(1ul, std::min(_numQueries, _decayRate));
+ double decayRate = std::min(_numQueries, _decayRate);
_avgSearchTime = (searchTime + (decayRate-1)*_avgSearchTime)/decayRate;
}
diff --git a/searchcore/src/vespa/searchcore/fdispatch/search/rowstate.h b/searchcore/src/vespa/searchcore/fdispatch/search/rowstate.h
index f8c05fe2707..00bf7f1bd91 100644
--- a/searchcore/src/vespa/searchcore/fdispatch/search/rowstate.h
+++ b/searchcore/src/vespa/searchcore/fdispatch/search/rowstate.h
@@ -16,8 +16,8 @@ namespace fdispatch {
class RowState {
public:
RowState(double initialValue, uint64_t decayRate) :
+ _decayRate(std::max(1ul, decayRate)),
_avgSearchTime(initialValue),
- _decayRate(decayRate),
_sumActiveDocs(0),
_numQueries(0)
{ }
@@ -31,8 +31,8 @@ public:
_sumActiveDocs = tmp;
}
private:
+ const uint64_t _decayRate;
double _avgSearchTime;
- uint64_t _decayRate;
uint64_t _sumActiveDocs;
uint64_t _numQueries;
};