本文整理汇总了C++中BloomFilter::GetFilter方法的典型用法代码示例。如果您正苦于以下问题:C++ BloomFilter::GetFilter方法的具体用法?C++ BloomFilter::GetFilter怎么用?C++ BloomFilter::GetFilter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BloomFilter
的用法示例。
在下文中一共展示了BloomFilter::GetFilter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(void)
{
vector<long long> BloomDataAddTime;
vector<long long> BloomDataSubTime;
vector<unsigned long long> BloomDataSize;
std::cout << "ブルームフィルタテスト" << std::endl;
std::cout << "測定開始" << std::endl;
for (int count = 1; count <= 100; count++)
{
BloomFilter BF;
auto Start = std::chrono::system_clock::now();
for (int i = 0; i < 100; i++)
{
BF.AddText(to_string(i));
std::cout << BF.GetFilter() << std::endl;
}
auto End = std::chrono::system_clock::now();
auto Time = End - Start;
auto ms = std::chrono::duration_cast<std::chrono::milliseconds>(Time).count();
BloomDataAddTime.push_back(ms);
BloomDataSize.push_back(sizeof(BF));
Start = std::chrono::system_clock::now();
for (int i = 0; i < 100; i++)
{
BF.SubText(to_string(i));
std::cout << BF.GetFilter() << std::endl;
}
End = std::chrono::system_clock::now();
Time = End - Start;
ms = std::chrono::duration_cast<std::chrono::milliseconds>(Time).count();
BloomDataSubTime.push_back(ms);
}
std::cout << "測定終了" << std::endl;
std::cout << "データ追加" << std::endl;
std::sort(BloomDataAddTime.begin(), BloomDataAddTime.end());
std::cout << "最低値" << std::endl;
std::cout << "AddTime : "<< BloomDataAddTime.front() << std::endl;
std::cout << "AddSize : " << BloomDataSize.front() << std::endl;
std::cout << "最高値" << std::endl;
std::cout << "AddTime : " << BloomDataAddTime.back() << std::endl;
std::cout << "AddSize : " << BloomDataSize.back() << std::endl;
std::cout << "中央値" << std::endl;
if (BloomDataAddTime.size() % 2 == 0)
{
int pos = BloomDataAddTime.size() / 2;
std::cout << "AddTime : " << (BloomDataAddTime[pos] + BloomDataAddTime[pos + 1]) / 2 << std::endl;
}
else
{
std::cout << "AddTime : " << BloomDataAddTime[(int)(BloomDataAddTime.size() / 2+1)]<< std::endl;
}
if (BloomDataSize.size() % 2 == 0)
{
int pos = BloomDataSize.size() / 2;
std::cout << "AddSize : " << (BloomDataSize[pos] + BloomDataSize[pos + 1]) / 2 << std::endl;
}
else
{
std::cout << "AddSize : " << BloomDataSize[(int) (BloomDataSize.size() / 2 + 1)] << std::endl;
}
std::cout << "平均値" << std::endl;
long long Average = 0;
for (auto Time : BloomDataAddTime)
{
Average += Time;
}
std::cout << "AddTime : " << (float) Average / BloomDataAddTime.size() << std::endl;
Average = 0;
for (auto Time : BloomDataSize)
{
Average += Time;
}
std::cout << "データサイズ" << std::endl;
std::sort(BloomDataSize.begin(), BloomDataSize.end());
std::cout << "AddSize : " << (float) Average / BloomDataSize.size() << std::endl;
std::cout << "データ削除" << std::endl;
std::sort(BloomDataSubTime.begin(), BloomDataSubTime.end());
std::cout << "最低値" << std::endl;
std::cout << "SubTime : " << BloomDataSubTime.front() << std::endl;
std::cout << "最高値" << std::endl;
std::cout << "SubTime : " << BloomDataSubTime.back() << std::endl;
std::cout << "中央値" << std::endl;
if (BloomDataSubTime.size() % 2 == 0)
{
int pos = BloomDataSubTime.size() / 2;
std::cout << "SubTime : " << (BloomDataSubTime[pos] + BloomDataSubTime[pos + 1]) / 2 << std::endl;
}
else
//.........这里部分代码省略.........