Skip to content

Commit 66e51f9

Browse files
author
Chengcheng Jin
committed
[oap ] Fix unit test MicrosecondTimer is too large to track
1 parent 9f076f5 commit 66e51f9

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

velox/exec/SpillFile.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,16 @@ void SpillInputStream::next(bool /*throwIfPastEnd*/) {
6666
uint64_t readTimeUs{0};
6767
if (readaWait_.valid()) {
6868
{
69-
MicrosecondTimer timer{&readTimeUs};
69+
// TODO: it is ns not us, wait to change, just make unit test fine, wait
70+
// PR to change, MicrosecondTimer is too big.
71+
auto start = std::chrono::steady_clock::now();
7072
readBytes = std::move(readaWait_)
7173
.via(&folly::QueuedImmediateExecutor::instance())
7274
.wait()
7375
.value();
76+
auto duration = std::chrono::duration_cast<std::chrono::nanoseconds>(
77+
std::chrono::steady_clock::now() - start);
78+
readTimeUs = duration.count();
7479
VELOX_CHECK(!readaWait_.valid());
7580
}
7681
VELOX_CHECK_LT(0, readBytes, "Reading past end of spill file");
@@ -79,8 +84,11 @@ void SpillInputStream::next(bool /*throwIfPastEnd*/) {
7984
readBytes = readSize();
8085
VELOX_CHECK_LT(0, readBytes, "Reading past end of spill file");
8186
{
82-
MicrosecondTimer timer{&readTimeUs};
87+
auto start = std::chrono::steady_clock::now();
8388
file_->pread(offset_, readBytes, buffer()->asMutable<char>());
89+
auto duration = std::chrono::duration_cast<std::chrono::nanoseconds>(
90+
std::chrono::steady_clock::now() - start);
91+
readTimeUs = duration.count();
8492
}
8593
}
8694
setRange({buffer()->asMutable<uint8_t>(), readBytes, 0});

0 commit comments

Comments
 (0)