]>
Commit | Line | Data |
---|---|---|
11fdf7f2 TL |
1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. |
2 | // This source code is licensed under both the GPLv2 (found in the | |
3 | // COPYING file in the root directory) and Apache 2.0 License | |
4 | // (found in the LICENSE.Apache file in the root directory). | |
5 | // | |
6 | // Copyright (c) 2012 The LevelDB Authors. All rights reserved. | |
7 | // Use of this source code is governed by a BSD-style license that can be | |
8 | // found in the LICENSE file. See the AUTHORS file for names of contributors. | |
9 | ||
10 | #ifndef ROCKSDB_LITE | |
11 | #ifndef GFLAGS | |
12 | #include <cstdio> | |
13 | int main() { | |
14 | fprintf(stderr, "Please install gflags to run trace_analyzer test\n"); | |
1e59de90 | 15 | return 0; |
11fdf7f2 TL |
16 | } |
17 | #else | |
18 | ||
19 | #include <chrono> | |
20 | #include <cstdio> | |
21 | #include <cstdlib> | |
22 | #include <sstream> | |
23 | #include <thread> | |
24 | ||
25 | #include "db/db_test_util.h" | |
1e59de90 | 26 | #include "file/line_file_reader.h" |
11fdf7f2 TL |
27 | #include "rocksdb/db.h" |
28 | #include "rocksdb/env.h" | |
29 | #include "rocksdb/status.h" | |
30 | #include "rocksdb/trace_reader_writer.h" | |
f67539c2 TL |
31 | #include "test_util/testharness.h" |
32 | #include "test_util/testutil.h" | |
11fdf7f2 | 33 | #include "tools/trace_analyzer_tool.h" |
f67539c2 | 34 | #include "trace_replay/trace_replay.h" |
11fdf7f2 | 35 | |
f67539c2 | 36 | namespace ROCKSDB_NAMESPACE { |
11fdf7f2 TL |
37 | |
38 | namespace { | |
39 | static const int kMaxArgCount = 100; | |
40 | static const size_t kArgBufferSize = 100000; | |
41 | } // namespace | |
42 | ||
1e59de90 TL |
43 | // Note that, the QPS part verification of the analyzing result is not robost |
44 | // enough and causes the failure in some rare cases. Disable them temporally and | |
45 | // wait for future refactor. | |
46 | ||
11fdf7f2 TL |
47 | // The helper functions for the test |
48 | class TraceAnalyzerTest : public testing::Test { | |
49 | public: | |
50 | TraceAnalyzerTest() : rnd_(0xFB) { | |
51 | // test_path_ = test::TmpDir() + "trace_analyzer_test"; | |
52 | test_path_ = test::PerThreadDBPath("trace_analyzer_test"); | |
f67539c2 | 53 | env_ = ROCKSDB_NAMESPACE::Env::Default(); |
20effc67 | 54 | env_->CreateDir(test_path_).PermitUncheckedError(); |
11fdf7f2 TL |
55 | dbname_ = test_path_ + "/db"; |
56 | } | |
57 | ||
494da23a | 58 | ~TraceAnalyzerTest() override {} |
11fdf7f2 TL |
59 | |
60 | void GenerateTrace(std::string trace_path) { | |
61 | Options options; | |
62 | options.create_if_missing = true; | |
63 | options.merge_operator = MergeOperators::CreatePutOperator(); | |
1e59de90 TL |
64 | Slice upper_bound("a"); |
65 | Slice lower_bound("abce"); | |
11fdf7f2 | 66 | ReadOptions ro; |
1e59de90 TL |
67 | ro.iterate_upper_bound = &upper_bound; |
68 | ro.iterate_lower_bound = &lower_bound; | |
11fdf7f2 TL |
69 | WriteOptions wo; |
70 | TraceOptions trace_opt; | |
71 | DB* db_ = nullptr; | |
72 | std::string value; | |
73 | std::unique_ptr<TraceWriter> trace_writer; | |
74 | Iterator* single_iter = nullptr; | |
75 | ||
76 | ASSERT_OK( | |
77 | NewFileTraceWriter(env_, env_options_, trace_path, &trace_writer)); | |
78 | ASSERT_OK(DB::Open(options, dbname_, &db_)); | |
79 | ASSERT_OK(db_->StartTrace(trace_opt, std::move(trace_writer))); | |
80 | ||
81 | WriteBatch batch; | |
82 | ASSERT_OK(batch.Put("a", "aaaaaaaaa")); | |
83 | ASSERT_OK(batch.Merge("b", "aaaaaaaaaaaaaaaaaaaa")); | |
84 | ASSERT_OK(batch.Delete("c")); | |
85 | ASSERT_OK(batch.SingleDelete("d")); | |
86 | ASSERT_OK(batch.DeleteRange("e", "f")); | |
87 | ASSERT_OK(db_->Write(wo, &batch)); | |
1e59de90 TL |
88 | std::vector<Slice> keys; |
89 | keys.push_back("a"); | |
90 | keys.push_back("b"); | |
91 | keys.push_back("df"); | |
92 | keys.push_back("gege"); | |
93 | keys.push_back("hjhjhj"); | |
94 | std::vector<std::string> values; | |
95 | std::vector<Status> ss = db_->MultiGet(ro, keys, &values); | |
96 | ASSERT_GE(ss.size(), 0); | |
97 | ASSERT_OK(ss[0]); | |
98 | ASSERT_NOK(ss[2]); | |
99 | std::vector<ColumnFamilyHandle*> cfs(2, db_->DefaultColumnFamily()); | |
100 | std::vector<PinnableSlice> values2(keys.size()); | |
101 | db_->MultiGet(ro, 2, cfs.data(), keys.data(), values2.data(), ss.data(), | |
102 | false); | |
103 | ASSERT_OK(ss[0]); | |
104 | db_->MultiGet(ro, db_->DefaultColumnFamily(), 2, keys.data() + 3, | |
105 | values2.data(), ss.data(), false); | |
11fdf7f2 | 106 | ASSERT_OK(db_->Get(ro, "a", &value)); |
1e59de90 | 107 | |
11fdf7f2 TL |
108 | single_iter = db_->NewIterator(ro); |
109 | single_iter->Seek("a"); | |
1e59de90 | 110 | ASSERT_OK(single_iter->status()); |
11fdf7f2 | 111 | single_iter->SeekForPrev("b"); |
1e59de90 | 112 | ASSERT_OK(single_iter->status()); |
11fdf7f2 | 113 | delete single_iter; |
1e59de90 | 114 | std::this_thread::sleep_for(std::chrono::seconds(1)); |
11fdf7f2 | 115 | |
1e59de90 | 116 | db_->Get(ro, "g", &value).PermitUncheckedError(); |
11fdf7f2 TL |
117 | |
118 | ASSERT_OK(db_->EndTrace()); | |
119 | ||
120 | ASSERT_OK(env_->FileExists(trace_path)); | |
121 | ||
122 | std::unique_ptr<WritableFile> whole_f; | |
123 | std::string whole_path = test_path_ + "/0.txt"; | |
124 | ASSERT_OK(env_->NewWritableFile(whole_path, &whole_f, env_options_)); | |
125 | std::string whole_str = "0x61\n0x62\n0x63\n0x64\n0x65\n0x66\n"; | |
126 | ASSERT_OK(whole_f->Append(whole_str)); | |
127 | delete db_; | |
128 | ASSERT_OK(DestroyDB(dbname_, options)); | |
129 | } | |
130 | ||
131 | void RunTraceAnalyzer(const std::vector<std::string>& args) { | |
132 | char arg_buffer[kArgBufferSize]; | |
133 | char* argv[kMaxArgCount]; | |
134 | int argc = 0; | |
135 | int cursor = 0; | |
136 | ||
137 | for (const auto& arg : args) { | |
138 | ASSERT_LE(cursor + arg.size() + 1, kArgBufferSize); | |
139 | ASSERT_LE(argc + 1, kMaxArgCount); | |
140 | snprintf(arg_buffer + cursor, arg.size() + 1, "%s", arg.c_str()); | |
141 | ||
142 | argv[argc++] = arg_buffer + cursor; | |
143 | cursor += static_cast<int>(arg.size()) + 1; | |
144 | } | |
145 | ||
f67539c2 | 146 | ASSERT_EQ(0, ROCKSDB_NAMESPACE::trace_analyzer_tool(argc, argv)); |
11fdf7f2 TL |
147 | } |
148 | ||
149 | void CheckFileContent(const std::vector<std::string>& cnt, | |
150 | std::string file_path, bool full_content) { | |
1e59de90 TL |
151 | const auto& fs = env_->GetFileSystem(); |
152 | FileOptions fopts(env_options_); | |
153 | ||
154 | ASSERT_OK(fs->FileExists(file_path, fopts.io_options, nullptr)); | |
155 | std::unique_ptr<FSSequentialFile> file; | |
156 | ASSERT_OK(fs->NewSequentialFile(file_path, fopts, &file, nullptr)); | |
157 | ||
158 | LineFileReader lf_reader(std::move(file), file_path, | |
159 | 4096 /* filereadahead_size */); | |
11fdf7f2 | 160 | |
11fdf7f2 | 161 | std::vector<std::string> result; |
1e59de90 TL |
162 | std::string line; |
163 | while ( | |
164 | lf_reader.ReadLine(&line, Env::IO_TOTAL /* rate_limiter_priority */)) { | |
165 | result.push_back(line); | |
11fdf7f2 TL |
166 | } |
167 | ||
1e59de90 TL |
168 | ASSERT_OK(lf_reader.GetStatus()); |
169 | ||
170 | size_t min_size = std::min(cnt.size(), result.size()); | |
171 | for (size_t i = 0; i < min_size; i++) { | |
11fdf7f2 TL |
172 | if (full_content) { |
173 | ASSERT_EQ(result[i], cnt[i]); | |
174 | } else { | |
175 | ASSERT_EQ(result[i][0], cnt[i][0]); | |
176 | } | |
177 | } | |
178 | ||
179 | return; | |
180 | } | |
181 | ||
182 | void AnalyzeTrace(std::vector<std::string>& paras_diff, | |
183 | std::string output_path, std::string trace_path) { | |
184 | std::vector<std::string> paras = {"./trace_analyzer", | |
185 | "-convert_to_human_readable_trace", | |
186 | "-output_key_stats", | |
187 | "-output_access_count_stats", | |
188 | "-output_prefix=test", | |
189 | "-output_prefix_cut=1", | |
190 | "-output_time_series", | |
191 | "-output_value_distribution", | |
192 | "-output_qps_stats", | |
193 | "-no_key", | |
194 | "-no_print"}; | |
195 | for (auto& para : paras_diff) { | |
196 | paras.push_back(para); | |
197 | } | |
198 | Status s = env_->FileExists(trace_path); | |
199 | if (!s.ok()) { | |
200 | GenerateTrace(trace_path); | |
201 | } | |
20effc67 | 202 | ASSERT_OK(env_->CreateDir(output_path)); |
11fdf7f2 TL |
203 | RunTraceAnalyzer(paras); |
204 | } | |
205 | ||
f67539c2 | 206 | ROCKSDB_NAMESPACE::Env* env_; |
11fdf7f2 TL |
207 | EnvOptions env_options_; |
208 | std::string test_path_; | |
209 | std::string dbname_; | |
210 | Random rnd_; | |
211 | }; | |
212 | ||
213 | TEST_F(TraceAnalyzerTest, Get) { | |
214 | std::string trace_path = test_path_ + "/trace"; | |
215 | std::string output_path = test_path_ + "/get"; | |
216 | std::string file_path; | |
20effc67 TL |
217 | std::vector<std::string> paras = { |
218 | "-analyze_get=true", "-analyze_put=false", | |
219 | "-analyze_delete=false", "-analyze_single_delete=false", | |
1e59de90 TL |
220 | "-analyze_range_delete=false", "-analyze_iterator=false", |
221 | "-analyze_multiget=false"}; | |
11fdf7f2 TL |
222 | paras.push_back("-output_dir=" + output_path); |
223 | paras.push_back("-trace_path=" + trace_path); | |
224 | paras.push_back("-key_space_dir=" + test_path_); | |
225 | AnalyzeTrace(paras, output_path, trace_path); | |
226 | ||
227 | // check the key_stats file | |
228 | std::vector<std::string> k_stats = {"0 10 0 1 1.000000", "0 10 1 1 1.000000"}; | |
229 | file_path = output_path + "/test-get-0-accessed_key_stats.txt"; | |
230 | CheckFileContent(k_stats, file_path, true); | |
231 | ||
232 | // Check the access count distribution | |
233 | std::vector<std::string> k_dist = {"access_count: 1 num: 2"}; | |
234 | file_path = output_path + "/test-get-0-accessed_key_count_distribution.txt"; | |
235 | CheckFileContent(k_dist, file_path, true); | |
236 | ||
237 | // Check the trace sequence | |
1e59de90 TL |
238 | std::vector<std::string> k_sequence = {"1", "5", "2", "3", "4", "8", |
239 | "8", "8", "8", "8", "8", "8", | |
240 | "8", "8", "0", "6", "7", "0"}; | |
11fdf7f2 TL |
241 | file_path = output_path + "/test-human_readable_trace.txt"; |
242 | CheckFileContent(k_sequence, file_path, false); | |
243 | ||
244 | // Check the prefix | |
245 | std::vector<std::string> k_prefix = {"0 0 0 0.000000 0.000000 0x30", | |
246 | "1 1 1 1.000000 1.000000 0x61"}; | |
247 | file_path = output_path + "/test-get-0-accessed_key_prefix_cut.txt"; | |
248 | CheckFileContent(k_prefix, file_path, true); | |
249 | ||
250 | // Check the time series | |
251 | std::vector<std::string> k_series = {"0 1533000630 0", "0 1533000630 1"}; | |
252 | file_path = output_path + "/test-get-0-time_series.txt"; | |
253 | CheckFileContent(k_series, file_path, false); | |
254 | ||
255 | // Check the accessed key in whole key space | |
256 | std::vector<std::string> k_whole_access = {"0 1"}; | |
257 | file_path = output_path + "/test-get-0-whole_key_stats.txt"; | |
258 | CheckFileContent(k_whole_access, file_path, true); | |
259 | ||
260 | // Check the whole key prefix cut | |
261 | std::vector<std::string> k_whole_prefix = {"0 0x61", "1 0x62", "2 0x63", | |
262 | "3 0x64", "4 0x65", "5 0x66"}; | |
263 | file_path = output_path + "/test-get-0-whole_key_prefix_cut.txt"; | |
264 | CheckFileContent(k_whole_prefix, file_path, true); | |
265 | ||
1e59de90 | 266 | /* |
11fdf7f2 | 267 | // Check the overall qps |
1e59de90 | 268 | std::vector<std::string> all_qps = {"1 0 0 0 0 0 0 0 0 1"}; |
11fdf7f2 TL |
269 | file_path = output_path + "/test-qps_stats.txt"; |
270 | CheckFileContent(all_qps, file_path, true); | |
271 | ||
272 | // Check the qps of get | |
273 | std::vector<std::string> get_qps = {"1"}; | |
274 | file_path = output_path + "/test-get-0-qps_stats.txt"; | |
275 | CheckFileContent(get_qps, file_path, true); | |
276 | ||
277 | // Check the top k qps prefix cut | |
278 | std::vector<std::string> top_qps = {"At time: 0 with QPS: 1", | |
279 | "The prefix: 0x61 Access count: 1"}; | |
280 | file_path = output_path + "/test-get-0-accessed_top_k_qps_prefix_cut.txt"; | |
281 | CheckFileContent(top_qps, file_path, true); | |
1e59de90 | 282 | */ |
11fdf7f2 TL |
283 | } |
284 | ||
285 | // Test analyzing of Put | |
286 | TEST_F(TraceAnalyzerTest, Put) { | |
287 | std::string trace_path = test_path_ + "/trace"; | |
288 | std::string output_path = test_path_ + "/put"; | |
289 | std::string file_path; | |
20effc67 TL |
290 | std::vector<std::string> paras = { |
291 | "-analyze_get=false", "-analyze_put=true", | |
292 | "-analyze_delete=false", "-analyze_single_delete=false", | |
1e59de90 TL |
293 | "-analyze_range_delete=false", "-analyze_iterator=false", |
294 | "-analyze_multiget=false"}; | |
11fdf7f2 TL |
295 | paras.push_back("-output_dir=" + output_path); |
296 | paras.push_back("-trace_path=" + trace_path); | |
297 | paras.push_back("-key_space_dir=" + test_path_); | |
298 | AnalyzeTrace(paras, output_path, trace_path); | |
299 | ||
300 | // check the key_stats file | |
301 | std::vector<std::string> k_stats = {"0 9 0 1 1.000000"}; | |
302 | file_path = output_path + "/test-put-0-accessed_key_stats.txt"; | |
303 | CheckFileContent(k_stats, file_path, true); | |
304 | ||
305 | // Check the access count distribution | |
306 | std::vector<std::string> k_dist = {"access_count: 1 num: 1"}; | |
307 | file_path = output_path + "/test-put-0-accessed_key_count_distribution.txt"; | |
308 | CheckFileContent(k_dist, file_path, true); | |
309 | ||
310 | // Check the trace sequence | |
1e59de90 TL |
311 | std::vector<std::string> k_sequence = {"1", "5", "2", "3", "4", "8", |
312 | "8", "8", "8", "8", "8", "8", | |
313 | "8", "8", "0", "6", "7", "0"}; | |
11fdf7f2 TL |
314 | file_path = output_path + "/test-human_readable_trace.txt"; |
315 | CheckFileContent(k_sequence, file_path, false); | |
316 | ||
317 | // Check the prefix | |
318 | std::vector<std::string> k_prefix = {"0 0 0 0.000000 0.000000 0x30"}; | |
319 | file_path = output_path + "/test-put-0-accessed_key_prefix_cut.txt"; | |
320 | CheckFileContent(k_prefix, file_path, true); | |
321 | ||
322 | // Check the time series | |
323 | std::vector<std::string> k_series = {"1 1533056278 0"}; | |
324 | file_path = output_path + "/test-put-0-time_series.txt"; | |
325 | CheckFileContent(k_series, file_path, false); | |
326 | ||
327 | // Check the accessed key in whole key space | |
328 | std::vector<std::string> k_whole_access = {"0 1"}; | |
329 | file_path = output_path + "/test-put-0-whole_key_stats.txt"; | |
330 | CheckFileContent(k_whole_access, file_path, true); | |
331 | ||
332 | // Check the whole key prefix cut | |
333 | std::vector<std::string> k_whole_prefix = {"0 0x61", "1 0x62", "2 0x63", | |
334 | "3 0x64", "4 0x65", "5 0x66"}; | |
335 | file_path = output_path + "/test-put-0-whole_key_prefix_cut.txt"; | |
336 | CheckFileContent(k_whole_prefix, file_path, true); | |
337 | ||
338 | // Check the overall qps | |
1e59de90 | 339 | std::vector<std::string> all_qps = {"0 1 0 0 0 0 0 0 0 1"}; |
11fdf7f2 TL |
340 | file_path = output_path + "/test-qps_stats.txt"; |
341 | CheckFileContent(all_qps, file_path, true); | |
342 | ||
1e59de90 | 343 | /* |
11fdf7f2 TL |
344 | // Check the qps of Put |
345 | std::vector<std::string> get_qps = {"1"}; | |
346 | file_path = output_path + "/test-put-0-qps_stats.txt"; | |
347 | CheckFileContent(get_qps, file_path, true); | |
348 | ||
349 | // Check the top k qps prefix cut | |
350 | std::vector<std::string> top_qps = {"At time: 0 with QPS: 1", | |
351 | "The prefix: 0x61 Access count: 1"}; | |
352 | file_path = output_path + "/test-put-0-accessed_top_k_qps_prefix_cut.txt"; | |
353 | CheckFileContent(top_qps, file_path, true); | |
354 | ||
355 | // Check the value size distribution | |
356 | std::vector<std::string> value_dist = { | |
357 | "Number_of_value_size_between 0 and 16 is: 1"}; | |
358 | file_path = output_path + "/test-put-0-accessed_value_size_distribution.txt"; | |
359 | CheckFileContent(value_dist, file_path, true); | |
1e59de90 | 360 | */ |
11fdf7f2 TL |
361 | } |
362 | ||
363 | // Test analyzing of delete | |
364 | TEST_F(TraceAnalyzerTest, Delete) { | |
365 | std::string trace_path = test_path_ + "/trace"; | |
366 | std::string output_path = test_path_ + "/delete"; | |
367 | std::string file_path; | |
20effc67 TL |
368 | std::vector<std::string> paras = { |
369 | "-analyze_get=false", "-analyze_put=false", | |
370 | "-analyze_delete=true", "-analyze_single_delete=false", | |
1e59de90 TL |
371 | "-analyze_range_delete=false", "-analyze_iterator=false", |
372 | "-analyze_multiget=false"}; | |
11fdf7f2 TL |
373 | paras.push_back("-output_dir=" + output_path); |
374 | paras.push_back("-trace_path=" + trace_path); | |
375 | paras.push_back("-key_space_dir=" + test_path_); | |
376 | AnalyzeTrace(paras, output_path, trace_path); | |
377 | ||
378 | // check the key_stats file | |
1e59de90 | 379 | std::vector<std::string> k_stats = {"0 10 0 1 1.000000"}; |
11fdf7f2 TL |
380 | file_path = output_path + "/test-delete-0-accessed_key_stats.txt"; |
381 | CheckFileContent(k_stats, file_path, true); | |
382 | ||
383 | // Check the access count distribution | |
384 | std::vector<std::string> k_dist = {"access_count: 1 num: 1"}; | |
385 | file_path = | |
386 | output_path + "/test-delete-0-accessed_key_count_distribution.txt"; | |
387 | CheckFileContent(k_dist, file_path, true); | |
388 | ||
389 | // Check the trace sequence | |
1e59de90 TL |
390 | std::vector<std::string> k_sequence = {"1", "5", "2", "3", "4", "8", |
391 | "8", "8", "8", "8", "8", "8", | |
392 | "8", "8", "0", "6", "7", "0"}; | |
11fdf7f2 TL |
393 | file_path = output_path + "/test-human_readable_trace.txt"; |
394 | CheckFileContent(k_sequence, file_path, false); | |
395 | ||
396 | // Check the prefix | |
397 | std::vector<std::string> k_prefix = {"0 0 0 0.000000 0.000000 0x30"}; | |
398 | file_path = output_path + "/test-delete-0-accessed_key_prefix_cut.txt"; | |
399 | CheckFileContent(k_prefix, file_path, true); | |
400 | ||
401 | // Check the time series | |
402 | std::vector<std::string> k_series = {"2 1533000630 0"}; | |
403 | file_path = output_path + "/test-delete-0-time_series.txt"; | |
404 | CheckFileContent(k_series, file_path, false); | |
405 | ||
406 | // Check the accessed key in whole key space | |
407 | std::vector<std::string> k_whole_access = {"2 1"}; | |
408 | file_path = output_path + "/test-delete-0-whole_key_stats.txt"; | |
409 | CheckFileContent(k_whole_access, file_path, true); | |
410 | ||
411 | // Check the whole key prefix cut | |
412 | std::vector<std::string> k_whole_prefix = {"0 0x61", "1 0x62", "2 0x63", | |
413 | "3 0x64", "4 0x65", "5 0x66"}; | |
414 | file_path = output_path + "/test-delete-0-whole_key_prefix_cut.txt"; | |
415 | CheckFileContent(k_whole_prefix, file_path, true); | |
416 | ||
1e59de90 | 417 | /* |
11fdf7f2 | 418 | // Check the overall qps |
1e59de90 | 419 | std::vector<std::string> all_qps = {"0 0 1 0 0 0 0 0 0 1"}; |
11fdf7f2 TL |
420 | file_path = output_path + "/test-qps_stats.txt"; |
421 | CheckFileContent(all_qps, file_path, true); | |
422 | ||
423 | // Check the qps of Delete | |
424 | std::vector<std::string> get_qps = {"1"}; | |
425 | file_path = output_path + "/test-delete-0-qps_stats.txt"; | |
426 | CheckFileContent(get_qps, file_path, true); | |
427 | ||
428 | // Check the top k qps prefix cut | |
429 | std::vector<std::string> top_qps = {"At time: 0 with QPS: 1", | |
430 | "The prefix: 0x63 Access count: 1"}; | |
431 | file_path = output_path + "/test-delete-0-accessed_top_k_qps_prefix_cut.txt"; | |
432 | CheckFileContent(top_qps, file_path, true); | |
1e59de90 | 433 | */ |
11fdf7f2 TL |
434 | } |
435 | ||
436 | // Test analyzing of Merge | |
437 | TEST_F(TraceAnalyzerTest, Merge) { | |
438 | std::string trace_path = test_path_ + "/trace"; | |
439 | std::string output_path = test_path_ + "/merge"; | |
440 | std::string file_path; | |
20effc67 TL |
441 | std::vector<std::string> paras = { |
442 | "-analyze_get=false", "-analyze_put=false", | |
443 | "-analyze_delete=false", "-analyze_merge=true", | |
444 | "-analyze_single_delete=false", "-analyze_range_delete=false", | |
1e59de90 | 445 | "-analyze_iterator=false", "-analyze_multiget=false"}; |
11fdf7f2 TL |
446 | paras.push_back("-output_dir=" + output_path); |
447 | paras.push_back("-trace_path=" + trace_path); | |
448 | paras.push_back("-key_space_dir=" + test_path_); | |
449 | AnalyzeTrace(paras, output_path, trace_path); | |
450 | ||
451 | // check the key_stats file | |
452 | std::vector<std::string> k_stats = {"0 20 0 1 1.000000"}; | |
453 | file_path = output_path + "/test-merge-0-accessed_key_stats.txt"; | |
454 | CheckFileContent(k_stats, file_path, true); | |
455 | ||
456 | // Check the access count distribution | |
457 | std::vector<std::string> k_dist = {"access_count: 1 num: 1"}; | |
458 | file_path = output_path + "/test-merge-0-accessed_key_count_distribution.txt"; | |
459 | CheckFileContent(k_dist, file_path, true); | |
460 | ||
461 | // Check the trace sequence | |
1e59de90 TL |
462 | std::vector<std::string> k_sequence = {"1", "5", "2", "3", "4", "8", |
463 | "8", "8", "8", "8", "8", "8", | |
464 | "8", "8", "0", "6", "7", "0"}; | |
11fdf7f2 TL |
465 | file_path = output_path + "/test-human_readable_trace.txt"; |
466 | CheckFileContent(k_sequence, file_path, false); | |
467 | ||
468 | // Check the prefix | |
469 | std::vector<std::string> k_prefix = {"0 0 0 0.000000 0.000000 0x30"}; | |
470 | file_path = output_path + "/test-merge-0-accessed_key_prefix_cut.txt"; | |
471 | CheckFileContent(k_prefix, file_path, true); | |
472 | ||
473 | // Check the time series | |
474 | std::vector<std::string> k_series = {"5 1533000630 0"}; | |
475 | file_path = output_path + "/test-merge-0-time_series.txt"; | |
476 | CheckFileContent(k_series, file_path, false); | |
477 | ||
478 | // Check the accessed key in whole key space | |
479 | std::vector<std::string> k_whole_access = {"1 1"}; | |
480 | file_path = output_path + "/test-merge-0-whole_key_stats.txt"; | |
481 | CheckFileContent(k_whole_access, file_path, true); | |
482 | ||
483 | // Check the whole key prefix cut | |
484 | std::vector<std::string> k_whole_prefix = {"0 0x61", "1 0x62", "2 0x63", | |
485 | "3 0x64", "4 0x65", "5 0x66"}; | |
486 | file_path = output_path + "/test-merge-0-whole_key_prefix_cut.txt"; | |
487 | CheckFileContent(k_whole_prefix, file_path, true); | |
488 | ||
1e59de90 | 489 | /* |
11fdf7f2 | 490 | // Check the overall qps |
1e59de90 | 491 | std::vector<std::string> all_qps = {"0 0 0 0 0 1 0 0 0 1"}; |
11fdf7f2 TL |
492 | file_path = output_path + "/test-qps_stats.txt"; |
493 | CheckFileContent(all_qps, file_path, true); | |
494 | ||
495 | // Check the qps of Merge | |
496 | std::vector<std::string> get_qps = {"1"}; | |
497 | file_path = output_path + "/test-merge-0-qps_stats.txt"; | |
498 | CheckFileContent(get_qps, file_path, true); | |
499 | ||
500 | // Check the top k qps prefix cut | |
501 | std::vector<std::string> top_qps = {"At time: 0 with QPS: 1", | |
502 | "The prefix: 0x62 Access count: 1"}; | |
503 | file_path = output_path + "/test-merge-0-accessed_top_k_qps_prefix_cut.txt"; | |
504 | CheckFileContent(top_qps, file_path, true); | |
1e59de90 | 505 | */ |
11fdf7f2 TL |
506 | |
507 | // Check the value size distribution | |
508 | std::vector<std::string> value_dist = { | |
509 | "Number_of_value_size_between 0 and 24 is: 1"}; | |
510 | file_path = | |
511 | output_path + "/test-merge-0-accessed_value_size_distribution.txt"; | |
512 | CheckFileContent(value_dist, file_path, true); | |
513 | } | |
514 | ||
515 | // Test analyzing of SingleDelete | |
516 | TEST_F(TraceAnalyzerTest, SingleDelete) { | |
517 | std::string trace_path = test_path_ + "/trace"; | |
518 | std::string output_path = test_path_ + "/single_delete"; | |
519 | std::string file_path; | |
20effc67 TL |
520 | std::vector<std::string> paras = { |
521 | "-analyze_get=false", "-analyze_put=false", | |
522 | "-analyze_delete=false", "-analyze_merge=false", | |
523 | "-analyze_single_delete=true", "-analyze_range_delete=false", | |
1e59de90 | 524 | "-analyze_iterator=false", "-analyze_multiget=false"}; |
11fdf7f2 TL |
525 | paras.push_back("-output_dir=" + output_path); |
526 | paras.push_back("-trace_path=" + trace_path); | |
527 | paras.push_back("-key_space_dir=" + test_path_); | |
528 | AnalyzeTrace(paras, output_path, trace_path); | |
529 | ||
530 | // check the key_stats file | |
1e59de90 | 531 | std::vector<std::string> k_stats = {"0 10 0 1 1.000000"}; |
11fdf7f2 TL |
532 | file_path = output_path + "/test-single_delete-0-accessed_key_stats.txt"; |
533 | CheckFileContent(k_stats, file_path, true); | |
534 | ||
535 | // Check the access count distribution | |
536 | std::vector<std::string> k_dist = {"access_count: 1 num: 1"}; | |
537 | file_path = | |
538 | output_path + "/test-single_delete-0-accessed_key_count_distribution.txt"; | |
539 | CheckFileContent(k_dist, file_path, true); | |
540 | ||
541 | // Check the trace sequence | |
1e59de90 TL |
542 | std::vector<std::string> k_sequence = {"1", "5", "2", "3", "4", "8", |
543 | "8", "8", "8", "8", "8", "8", | |
544 | "8", "8", "0", "6", "7", "0"}; | |
11fdf7f2 TL |
545 | file_path = output_path + "/test-human_readable_trace.txt"; |
546 | CheckFileContent(k_sequence, file_path, false); | |
547 | ||
548 | // Check the prefix | |
549 | std::vector<std::string> k_prefix = {"0 0 0 0.000000 0.000000 0x30"}; | |
550 | file_path = output_path + "/test-single_delete-0-accessed_key_prefix_cut.txt"; | |
551 | CheckFileContent(k_prefix, file_path, true); | |
552 | ||
553 | // Check the time series | |
554 | std::vector<std::string> k_series = {"3 1533000630 0"}; | |
555 | file_path = output_path + "/test-single_delete-0-time_series.txt"; | |
556 | CheckFileContent(k_series, file_path, false); | |
557 | ||
558 | // Check the accessed key in whole key space | |
559 | std::vector<std::string> k_whole_access = {"3 1"}; | |
560 | file_path = output_path + "/test-single_delete-0-whole_key_stats.txt"; | |
561 | CheckFileContent(k_whole_access, file_path, true); | |
562 | ||
563 | // Check the whole key prefix cut | |
564 | std::vector<std::string> k_whole_prefix = {"0 0x61", "1 0x62", "2 0x63", | |
565 | "3 0x64", "4 0x65", "5 0x66"}; | |
566 | file_path = output_path + "/test-single_delete-0-whole_key_prefix_cut.txt"; | |
567 | CheckFileContent(k_whole_prefix, file_path, true); | |
568 | ||
1e59de90 | 569 | /* |
11fdf7f2 | 570 | // Check the overall qps |
1e59de90 | 571 | std::vector<std::string> all_qps = {"0 0 0 1 0 0 0 0 0 1"}; |
11fdf7f2 TL |
572 | file_path = output_path + "/test-qps_stats.txt"; |
573 | CheckFileContent(all_qps, file_path, true); | |
574 | ||
575 | // Check the qps of SingleDelete | |
576 | std::vector<std::string> get_qps = {"1"}; | |
577 | file_path = output_path + "/test-single_delete-0-qps_stats.txt"; | |
578 | CheckFileContent(get_qps, file_path, true); | |
579 | ||
580 | // Check the top k qps prefix cut | |
581 | std::vector<std::string> top_qps = {"At time: 0 with QPS: 1", | |
582 | "The prefix: 0x64 Access count: 1"}; | |
583 | file_path = | |
584 | output_path + "/test-single_delete-0-accessed_top_k_qps_prefix_cut.txt"; | |
585 | CheckFileContent(top_qps, file_path, true); | |
1e59de90 | 586 | */ |
11fdf7f2 TL |
587 | } |
588 | ||
589 | // Test analyzing of delete | |
590 | TEST_F(TraceAnalyzerTest, DeleteRange) { | |
591 | std::string trace_path = test_path_ + "/trace"; | |
592 | std::string output_path = test_path_ + "/range_delete"; | |
593 | std::string file_path; | |
20effc67 TL |
594 | std::vector<std::string> paras = { |
595 | "-analyze_get=false", "-analyze_put=false", | |
596 | "-analyze_delete=false", "-analyze_merge=false", | |
597 | "-analyze_single_delete=false", "-analyze_range_delete=true", | |
1e59de90 | 598 | "-analyze_iterator=false", "-analyze_multiget=false"}; |
11fdf7f2 TL |
599 | paras.push_back("-output_dir=" + output_path); |
600 | paras.push_back("-trace_path=" + trace_path); | |
601 | paras.push_back("-key_space_dir=" + test_path_); | |
602 | AnalyzeTrace(paras, output_path, trace_path); | |
603 | ||
604 | // check the key_stats file | |
1e59de90 | 605 | std::vector<std::string> k_stats = {"0 10 0 1 1.000000", "0 10 1 1 1.000000"}; |
11fdf7f2 TL |
606 | file_path = output_path + "/test-range_delete-0-accessed_key_stats.txt"; |
607 | CheckFileContent(k_stats, file_path, true); | |
608 | ||
609 | // Check the access count distribution | |
610 | std::vector<std::string> k_dist = {"access_count: 1 num: 2"}; | |
611 | file_path = | |
612 | output_path + "/test-range_delete-0-accessed_key_count_distribution.txt"; | |
613 | CheckFileContent(k_dist, file_path, true); | |
614 | ||
615 | // Check the trace sequence | |
1e59de90 TL |
616 | std::vector<std::string> k_sequence = {"1", "5", "2", "3", "4", "8", |
617 | "8", "8", "8", "8", "8", "8", | |
618 | "8", "8", "0", "6", "7", "0"}; | |
11fdf7f2 TL |
619 | file_path = output_path + "/test-human_readable_trace.txt"; |
620 | CheckFileContent(k_sequence, file_path, false); | |
621 | ||
622 | // Check the prefix | |
623 | std::vector<std::string> k_prefix = {"0 0 0 0.000000 0.000000 0x30", | |
624 | "1 1 1 1.000000 1.000000 0x65"}; | |
625 | file_path = output_path + "/test-range_delete-0-accessed_key_prefix_cut.txt"; | |
626 | CheckFileContent(k_prefix, file_path, true); | |
627 | ||
628 | // Check the time series | |
629 | std::vector<std::string> k_series = {"4 1533000630 0", "4 1533060100 1"}; | |
630 | file_path = output_path + "/test-range_delete-0-time_series.txt"; | |
631 | CheckFileContent(k_series, file_path, false); | |
632 | ||
633 | // Check the accessed key in whole key space | |
634 | std::vector<std::string> k_whole_access = {"4 1", "5 1"}; | |
635 | file_path = output_path + "/test-range_delete-0-whole_key_stats.txt"; | |
636 | CheckFileContent(k_whole_access, file_path, true); | |
637 | ||
638 | // Check the whole key prefix cut | |
639 | std::vector<std::string> k_whole_prefix = {"0 0x61", "1 0x62", "2 0x63", | |
640 | "3 0x64", "4 0x65", "5 0x66"}; | |
641 | file_path = output_path + "/test-range_delete-0-whole_key_prefix_cut.txt"; | |
642 | CheckFileContent(k_whole_prefix, file_path, true); | |
643 | ||
1e59de90 | 644 | /* |
11fdf7f2 | 645 | // Check the overall qps |
1e59de90 | 646 | std::vector<std::string> all_qps = {"0 0 0 0 2 0 0 0 0 2"}; |
11fdf7f2 TL |
647 | file_path = output_path + "/test-qps_stats.txt"; |
648 | CheckFileContent(all_qps, file_path, true); | |
649 | ||
650 | // Check the qps of DeleteRange | |
651 | std::vector<std::string> get_qps = {"2"}; | |
652 | file_path = output_path + "/test-range_delete-0-qps_stats.txt"; | |
653 | CheckFileContent(get_qps, file_path, true); | |
654 | ||
655 | // Check the top k qps prefix cut | |
656 | std::vector<std::string> top_qps = {"At time: 0 with QPS: 2", | |
657 | "The prefix: 0x65 Access count: 1", | |
658 | "The prefix: 0x66 Access count: 1"}; | |
659 | file_path = | |
660 | output_path + "/test-range_delete-0-accessed_top_k_qps_prefix_cut.txt"; | |
661 | CheckFileContent(top_qps, file_path, true); | |
1e59de90 | 662 | */ |
11fdf7f2 TL |
663 | } |
664 | ||
665 | // Test analyzing of Iterator | |
666 | TEST_F(TraceAnalyzerTest, Iterator) { | |
667 | std::string trace_path = test_path_ + "/trace"; | |
668 | std::string output_path = test_path_ + "/iterator"; | |
669 | std::string file_path; | |
20effc67 TL |
670 | std::vector<std::string> paras = { |
671 | "-analyze_get=false", "-analyze_put=false", | |
672 | "-analyze_delete=false", "-analyze_merge=false", | |
673 | "-analyze_single_delete=false", "-analyze_range_delete=false", | |
1e59de90 | 674 | "-analyze_iterator=true", "-analyze_multiget=false"}; |
11fdf7f2 TL |
675 | paras.push_back("-output_dir=" + output_path); |
676 | paras.push_back("-trace_path=" + trace_path); | |
677 | paras.push_back("-key_space_dir=" + test_path_); | |
678 | AnalyzeTrace(paras, output_path, trace_path); | |
679 | ||
680 | // Check the output of Seek | |
681 | // check the key_stats file | |
1e59de90 | 682 | std::vector<std::string> k_stats = {"0 10 0 1 1.000000"}; |
11fdf7f2 TL |
683 | file_path = output_path + "/test-iterator_Seek-0-accessed_key_stats.txt"; |
684 | CheckFileContent(k_stats, file_path, true); | |
685 | ||
686 | // Check the access count distribution | |
687 | std::vector<std::string> k_dist = {"access_count: 1 num: 1"}; | |
688 | file_path = | |
689 | output_path + "/test-iterator_Seek-0-accessed_key_count_distribution.txt"; | |
690 | CheckFileContent(k_dist, file_path, true); | |
691 | ||
692 | // Check the trace sequence | |
1e59de90 TL |
693 | std::vector<std::string> k_sequence = {"1", "5", "2", "3", "4", "8", |
694 | "8", "8", "8", "8", "8", "8", | |
695 | "8", "8", "0", "6", "7", "0"}; | |
11fdf7f2 TL |
696 | file_path = output_path + "/test-human_readable_trace.txt"; |
697 | CheckFileContent(k_sequence, file_path, false); | |
698 | ||
699 | // Check the prefix | |
700 | std::vector<std::string> k_prefix = {"0 0 0 0.000000 0.000000 0x30"}; | |
701 | file_path = output_path + "/test-iterator_Seek-0-accessed_key_prefix_cut.txt"; | |
702 | CheckFileContent(k_prefix, file_path, true); | |
703 | ||
704 | // Check the time series | |
705 | std::vector<std::string> k_series = {"6 1 0"}; | |
706 | file_path = output_path + "/test-iterator_Seek-0-time_series.txt"; | |
707 | CheckFileContent(k_series, file_path, false); | |
708 | ||
709 | // Check the accessed key in whole key space | |
710 | std::vector<std::string> k_whole_access = {"0 1"}; | |
711 | file_path = output_path + "/test-iterator_Seek-0-whole_key_stats.txt"; | |
712 | CheckFileContent(k_whole_access, file_path, true); | |
713 | ||
714 | // Check the whole key prefix cut | |
715 | std::vector<std::string> k_whole_prefix = {"0 0x61", "1 0x62", "2 0x63", | |
716 | "3 0x64", "4 0x65", "5 0x66"}; | |
717 | file_path = output_path + "/test-iterator_Seek-0-whole_key_prefix_cut.txt"; | |
718 | CheckFileContent(k_whole_prefix, file_path, true); | |
719 | ||
1e59de90 | 720 | /* |
11fdf7f2 | 721 | // Check the overall qps |
1e59de90 | 722 | std::vector<std::string> all_qps = {"0 0 0 0 0 0 1 1 0 2"}; |
11fdf7f2 TL |
723 | file_path = output_path + "/test-qps_stats.txt"; |
724 | CheckFileContent(all_qps, file_path, true); | |
725 | ||
726 | // Check the qps of Iterator_Seek | |
727 | std::vector<std::string> get_qps = {"1"}; | |
728 | file_path = output_path + "/test-iterator_Seek-0-qps_stats.txt"; | |
729 | CheckFileContent(get_qps, file_path, true); | |
730 | ||
731 | // Check the top k qps prefix cut | |
732 | std::vector<std::string> top_qps = {"At time: 0 with QPS: 1", | |
733 | "The prefix: 0x61 Access count: 1"}; | |
734 | file_path = | |
735 | output_path + "/test-iterator_Seek-0-accessed_top_k_qps_prefix_cut.txt"; | |
736 | CheckFileContent(top_qps, file_path, true); | |
1e59de90 | 737 | */ |
11fdf7f2 TL |
738 | |
739 | // Check the output of SeekForPrev | |
740 | // check the key_stats file | |
1e59de90 | 741 | k_stats = {"0 10 0 1 1.000000"}; |
11fdf7f2 TL |
742 | file_path = |
743 | output_path + "/test-iterator_SeekForPrev-0-accessed_key_stats.txt"; | |
744 | CheckFileContent(k_stats, file_path, true); | |
745 | ||
746 | // Check the access count distribution | |
747 | k_dist = {"access_count: 1 num: 1"}; | |
748 | file_path = | |
749 | output_path + | |
750 | "/test-iterator_SeekForPrev-0-accessed_key_count_distribution.txt"; | |
751 | CheckFileContent(k_dist, file_path, true); | |
752 | ||
753 | // Check the prefix | |
754 | k_prefix = {"0 0 0 0.000000 0.000000 0x30"}; | |
755 | file_path = | |
756 | output_path + "/test-iterator_SeekForPrev-0-accessed_key_prefix_cut.txt"; | |
757 | CheckFileContent(k_prefix, file_path, true); | |
758 | ||
759 | // Check the time series | |
760 | k_series = {"7 0 0"}; | |
761 | file_path = output_path + "/test-iterator_SeekForPrev-0-time_series.txt"; | |
762 | CheckFileContent(k_series, file_path, false); | |
763 | ||
764 | // Check the accessed key in whole key space | |
765 | k_whole_access = {"1 1"}; | |
766 | file_path = output_path + "/test-iterator_SeekForPrev-0-whole_key_stats.txt"; | |
767 | CheckFileContent(k_whole_access, file_path, true); | |
768 | ||
769 | // Check the whole key prefix cut | |
770 | k_whole_prefix = {"0 0x61", "1 0x62", "2 0x63", "3 0x64", "4 0x65", "5 0x66"}; | |
771 | file_path = | |
772 | output_path + "/test-iterator_SeekForPrev-0-whole_key_prefix_cut.txt"; | |
773 | CheckFileContent(k_whole_prefix, file_path, true); | |
774 | ||
1e59de90 | 775 | /* |
11fdf7f2 TL |
776 | // Check the qps of Iterator_SeekForPrev |
777 | get_qps = {"1"}; | |
778 | file_path = output_path + "/test-iterator_SeekForPrev-0-qps_stats.txt"; | |
779 | CheckFileContent(get_qps, file_path, true); | |
780 | ||
781 | // Check the top k qps prefix cut | |
782 | top_qps = {"At time: 0 with QPS: 1", "The prefix: 0x62 Access count: 1"}; | |
783 | file_path = output_path + | |
784 | "/test-iterator_SeekForPrev-0-accessed_top_k_qps_prefix_cut.txt"; | |
785 | CheckFileContent(top_qps, file_path, true); | |
1e59de90 TL |
786 | */ |
787 | } | |
788 | ||
789 | // Test analyzing of multiget | |
790 | TEST_F(TraceAnalyzerTest, MultiGet) { | |
791 | std::string trace_path = test_path_ + "/trace"; | |
792 | std::string output_path = test_path_ + "/multiget"; | |
793 | std::string file_path; | |
794 | std::vector<std::string> paras = { | |
795 | "-analyze_get=false", "-analyze_put=false", | |
796 | "-analyze_delete=false", "-analyze_merge=false", | |
797 | "-analyze_single_delete=false", "-analyze_range_delete=true", | |
798 | "-analyze_iterator=false", "-analyze_multiget=true"}; | |
799 | paras.push_back("-output_dir=" + output_path); | |
800 | paras.push_back("-trace_path=" + trace_path); | |
801 | paras.push_back("-key_space_dir=" + test_path_); | |
802 | AnalyzeTrace(paras, output_path, trace_path); | |
803 | ||
804 | // check the key_stats file | |
805 | std::vector<std::string> k_stats = {"0 10 0 2 1.000000", "0 10 1 2 1.000000", | |
806 | "0 10 2 1 1.000000", "0 10 3 2 1.000000", | |
807 | "0 10 4 2 1.000000"}; | |
808 | file_path = output_path + "/test-multiget-0-accessed_key_stats.txt"; | |
809 | CheckFileContent(k_stats, file_path, true); | |
810 | ||
811 | // Check the access count distribution | |
812 | std::vector<std::string> k_dist = {"access_count: 1 num: 1", | |
813 | "access_count: 2 num: 4"}; | |
814 | file_path = | |
815 | output_path + "/test-multiget-0-accessed_key_count_distribution.txt"; | |
816 | CheckFileContent(k_dist, file_path, true); | |
817 | ||
818 | // Check the trace sequence | |
819 | std::vector<std::string> k_sequence = {"1", "5", "2", "3", "4", "8", | |
820 | "8", "8", "8", "8", "8", "8", | |
821 | "8", "8", "0", "6", "7", "0"}; | |
822 | file_path = output_path + "/test-human_readable_trace.txt"; | |
823 | CheckFileContent(k_sequence, file_path, false); | |
824 | ||
825 | // Check the prefix | |
826 | std::vector<std::string> k_prefix = { | |
827 | "0 0 0 0.000000 0.000000 0x30", "1 2 1 2.000000 1.000000 0x61", | |
828 | "2 2 1 2.000000 1.000000 0x62", "3 1 1 1.000000 1.000000 0x64", | |
829 | "4 2 1 2.000000 1.000000 0x67"}; | |
830 | file_path = output_path + "/test-multiget-0-accessed_key_prefix_cut.txt"; | |
831 | CheckFileContent(k_prefix, file_path, true); | |
832 | ||
833 | // Check the time series | |
834 | std::vector<std::string> k_series = {"8 0 0", "8 0 1", "8 0 2", | |
835 | "8 0 3", "8 0 4", "8 0 0", | |
836 | "8 0 1", "8 0 3", "8 0 4"}; | |
837 | file_path = output_path + "/test-multiget-0-time_series.txt"; | |
838 | CheckFileContent(k_series, file_path, false); | |
839 | ||
840 | // Check the accessed key in whole key space | |
841 | std::vector<std::string> k_whole_access = {"0 2", "1 2"}; | |
842 | file_path = output_path + "/test-multiget-0-whole_key_stats.txt"; | |
843 | CheckFileContent(k_whole_access, file_path, true); | |
844 | ||
845 | // Check the whole key prefix cut | |
846 | std::vector<std::string> k_whole_prefix = {"0 0x61", "1 0x62", "2 0x63", | |
847 | "3 0x64", "4 0x65", "5 0x66"}; | |
848 | file_path = output_path + "/test-multiget-0-whole_key_prefix_cut.txt"; | |
849 | CheckFileContent(k_whole_prefix, file_path, true); | |
850 | ||
851 | /* | |
852 | // Check the overall qps. We have 3 MultiGet queries and it requested 9 keys | |
853 | // in total | |
854 | std::vector<std::string> all_qps = {"0 0 0 0 2 0 0 0 9 11"}; | |
855 | file_path = output_path + "/test-qps_stats.txt"; | |
856 | CheckFileContent(all_qps, file_path, true); | |
857 | ||
858 | // Check the qps of DeleteRange | |
859 | std::vector<std::string> get_qps = {"9"}; | |
860 | file_path = output_path + "/test-multiget-0-qps_stats.txt"; | |
861 | CheckFileContent(get_qps, file_path, true); | |
862 | ||
863 | // Check the top k qps prefix cut | |
864 | std::vector<std::string> top_qps = { | |
865 | "At time: 0 with QPS: 9", "The prefix: 0x61 Access count: 2", | |
866 | "The prefix: 0x62 Access count: 2", "The prefix: 0x64 Access count: 1", | |
867 | "The prefix: 0x67 Access count: 2", "The prefix: 0x68 Access count: 2"}; | |
868 | file_path = | |
869 | output_path + "/test-multiget-0-accessed_top_k_qps_prefix_cut.txt"; | |
870 | CheckFileContent(top_qps, file_path, true); | |
871 | */ | |
11fdf7f2 TL |
872 | } |
873 | ||
f67539c2 | 874 | } // namespace ROCKSDB_NAMESPACE |
11fdf7f2 TL |
875 | |
876 | int main(int argc, char** argv) { | |
1e59de90 | 877 | ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); |
11fdf7f2 TL |
878 | ::testing::InitGoogleTest(&argc, argv); |
879 | return RUN_ALL_TESTS(); | |
880 | } | |
881 | #endif // GFLAG | |
882 | #else | |
883 | #include <stdio.h> | |
884 | ||
885 | int main(int /*argc*/, char** /*argv*/) { | |
886 | fprintf(stderr, "Trace_analyzer test is not supported in ROCKSDB_LITE\n"); | |
887 | return 0; | |
888 | } | |
889 | ||
890 | #endif // !ROCKSDB_LITE return RUN_ALL_TESTS(); |