Skip to content

Commit

Permalink
snapshot multithread test 9
Browse files Browse the repository at this point in the history
  • Loading branch information
pippocao committed Oct 9, 2024
1 parent 78b92d6 commit 4066c9c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/bq_common/bq_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,8 @@ extern bq::platform::atomic<int32_t> cccc3;
extern bq::platform::atomic<int32_t> cccc4;
extern bq::platform::atomic<int32_t> cccc5;
extern bq::platform::atomic<int32_t> cccc6;
extern bq::platform::atomic<int32_t> cccc7;

extern bq::platform::atomic<bool> ccc_continue;
extern bq::platform::atomic<int32_t> cccc7;
extern bq::platform::atomic<int32_t> cccc8;
extern bq::platform::atomic<int32_t> cccc9;
7 changes: 6 additions & 1 deletion src/bq_common/utils/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,4 +341,9 @@ bq::platform::atomic<int32_t> cccc3 = 0;
bq::platform::atomic<int32_t> cccc4 = 0;
bq::platform::atomic<int32_t> cccc5 = 0;
bq::platform::atomic<int32_t> cccc6 = 0;
bq::platform::atomic<int32_t> cccc7 = 0;


bq::platform::atomic<bool> ccc_continue = false;
bq::platform::atomic<int32_t> cccc7 = 0;
bq::platform::atomic<int32_t> cccc8 = 0;
bq::platform::atomic<int32_t> cccc9 = 0;
12 changes: 12 additions & 0 deletions src/bq_log/log/log_snapshot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,18 @@ namespace bq {
new_buffer->set_thread_check_enable(false);
write_success = true;
snapshot_text_continuous_ = false;
if (cccc.load()) {
cccc8.fetch_add(1);
}
} else {
new_buffer->commit_write_chunk(write_handle);
new_buffer->begin_read();
new_buffer->read();
new_buffer->end_read();
snapshot_text_continuous_ = false;
if (cccc.load()) {
cccc9.fetch_add(1);
}
}
}

Expand All @@ -87,6 +93,9 @@ namespace bq {
snapshot_buffer_->set_thread_check_enable(false);
}
} else {
if (cccc.load()) {
cccc7.fetch_add(1);
}
if (snapshot_buffer_) {
delete snapshot_buffer_;
snapshot_buffer_ = nullptr;
Expand Down Expand Up @@ -150,6 +159,9 @@ namespace bq {
snapshot_text_index_ = (snapshot_text_index_ + 1) & 0x01;
bq::string& text = snapshot_text_[snapshot_text_index_];
text.clear();
if (cccc.load()) {
ccc_continue.store(snapshot_text_continuous_);
}
if (!snapshot_buffer_) {
bq::util::log_device_console_plain_text(log_level::warning, "calling take_snapshot without enable snapshot");
if (cccc.load()) {
Expand Down
2 changes: 1 addition & 1 deletion test/test_log_3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,7 @@ namespace bq {
snapshot_idx_mode = (snapshot_idx_mode % 1024) + 1;
}

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());
bq::util::log_device_console(bq::log_level::fatal, "%s, 一:%d, 二:%d, 三:%d, 四:%d, 五:%d, 六:%d, 七:%d, 八:%d, 九:%d", ccc_continue.load() ? "Y" : "X", cccc1.load(), cccc2.load(), cccc3.load(), cccc4.load(), cccc5.load(), cccc6.load(), cccc7.load(), cccc8.load(), cccc9.load());

size_t new_percent = (size_t)(current_tested_num * 100 / total_test_num);
if (new_percent != current_tested_percent) {
Expand Down

0 comments on commit 4066c9c

Please sign in to comment.