Skip to content

Commit

Permalink
snapshot multithread test 12
Browse files Browse the repository at this point in the history
  • Loading branch information
pippocao committed Oct 10, 2024
1 parent 1a355f3 commit fc7c752
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/bq_common/bq_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,7 @@ extern bq::platform::atomic<int32_t> cccc7;
extern bq::platform::atomic<int32_t> cccc8;
extern bq::platform::atomic<int32_t> cccc9;
extern bq::platform::atomic<int32_t> cccc10;
extern bq::platform::atomic<int32_t> cccc11;
extern bq::platform::atomic<int32_t> cccc12;

extern bq::platform::atomic<void*> ccc_snapshot_obj;
2 changes: 2 additions & 0 deletions src/bq_common/utils/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,8 @@ bq::platform::atomic<int32_t> cccc7 = 0;
bq::platform::atomic<int32_t> cccc8 = 0;
bq::platform::atomic<int32_t> cccc9 = 0;
bq::platform::atomic<int32_t> cccc10 = 0;
bq::platform::atomic<int32_t> cccc11 = 0;
bq::platform::atomic<int32_t> cccc12 = 0;


bq::platform::atomic<void*> ccc_snapshot_obj = nullptr;
8 changes: 7 additions & 1 deletion src/bq_log/log/log_snapshot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,13 @@ namespace bq {
snapshot_buffer_->end_read();
delete snapshot_buffer_;
snapshot_buffer_ = new_buffer;
if (cccc.load()) {
cccc11.fetch_add(1);
}
} else {
if (cccc.load()) {
cccc12.fetch_add(1);
}
snapshot_buffer_ = new ring_buffer(buffer_size_);
snapshot_buffer_->set_thread_check_enable(false);
}
Expand Down Expand Up @@ -170,7 +176,7 @@ namespace bq {
}
return snapshot_text_[snapshot_text_index_];
}
ccc_snapshot_obj = this;
ccc_snapshot_obj = snapshot_buffer_;
snapshot_buffer_->begin_read();
bool read_success = false;
while (true) {
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 @@ -874,7 +874,7 @@ namespace bq {
snapshot_idx_mode = (snapshot_idx_mode % 1024) + 1;
}

bq::util::log_device_console(bq::log_level::fatal, "%s, %p, 一:%d, 二:%d, 三:%d, 四:%d, 五:%d, 六:%d, 七:%d, 八:%d, 九:%d, 十:%d", ccc_continue.load() ? "Y" : "X", ccc_snapshot_obj.load(), cccc1.load(), cccc2.load(), cccc3.load(), cccc4.load(), cccc5.load(), cccc6.load(), cccc7.load(), cccc8.load(), cccc9.load(), cccc10.load());
bq::util::log_device_console(bq::log_level::fatal, "%s\t, %p\t, 一:%d\t, 二:%d\t, 开始w:%d\t, w成功:%d\t, 读没b:%d\t, 读成功:%d\t, 删:%d\t, 换-分配失败:%d\t, 换-读:%d\t, 读失败原因:%d\t 换:%d\t 创:%d", ccc_continue.load() ? "Y" : "X", ccc_snapshot_obj.load(), cccc1.load(), cccc2.load(), cccc3.load(), cccc4.load(), cccc5.load(), cccc6.load(), cccc7.load(), cccc8.load(), cccc9.load(), cccc10.load(), cccc11.load(), cccc12.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 fc7c752

Please sign in to comment.