aboutsummaryrefslogtreecommitdiff
path: root/icing/util/clock.h
diff options
context:
space:
mode:
authorGrace Zhao <gracezrx@google.com>2022-09-08 20:26:31 +0000
committerGrace Zhao <gracezrx@google.com>2022-09-08 22:53:11 +0000
commitb02eecda6a12241798cdbaaa7069d19f2fc5f41f (patch)
tree15687379068030d4d5443c916d91e9ed364f9b39 /icing/util/clock.h
parent87267cbc5531600072a283ba0c9500c3fcac87af (diff)
downloadicing-b02eecda6a12241798cdbaaa7069d19f2fc5f41f.tar.gz
Sync from upstream.
Descriptions: ====================================================================== [FileBackedVector Consolidation][4/x] Fix potential PWrite bug in GrowIfNecessary ====================================================================== [FileBackedVector Consolidation][5/x] Create benchmark for FileBackedVector ====================================================================== [FileBackedVector Consolidation][6/x] Avoid calling GetFileSize in GrowIfNecessary ====================================================================== [PersistentHashMap][3.3/x] Implement Delete ====================================================================== Fix the PopulateMatchedTermsStats bug ====================================================================== Add JNI latency for query latency stats breakdown. ====================================================================== [ResultStateManager] Thread safety test1 ====================================================================== [ResultStateManager][2/x] Thread safety test2 ====================================================================== Add native lock contention latency for measuring query latency ====================================================================== Fix implementation of HasMember operator in ANTLR-based list-filter prototype. ====================================================================== Fix improper uses of std::string_view ====================================================================== Extend the scale of Icing ====================================================================== Decouple the term frequency array from DocHitInfo ====================================================================== Disable hit_term_frequency for non-relevance queries ====================================================================== [ResultStateManager][3/x] Thread safety test3 ====================================================================== [PersistentHashMap][4/x] Implement iterator ======================================================================= Fix the lite index compaction bug ======================================================================= Change-Id: I0edad67affed97af107e2d7cd73770e0268c0903
Diffstat (limited to 'icing/util/clock.h')
-rw-r--r--icing/util/clock.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/icing/util/clock.h b/icing/util/clock.h
index 9e57854..d987a4c 100644
--- a/icing/util/clock.h
+++ b/icing/util/clock.h
@@ -42,12 +42,12 @@ class Timer {
virtual ~Timer() = default;
// Returns the elapsed time from when timer started.
- virtual int64_t GetElapsedMilliseconds() {
+ virtual int64_t GetElapsedMilliseconds() const {
return GetElapsedNanoseconds() / 1000000;
}
// Returns the elapsed time from when timer started.
- virtual int64_t GetElapsedNanoseconds() {
+ virtual int64_t GetElapsedNanoseconds() const {
return GetSteadyTimeNanoseconds() - start_timestamp_nanoseconds_;
}
@@ -90,6 +90,8 @@ class ScopedTimer {
}
}
+ const Timer& timer() const { return *timer_; }
+
private:
std::unique_ptr<Timer> timer_;
std::function<void(int64_t)> callback_;