diff --git a/src/bq_common/bq_common.h b/src/bq_common/bq_common.h index 8f87bfa..60107fe 100644 --- a/src/bq_common/bq_common.h +++ b/src/bq_common/bq_common.h @@ -37,3 +37,13 @@ #include "bq_common/utils/property.h" #include "bq_common/utils/property_ex.h" #include "bq_common/utils/file_manager.h" + + +extern bq::platform::atomic cccc; +extern bq::platform::atomic cccc1; +extern bq::platform::atomic cccc2; +extern bq::platform::atomic cccc3; +extern bq::platform::atomic cccc4; +extern bq::platform::atomic cccc5; +extern bq::platform::atomic cccc6; +extern bq::platform::atomic cccc7; \ No newline at end of file diff --git a/src/bq_common/utils/util.cpp b/src/bq_common/utils/util.cpp index ac02f15..48b2df6 100644 --- a/src/bq_common/utils/util.cpp +++ b/src/bq_common/utils/util.cpp @@ -333,3 +333,12 @@ namespace bq { return result_len; } } + +bq::platform::atomic cccc = false; +bq::platform::atomic cccc1 = 0; +bq::platform::atomic cccc2 = 0; +bq::platform::atomic cccc3 = 0; +bq::platform::atomic cccc4 = 0; +bq::platform::atomic cccc5 = 0; +bq::platform::atomic cccc6 = 0; +bq::platform::atomic cccc7 = 0; \ No newline at end of file diff --git a/src/bq_log/log/log_snapshot.cpp b/src/bq_log/log/log_snapshot.cpp index a09aa40..5c10288 100644 --- a/src/bq_log/log/log_snapshot.cpp +++ b/src/bq_log/log/log_snapshot.cpp @@ -111,7 +111,13 @@ namespace bq { void log_snapshot::write_data(const bq::log_entry_handle& log_entry) { + if (cccc.load()) { + cccc2.fetch_add(1); + } if (log_level_bitmap_.have_level(log_entry.get_level()) && categories_mask_array_[log_entry.get_category_idx()]) { + if (cccc.load()) { + cccc3.fetch_add(1); + } bq::platform::scoped_spin_lock scoped_lock(lock_); if (snapshot_buffer_) { while (true) { @@ -119,6 +125,9 @@ namespace bq { if (snapshot_write_handle.result == enum_buffer_result_code::success) { memcpy(snapshot_write_handle.data_addr, log_entry.data(), log_entry.data_size()); snapshot_buffer_->commit_write_chunk(snapshot_write_handle); + if (cccc.load()) { + cccc4.fetch_add(1); + } break; } else if (snapshot_write_handle.result == enum_buffer_result_code::err_not_enough_space) { snapshot_buffer_->begin_read(); @@ -151,6 +160,9 @@ namespace bq { if (snapshot_read_handle.result != enum_buffer_result_code::success) { break; } + if (cccc.load()) { + cccc5.fetch_add(1); + } bq::log_entry_handle item(snapshot_read_handle.data_addr, snapshot_read_handle.data_size); snapshot_layout_.do_layout(item, use_gmt_time, &parent_log_->get_categories_name()); text.insert_batch(text.end(), snapshot_layout_.get_formated_str(), snapshot_layout_.get_formated_str_len()); diff --git a/test/test_log_3.cpp b/test/test_log_3.cpp index ca3b25f..5af487d 100644 --- a/test/test_log_3.cpp +++ b/test/test_log_3.cpp @@ -864,6 +864,7 @@ namespace bq { generate_log_str_standard_utf16(std::get(param_tuple)...); log_inst_ptr->error(log_inst_ptr->cat.ModuleA.SystemA.ClassA, log_str_templates_fmt_utf16[fmt_idx], std::get(param_tuple)...); } + ++cccc1; *output_str_ptr = output_str_ptr->substr(log_head.size(), output_str_ptr->size() - log_head.size()); test_log_3_all_console_outputs.push_back(*output_str_ptr); result_ptr->add_result(output_str_ptr->end_with(log_str_standard), "test idx:%zu, %s \n != %s", current_tested_num, output_str_ptr->c_str(), log_str_standard.c_str()); @@ -889,6 +890,13 @@ namespace bq { } snapshot_idx_mode = (snapshot_idx_mode % 1024) + 1; } + if (cccc1.load() != cccc2.load() + || cccc1.load() != cccc3.load() + || cccc1.load() != cccc4.load() + || cccc1.load() != cccc5.load() + ) { + bq::util::log_device_console(bq::log_level::fatal, "%d, %d, %d, %d, %d", cccc1.load(), cccc2.load(), cccc3.load(), cccc4.load(), cccc5.load()); + } size_t new_percent = (size_t)(current_tested_num * 100 / total_test_num); if (new_percent != current_tested_percent) { @@ -914,6 +922,7 @@ namespace bq { void test_log::test_3(test_result& result, const test_category_log& log_inst) { + cccc = true; test_output(bq::log_level::info, "full log test begin, this will take minutes, and need about 50M free disk space.\n"); clear_test_output_folder(); init_fmt_strings(); @@ -927,7 +936,7 @@ namespace bq { log_param_test(); test_3_phase = test_log_3_phase::do_test; log_param_test(); - + cccc = false; //decode test for (size_t i = 0; i < test_log_3_all_console_outputs.size(); ++i) {