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 authored and glutenperfbot committed Aug 13, 2024
1 parent c3d8bf0 commit b08b429
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 b08b429

Please sign in to comment.