-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathcompaction_map.cpp
38 lines (29 loc) · 1.02 KB
/
compaction_map.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <cloud/filestore/libs/storage/tablet/tablet_state.h>
#include <library/cpp/testing/benchmark/bench.h>
using namespace NCloud;
using namespace NCloud::NFileStore;
using namespace NCloud::NFileStore::NStorage;
namespace {
////////////////////////////////////////////////////////////////////////////////
TVector<TCompactionRangeInfo> GenerateTestData()
{
TVector<TCompactionRangeInfo> compactionRanges;
ui32 rangeId = 0;
for (ui32 i = 1; i <= 1e3; ++i) {
while (rangeId < TCompactionMap::GroupSize * i) {
compactionRanges.emplace_back(rangeId, TCompactionStats{100, 100});
rangeId += 2;
}
}
return compactionRanges;
}
} // namespace
////////////////////////////////////////////////////////////////////////////////
const auto CompactionRanges = GenerateTestData();
Y_CPU_BENCHMARK(TCompactionMap_Load, iface)
{
for (size_t i = 0; i < iface.Iterations(); ++i) {
TIndexTabletState tabletState;
tabletState.LoadCompactionMap(CompactionRanges);
}
}