summaryrefslogtreecommitdiff
path: root/extractor/linear_merger.cc
diff options
context:
space:
mode:
Diffstat (limited to 'extractor/linear_merger.cc')
-rw-r--r--extractor/linear_merger.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/extractor/linear_merger.cc b/extractor/linear_merger.cc
index 666f8d87..7233f945 100644
--- a/extractor/linear_merger.cc
+++ b/extractor/linear_merger.cc
@@ -1,5 +1,6 @@
#include "linear_merger.h"
+#include <chrono>
#include <cmath>
#include "data_array.h"
@@ -9,6 +10,10 @@
#include "phrase_location.h"
#include "vocabulary.h"
+using namespace std::chrono;
+
+typedef high_resolution_clock Clock;
+
LinearMerger::LinearMerger(shared_ptr<Vocabulary> vocabulary,
shared_ptr<DataArray> data_array,
shared_ptr<MatchingComparator> comparator) :
@@ -22,7 +27,9 @@ void LinearMerger::Merge(
vector<int>& locations, const Phrase& phrase, const Phrase& suffix,
vector<int>::iterator prefix_start, vector<int>::iterator prefix_end,
vector<int>::iterator suffix_start, vector<int>::iterator suffix_end,
- int prefix_subpatterns, int suffix_subpatterns) const {
+ int prefix_subpatterns, int suffix_subpatterns) {
+ Clock::time_point start = Clock::now();
+
int last_chunk_len = suffix.GetChunkLen(suffix.Arity());
bool offset = !vocabulary->IsTerminal(suffix.GetSymbol(0));
@@ -62,4 +69,7 @@ void LinearMerger::Merge(
prefix_start += prefix_subpatterns;
}
}
+
+ Clock::time_point stop = Clock::now();
+ linear_merge_time += duration_cast<milliseconds>(stop - start).count();
}