From 78b92d676e8a571d64cb218cf01721f75a518421 Mon Sep 17 00:00:00 2001 From: pippocao Date: Wed, 9 Oct 2024 22:13:09 +0800 Subject: [PATCH] snapshot multithread test 8 --- src/bq_log/log/log_snapshot.cpp | 5 ++++- test/test_log_3.cpp | 9 ++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/bq_log/log/log_snapshot.cpp b/src/bq_log/log/log_snapshot.cpp index 5c10288..7bc1cae 100644 --- a/src/bq_log/log/log_snapshot.cpp +++ b/src/bq_log/log/log_snapshot.cpp @@ -152,6 +152,9 @@ namespace bq { text.clear(); if (!snapshot_buffer_) { bq::util::log_device_console_plain_text(log_level::warning, "calling take_snapshot without enable snapshot"); + if (cccc.load()) { + cccc5.fetch_add(1); + } return snapshot_text_[snapshot_text_index_]; } snapshot_buffer_->begin_read(); @@ -161,7 +164,7 @@ namespace bq { break; } if (cccc.load()) { - cccc5.fetch_add(1); + cccc6.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()); diff --git a/test/test_log_3.cpp b/test/test_log_3.cpp index 69ba04f..e8ce504 100644 --- a/test/test_log_3.cpp +++ b/test/test_log_3.cpp @@ -890,13 +890,8 @@ namespace bq { } snapshot_idx_mode = (snapshot_idx_mode % 1024) + 1; } - if (cccc1.load() != cccc2.load() - || cccc1.load() != cccc3.load() - || cccc4.load() != cccc5.load() - || cccc3.load() < cccc4.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()); - } + + bq::util::log_device_console(bq::log_level::fatal, "%d, %d, %d, %d, %d, %d", cccc1.load(), cccc2.load(), cccc3.load(), cccc4.load(), cccc5.load(), cccc6.load()); size_t new_percent = (size_t)(current_tested_num * 100 / total_test_num); if (new_percent != current_tested_percent) {