Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
SeaRise committed Feb 8, 2023
1 parent 443077f commit 4e067e1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion dbms/src/Flash/Executor/tests/gtest_to_ru.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,19 @@ TEST_F(TestToRU, base)

auto base_ru = toRU(1);
ASSERT_TRUE(base_ru > 0);

for (size_t i = 1; i < 10; ++i)
{
auto ru = toRU(i);
ASSERT_TRUE(ru >= base_ru);
base_ru = ru;
}

constexpr auto ten_ms = 10'000'000;
for (size_t i = 1; i < 20; ++i)
{
auto ru = toRU(i * ten_ms);
ASSERT_TRUE(base_ru < ru);
ASSERT_TRUE(ru > base_ru);
base_ru = ru;
}
}
Expand Down
2 changes: 1 addition & 1 deletion dbms/src/Flash/Executor/toRU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ UInt64 toCPUTimeMillisecond(UInt64 cpu_time_ns)
}
} // namespace

// 3 ru = 1 millisecond cpu time
// 1 ru = 3 millisecond cpu time
RU toRU(UInt64 cpu_time_ns)
{
if (unlikely(cpu_time_ns == 0))
Expand Down

0 comments on commit 4e067e1

Please sign in to comment.