修复 性能测试竞态bug
This commit is contained in:
+28
-2
@@ -627,7 +627,9 @@ Plot / RenderScheduler:
|
||||
RenderScheduler::postAndWait 的局部 mutex + condition_variable 只用于跨线程同步 shutdown/removePlot。
|
||||
|
||||
PerformanceShower:
|
||||
mMutex 只保护统计 map 和显示列表。
|
||||
本身是 RenderAble。
|
||||
统计写入走 Input 三缓冲。
|
||||
统计 map 和显示列表是 Render 私有缓存。
|
||||
计数使用 CPP_Core/Core/Statistics::Speed_Statistics。
|
||||
耗时使用 CPP_Core/Core/Statistics::Value_Statistics。
|
||||
Value_Statistics 提供 instant / smooth / variation。
|
||||
@@ -676,13 +678,31 @@ spdlog / asio / googlepinyin:
|
||||
|
||||
## 16. 性能统计
|
||||
|
||||
性能测试框不再维护自己的耗时平滑算法。
|
||||
性能测试框是 RenderAble,不再是 QWidget。
|
||||
|
||||
开启和停止性能测试只修改 PerformanceShower 的 enabled 状态。
|
||||
|
||||
停止性能测试不删除 PerformanceShower 对象。
|
||||
|
||||
原因:
|
||||
|
||||
```text
|
||||
render/scheduler/cpu 线程可能持有 Cacl。
|
||||
Cacl 需要在析构时写统计。
|
||||
如果停止性能测试时删除 QWidget,会形成跨线程悬挂指针。
|
||||
```
|
||||
|
||||
统计写入走 Input 三缓冲:
|
||||
|
||||
计数类数据:
|
||||
|
||||
```text
|
||||
PerformanceShower::counterIncrease()
|
||||
↓
|
||||
PerformanceShowerInputData
|
||||
↓
|
||||
prepareData()
|
||||
↓
|
||||
Psc::Speed_Statistics::update(1)
|
||||
```
|
||||
|
||||
@@ -691,6 +711,12 @@ Psc::Speed_Statistics::update(1)
|
||||
```text
|
||||
Cacl 析构
|
||||
↓
|
||||
PerformanceShower::recordCost()
|
||||
↓
|
||||
PerformanceShowerInputData
|
||||
↓
|
||||
prepareData()
|
||||
↓
|
||||
Psc::Value_Statistics::update(useTime)
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user