summaryrefslogtreecommitdiffstats
path: root/staging_vespalib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2019-12-04 07:23:36 -0800
committerGitHub <noreply@github.com>2019-12-04 07:23:36 -0800
commitd3c4029c7e91362b50e4fcb2e4eaa9d8c851d6d5 (patch)
tree9fed2a925c667bd793f2aad282d2b963fc62ce63 /staging_vespalib
parentd3002ae703705198940203f48ba915d14bb948c4 (diff)
parent887fe94ff98ae308f7dcb39ad3f6e299b15d2bab (diff)
Merge pull request #11479 from vespa-engine/balder/do-not-let-external-softtimeout-factor-affect-auto-tuning-rebased-2
Wrap soft and hard doom in an CombinedDoom.
Diffstat (limited to 'staging_vespalib')
-rw-r--r--staging_vespalib/src/vespa/vespalib/util/doom.cpp16
-rw-r--r--staging_vespalib/src/vespa/vespalib/util/doom.h29
2 files changed, 26 insertions, 19 deletions
diff --git a/staging_vespalib/src/vespa/vespalib/util/doom.cpp b/staging_vespalib/src/vespa/vespalib/util/doom.cpp
index df20981c584..87b24799721 100644
--- a/staging_vespalib/src/vespa/vespalib/util/doom.cpp
+++ b/staging_vespalib/src/vespa/vespalib/util/doom.cpp
@@ -4,10 +4,12 @@
namespace vespalib {
-Doom::Doom(const vespalib::Clock &clock, fastos::SteadyTimeStamp timeOfDoom) :
- _clock(clock),
- _timeOfDoom(timeOfDoom)
-{
-}
-
-} // namespace vespalib \ No newline at end of file
+Doom::Doom(const vespalib::Clock &clock, fastos::SteadyTimeStamp softDoom,
+ fastos::SteadyTimeStamp hardDoom, bool explicitSoftDoom)
+ : _clock(clock),
+ _softDoom(softDoom),
+ _hardDoom(hardDoom),
+ _isExplicitSoftDoom(explicitSoftDoom)
+{ }
+
+} \ No newline at end of file
diff --git a/staging_vespalib/src/vespa/vespalib/util/doom.h b/staging_vespalib/src/vespa/vespalib/util/doom.h
index ee0c1af3177..d85c3dc9084 100644
--- a/staging_vespalib/src/vespa/vespalib/util/doom.h
+++ b/staging_vespalib/src/vespa/vespalib/util/doom.h
@@ -6,19 +6,24 @@
namespace vespalib {
-class Doom
-{
+class Doom {
+public:
+ Doom(const vespalib::Clock &clock, fastos::SteadyTimeStamp doom)
+ : Doom(clock, doom, doom, false)
+ {}
+ Doom(const vespalib::Clock &clock, fastos::SteadyTimeStamp softDoom,
+ fastos::SteadyTimeStamp hardDoom, bool explicitSoftDoom);
+
+ bool soft_doom() const { return (_clock.getTimeNSAssumeRunning() > _softDoom); }
+ bool hard_doom() const { return (_clock.getTimeNSAssumeRunning() > _hardDoom); }
+ fastos::TimeStamp soft_left() const { return _softDoom - _clock.getTimeNS(); }
+ fastos::TimeStamp hard_left() const { return _hardDoom - _clock.getTimeNS(); }
+ bool isExplicitSoftDoom() const { return _isExplicitSoftDoom; }
private:
const vespalib::Clock &_clock;
- fastos::SteadyTimeStamp _timeOfDoom;
-
-public:
- Doom(const vespalib::Clock &clock, fastos::SteadyTimeStamp timeOfDoom);
- bool doom() const {
- return (_clock.getTimeNSAssumeRunning() > _timeOfDoom);
- }
- fastos::TimeStamp left() const { return _timeOfDoom - _clock.getTimeNS(); }
+ fastos::SteadyTimeStamp _softDoom;
+ fastos::SteadyTimeStamp _hardDoom;
+ bool _isExplicitSoftDoom;
};
-} // namespace vespalib
-
+}