summaryrefslogtreecommitdiffstats
path: root/storage
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2019-08-23 13:37:37 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2019-08-23 13:37:37 +0000
commit46c8a967b4b42b43dbae97525c8e62ce05b5099a (patch)
treee0ad8ec93c1e72b32ccb4d909f5ce01576b5942a /storage
parentec4240010b82eabc1fa0efad47082541da9d246a (diff)
time(0) to chrono::steady_clock.
Diffstat (limited to 'storage')
-rw-r--r--storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp6
-rw-r--r--storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h7
-rw-r--r--storage/src/vespa/storage/storageserver/storagenode.cpp4
3 files changed, 9 insertions, 8 deletions
diff --git a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp
index a56104ff717..d1631c50880 100644
--- a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp
+++ b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp
@@ -1273,10 +1273,10 @@ FileStorHandlerImpl::Stripe::dumpQueueHtml(std::ostream & os) const
namespace {
void dump_lock_entry(const document::BucketId& bucketId, const FileStorHandlerImpl::Stripe::LockEntry& entry,
- api::LockingRequirements lock_mode, uint32_t now_ts, std::ostream& os) {
+ api::LockingRequirements lock_mode, FileStorHandlerImpl::Clock::time_point now_ts, std::ostream& os) {
os << api::MessageType::get(entry.msgType).getName() << ":" << entry.msgId << " ("
<< bucketId << ", " << api::to_string(lock_mode)
- << " lock) Running for " << (now_ts - entry.timestamp) << " secs<br/>\n";
+ << " lock) Running for " << std::chrono::duration_cast<std::chrono::seconds>(now_ts - entry.timestamp).count() << " secs<br/>\n";
}
}
@@ -1284,7 +1284,7 @@ void dump_lock_entry(const document::BucketId& bucketId, const FileStorHandlerIm
void
FileStorHandlerImpl::Stripe::dumpActiveHtml(std::ostream & os) const
{
- uint32_t now = time(nullptr);
+ Clock::time_point now = Clock::now();
vespalib::MonitorGuard guard(_lock);
for (const auto & e : _lockedBuckets) {
if (e.second._exclusiveLock) {
diff --git a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h
index d46aa635354..fd6ab5e8b9a 100644
--- a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h
+++ b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h
@@ -72,21 +72,22 @@ public:
using PriorityIdx = bmi::nth_index<PriorityQueue, 1>::type;
using BucketIdx = bmi::nth_index<PriorityQueue, 2>::type;
+ using Clock = std::chrono::steady_clock;
struct Disk;
class Stripe {
public:
struct LockEntry {
- uint32_t timestamp;
+ Clock::time_point timestamp;
uint8_t priority;
api::MessageType::Id msgType;
api::StorageMessage::Id msgId;
- LockEntry() : timestamp(0), priority(0), msgType(), msgId(0) { }
+ LockEntry() : timestamp(), priority(0), msgType(), msgId(0) { }
LockEntry(uint8_t priority_, api::MessageType::Id msgType_, api::StorageMessage::Id msgId_)
- : timestamp(time(nullptr)), priority(priority_), msgType(msgType_), msgId(msgId_)
+ : timestamp(Clock::now()), priority(priority_), msgType(msgType_), msgId(msgId_)
{ }
};
diff --git a/storage/src/vespa/storage/storageserver/storagenode.cpp b/storage/src/vespa/storage/storageserver/storagenode.cpp
index 64c0970cf9d..c5a0a031067 100644
--- a/storage/src/vespa/storage/storageserver/storagenode.cpp
+++ b/storage/src/vespa/storage/storageserver/storagenode.cpp
@@ -161,10 +161,10 @@ StorageNode::initialize()
_context.getComponentRegister().setBucketSpacesConfig(*_bucketSpacesConfig);
_metrics = std::make_shared<StorageMetricSet>();
- _component.reset(new StorageComponent(_context.getComponentRegister(), "storagenode"));
+ _component = std::make_unique<StorageComponent>(_context.getComponentRegister(), "storagenode");
_component->registerMetric(*_metrics);
if (!_context.getComponentRegister().hasMetricManager()) {
- _metricManager.reset(new metrics::MetricManager);
+ _metricManager = std::make_unique<metrics::MetricManager>();
_context.getComponentRegister().setMetricManager(*_metricManager);
}
_component->registerMetricUpdateHook(*this, framework::SecondTime(300));