-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathlayout.cpp
More file actions
52 lines (39 loc) · 1.33 KB
/
layout.cpp
File metadata and controls
52 lines (39 loc) · 1.33 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//
// Created by Ivan Shynkarenka on 11.07.2016
//
#include "benchmark/cppbenchmark.h"
#include "logging/layouts/binary_layout.h"
#include "logging/layouts/hash_layout.h"
#include "logging/layouts/text_layout.h"
using namespace CppLogging;
BENCHMARK("BinaryLayout")
{
static BinaryLayout layout;
static Record record;
record.Clear();
record.logger = "Test logger";
record.StoreFormat("Test {}.{}.{} message", context.metrics().total_operations(), context.metrics().total_operations() / 1000.0, "bin");
layout.LayoutRecord(record);
context.metrics().AddBytes(record.raw.size());
}
BENCHMARK("HashLayout")
{
static HashLayout layout;
static Record record;
record.Clear();
record.logger = "Test logger";
record.StoreFormat("Test {}.{}.{} message", context.metrics().total_operations(), context.metrics().total_operations() / 1000.0, "bin");
layout.LayoutRecord(record);
context.metrics().AddBytes(record.raw.size());
}
BENCHMARK("TextLayout")
{
static TextLayout layout;
static Record record;
record.Clear();
record.logger = "Test logger";
record.StoreFormat("Test {}.{}.{} message", context.metrics().total_operations(), context.metrics().total_operations() / 1000.0, "txt");
layout.LayoutRecord(record);
context.metrics().AddBytes(record.raw.size());
}
BENCHMARK_MAIN()