Skip to content

Commit

Permalink
[oap ] Fix unit test MicrosecondTimer is too large to track
Browse files Browse the repository at this point in the history
  • Loading branch information
jinchengchenghh committed Aug 9, 2024
1 parent 9f076f5 commit 66e51f9
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions velox/exec/SpillFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,16 @@ void SpillInputStream::next(bool /*throwIfPastEnd*/) {
uint64_t readTimeUs{0};
if (readaWait_.valid()) {
{
MicrosecondTimer timer{&readTimeUs};
// TODO: it is ns not us, wait to change, just make unit test fine, wait
// PR to change, MicrosecondTimer is too big.
auto start = std::chrono::steady_clock::now();
readBytes = std::move(readaWait_)
.via(&folly::QueuedImmediateExecutor::instance())
.wait()
.value();
auto duration = std::chrono::duration_cast<std::chrono::nanoseconds>(
std::chrono::steady_clock::now() - start);
readTimeUs = duration.count();
VELOX_CHECK(!readaWait_.valid());
}
VELOX_CHECK_LT(0, readBytes, "Reading past end of spill file");
Expand All @@ -79,8 +84,11 @@ void SpillInputStream::next(bool /*throwIfPastEnd*/) {
readBytes = readSize();
VELOX_CHECK_LT(0, readBytes, "Reading past end of spill file");
{
MicrosecondTimer timer{&readTimeUs};
auto start = std::chrono::steady_clock::now();
file_->pread(offset_, readBytes, buffer()->asMutable<char>());
auto duration = std::chrono::duration_cast<std::chrono::nanoseconds>(
std::chrono::steady_clock::now() - start);
readTimeUs = duration.count();
}
}
setRange({buffer()->asMutable<uint8_t>(), readBytes, 0});
Expand Down

0 comments on commit 66e51f9

Please sign in to comment.