本文整理汇总了C++中Store::WriteEnvelope方法的典型用法代码示例。如果您正苦于以下问题:C++ Store::WriteEnvelope方法的具体用法?C++ Store::WriteEnvelope怎么用?C++ Store::WriteEnvelope使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Store
的用法示例。
在下文中一共展示了Store::WriteEnvelope方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fos
TEST_F(Benchmark, SimpleStoreIO)
{
{
const int32 n = 1000000;
Envelope e;
Store * s = this->GetTemporaryStore();
ASSERT_TRUE(s->CreateBucket("foo"));
ASSERT_TRUE(s->CreateStreamset("foo", "bar"));
TIMER_START(n);
s->WriteEnvelope("foo", "bar", e);
TIMER_END("zippylog.store.write_1M_empty_envelopes");
}
{
const int32 n = 1000000;
Envelope e;
string path = ::zippylog::platform::PathJoin(this->GetTemporaryDirectory(), "s.zippylog");
{
::zippylog::FileOutputStream fos(path);
for (int32 i = 0; i < n; i++) {
fos.WriteEnvelope(e);
}
}
::zippylog::FileInputStream fis(path);
uint32 read;
TIMER_START(n);
fis.ReadEnvelope(e, read);
TIMER_END("zippylog.FileInputStream.read_1M_empty_envelopes");
}
{
const int32 n = 1000000;
Envelope *envelopes = new Envelope[n];
for (int32 i = 0; i < n; i++) {
envelopes[i] = this->GetRandomEnvelope();
}
{
Store * s = this->GetTemporaryStore();
ASSERT_TRUE(s->CreateBucket("foo"));
ASSERT_TRUE(s->CreateStreamset("foo", "bar"));
TIMER_START_SINGLE();
for (int32 i = 0; i < n; i++) {
s->WriteEnvelope("foo", "bar", envelopes[i]);
}
TIMER_END_COUNT("zippylog.store.write_1M_random_envelopes", n);
}
{
string path = ::zippylog::platform::PathJoin(this->GetTemporaryDirectory(), "s.zippylog");
{
::zippylog::FileOutputStream fos(path);
TIMER_START(n);
fos.WriteEnvelope(envelopes[TIMER_LOOP_VALUE - 1]);
TIMER_END("zippylog.FileOutputStream.write_1M_random_envelopes");
}
Envelope e;
::zippylog::FileInputStream fis(path);
uint32 read;
TIMER_START(n);
fis.ReadEnvelope(e, read);
TIMER_END("zippylog.FileInputStream.read_1M_random_envelopes");
}
delete [] envelopes;
}
}