summaryrefslogtreecommitdiffstats
path: root/searchcorespi
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2019-11-18 22:44:04 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2019-11-20 10:16:58 +0000
commit55069682323b0c204b2ddda696bfcd33f4e47a64 (patch)
tree508042cdb977ec9ea3c6323e8727aa149e09ba54 /searchcorespi
parent95432b0ec4be8e844fe5433598a9045d0de08fef (diff)
Use C++11 chrono instead prehistoric homegrown stuff.
Diffstat (limited to 'searchcorespi')
-rw-r--r--searchcorespi/src/vespa/searchcorespi/index/fusionrunner.cpp16
-rw-r--r--searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp13
2 files changed, 11 insertions, 18 deletions
diff --git a/searchcorespi/src/vespa/searchcorespi/index/fusionrunner.cpp b/searchcorespi/src/vespa/searchcorespi/index/fusionrunner.cpp
index 009bf5d16d9..fd9aea19faa 100644
--- a/searchcorespi/src/vespa/searchcorespi/index/fusionrunner.cpp
+++ b/searchcorespi/src/vespa/searchcorespi/index/fusionrunner.cpp
@@ -7,7 +7,6 @@
#include <vespa/searchlib/attribute/fixedsourceselector.h>
#include <vespa/searchlib/queryeval/isourceselector.h>
#include <vespa/searchlib/util/dirtraverse.h>
-#include <vespa/vespalib/util/jsonwriter.h>
#include <vespa/log/log.h>
LOG_SETUP(".searchcorespi.index.fusionrunner");
@@ -23,7 +22,6 @@ using search::diskindex::SelectorArray;
using search::SerialNum;
using std::vector;
using vespalib::string;
-using vespalib::JSONStringer;
namespace searchcorespi::index {
@@ -37,8 +35,7 @@ FusionRunner::FusionRunner(const string &base_dir,
_fileHeaderContext(fileHeaderContext)
{ }
-FusionRunner::~FusionRunner() {
-}
+FusionRunner::~FusionRunner() = default;
namespace {
@@ -102,16 +99,15 @@ FusionRunner::fuse(const FusionSpec &fusion_spec,
id_map[0] = sources.size();
sources.push_back(_diskLayout.getFusionDir(fusion_spec.last_fusion_id));
}
- for (size_t i = 0; i < ids.size(); ++i) {
- id_map[ids[i] - fusion_spec.last_fusion_id] = sources.size();
- sources.push_back(_diskLayout.getFlushDir(ids[i]));
+ for (uint32_t id : ids) {
+ id_map[id - fusion_spec.last_fusion_id] = sources.size();
+ sources.push_back(_diskLayout.getFlushDir(id));
}
if (LOG_WOULD_LOG(event)) {
EventLogger::diskFusionStart(sources, fusion_dir);
}
- FastOS_Time timer;
- timer.SetNow();
+ fastos::StopWatch stopWatch;
const string selector_name = IndexDiskLayout::getSelectorFileName(_diskLayout.getFlushDir(fusion_id));
SelectorArray selector_array;
@@ -128,7 +124,7 @@ FusionRunner::fuse(const FusionSpec &fusion_spec,
}
if (LOG_WOULD_LOG(event)) {
- EventLogger::diskFusionComplete(fusion_dir, (int64_t)timer.MilliSecsToNow());
+ EventLogger::diskFusionComplete(fusion_dir, stopWatch.stop().elapsed().ms());
}
return fusion_id;
}
diff --git a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp
index 45bd2a52349..f9bd2c0776c 100644
--- a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp
+++ b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp
@@ -10,7 +10,6 @@
#include "indexwriteutilities.h"
#include <vespa/fastos/file.h>
#include <vespa/searchcorespi/flush/closureflushtask.h>
-#include <vespa/searchlib/common/serialnumfileheadercontext.h>
#include <vespa/searchlib/index/schemautil.h>
#include <vespa/searchlib/util/dirtraverse.h>
#include <vespa/searchlib/util/filekit.h>
@@ -277,14 +276,13 @@ IndexMaintainer::loadDiskIndex(const string &indexDir)
if (LOG_WOULD_LOG(event)) {
EventLogger::diskIndexLoadStart(indexDir);
}
- FastOS_Time timer;
- timer.SetNow();
+ fastos::StopWatch stopWatch;
_active_indexes->setActive(indexDir);
IDiskIndex::SP retval(new DiskIndexWithDestructorClosure
(_operations.loadDiskIndex(indexDir),
makeClosure(this, &IndexMaintainer::deactivateDiskIndexes, indexDir)));
if (LOG_WOULD_LOG(event)) {
- EventLogger::diskIndexLoadComplete(indexDir, (int64_t)timer.MilliSecsToNow());
+ EventLogger::diskIndexLoadComplete(indexDir, stopWatch.stop().elapsed().ms());
}
return retval;
}
@@ -297,8 +295,7 @@ IndexMaintainer::reloadDiskIndex(const IDiskIndex &oldIndex)
if (LOG_WOULD_LOG(event)) {
EventLogger::diskIndexLoadStart(indexDir);
}
- FastOS_Time timer;
- timer.SetNow();
+ fastos::StopWatch stopWatch;
_active_indexes->setActive(indexDir);
const IDiskIndex &wrappedDiskIndex =
(dynamic_cast<const DiskIndexWithDestructorClosure &>(oldIndex)).getWrapped();
@@ -306,7 +303,7 @@ IndexMaintainer::reloadDiskIndex(const IDiskIndex &oldIndex)
(_operations.reloadDiskIndex(wrappedDiskIndex),
makeClosure(this, &IndexMaintainer::deactivateDiskIndexes, indexDir)));
if (LOG_WOULD_LOG(event)) {
- EventLogger::diskIndexLoadComplete(indexDir, (int64_t)timer.MilliSecsToNow());
+ EventLogger::diskIndexLoadComplete(indexDir, stopWatch.stop().elapsed().ms());
}
return retval;
}
@@ -441,7 +438,7 @@ IndexMaintainer::FlushArgs::FlushArgs()
_prunedSchema()
{
}
-IndexMaintainer::FlushArgs::~FlushArgs() { }
+IndexMaintainer::FlushArgs::~FlushArgs() = default;
IndexMaintainer::FlushArgs::FlushArgs(FlushArgs &&) = default;
IndexMaintainer::FlushArgs & IndexMaintainer::FlushArgs::operator=(FlushArgs &&) = default;