Huamonarch
fa7e2b3308
docs: 添加 eqpalg 重构功能等价性分析文档
...
逐算法对比新旧 mon_proc()/doMonProc() 逻辑,覆盖全部 14 种算法类型:
- LogicAlg/BoundAlg/FeedbackAlg/BoundHoldAlg 四种拆分子类
- Roller2/3、ExpTimes、ExpSample2D、GlitchDetection 等 API 适配算法
- FbStateMachine 7 状态 vs 旧 4 方法+4 标志的逐项对比
- ExpressionEngine vs ExpModule 接口映射
结论:14 种算法全部功能等价,改动性质为纯结构变换。
2026-05-18 13:10:20 +08:00
Huamonarch
5f5e64a57f
fix: 测试中 vars 赋值移到 ExpressionEngine 构造之后(避免被构造函数覆盖为 0.0)
2026-05-18 09:53:24 +08:00
Huamonarch
8d17e6258e
fix: 心跳日志从 Debug 改为 Info 级别,避免被 log4cplus 配置过滤
2026-05-18 09:43:17 +08:00
Huamonarch
4970481d70
docs: 添加重构过程状态文件,记录进度和下一步
2026-05-15 17:11:40 +08:00
Huamonarch
fe98fedc75
fix: ensureVarCache 改用 tag_keys.size() 判断,避免 VarsCache::tag_num 未初始化垃圾值
2026-05-15 17:08:24 +08:00
Huamonarch
f3b1543b73
fix: ensureVarCache 移到 expression_engine.h 内联,解决构造函数中未声明错误
2026-05-15 16:59:00 +08:00
Huamonarch
b53c061f95
fix: ExpressionEngine 构造函数预初始化 mm_vars(恢复原 ExpModule::init() 行为)
2026-05-15 16:48:59 +08:00
Huamonarch
975845963a
fix: 修正 bound_checker_setDetectMode_override 测试预期(哨兵值变真实下界后 -999 不超限)
2026-05-15 16:36:13 +08:00
Huamonarch
d79d17af20
docs: 更新 eqpalg 重构变更文档(34 commits + 编译修复记录)
2026-05-15 16:34:50 +08:00
Huamonarch
06ebc21dd6
fix: roller2/roller3 中 init_hold_exp_str/exp_messy_code_check 改用 ExpressionEngine
2026-05-15 16:23:44 +08:00
Huamonarch
367802fc71
fix: roller3.cpp 中 DetectMode enum class 的 LOG 输出和 stoi 赋值 cast 修复
2026-05-15 16:13:32 +08:00
Huamonarch
ba0bf8ce21
fix: 清理 ExpBase 子类中残留的旧方法调用(first_fill_mm_vars/print_exp_vars/refresh_exp_vars_ihd/act_triggered_)
2026-05-15 16:07:13 +08:00
Huamonarch
43c545eea3
fix: 添加 hasExpression(),修复 bound_alg/exp_bound 编译错误
2026-05-15 16:01:14 +08:00
Huamonarch
18a5675109
fix: 子类实现 doMonProc() + 测试 CMake 添加缺失链接文件
2026-05-15 15:51:55 +08:00
Huamonarch
62a2e5568b
fix: expression_engine.h 添加 <mix_cc/ihyper_db.h> 以解析 time_range_t
2026-05-15 15:46:37 +08:00
Huamonarch
dc26b6a7dd
fix: 将 enum class 类型的 CHECK_EQ 改为 CHECK(==),避免 ostream<< 模板错误
2026-05-15 15:40:24 +08:00
Huamonarch
5a026accaf
build: 添加 -Wno-unused-parameter/variable/sign-compare/reorder 减少警告噪音
2026-05-15 15:32:24 +08:00
Huamonarch
2754b7a267
docs: 添加 eqpalg 测试说明文档(77 用例,3 文件,框架使用说明)
2026-05-15 15:25:06 +08:00
Huamonarch
4032ff92ef
fix: 将测试文件中 "" include 改为 <> 风格,统一项目规范
2026-05-15 15:22:04 +08:00
Huamonarch
3f10d4dd9f
fix: 为 eqpalg_test 添加缺失的 include 路径(legacy/include/ihdb/memcache/iXcom)
2026-05-15 15:19:24 +08:00
Huamonarch
153ce64ae3
docs: 添加 2026-05-15 eqpalg 重构变更文档
2026-05-15 15:04:23 +08:00
Huamonarch
ca2147e499
test: 核心算法单元测试 — LogicAlg/BoundAlg/FeedbackAlg/ExpTimes/FaultCode/Roller3
2026-05-15 14:55:30 +08:00
Huamonarch
032f0d0978
refactor: 切换 build_algorithm 工厂到算法子类 + CMake 更新
2026-05-15 14:42:08 +08:00
Huamonarch
ae7834adaa
refactor: 算法子类化 — LogicAlg/BoundAlg/BoundHoldAlg/FeedbackAlg 消除 exp_type_ 分支
...
将 ExpBase::mon_proc() 中的 exp_type_ 分支逻辑提取为 4 个子类,通过 doMonProc() 虚函数实现多态分发:
- LogicAlg (exp_type 1):实时逻辑判断
- BoundAlg (exp_type 2):监控变量上下限检测
- BoundHoldAlg (exp_type 5):持续超限检测(继承 BoundAlg)
- FeedbackAlg (exp_type 3/4):动作反馈处理
ExpBase 新增纯虚函数 doMonProc() 和钩子函数 doInitExtend(),
init() 和 mon_proc() 中所有类型分支替换为虚函数委托调用。
2026-05-15 14:37:15 +08:00
Huamonarch
4f8eecd828
refactor: 提取 StatCollector 统计学习组件
...
将 ExpBase::cron_proc() 中的 DAA::STA 统计学习逻辑提取到独立的
StatCollector 工具类,统一管理分布统计的生命周期(样本累积、分布
初始化、DB2 持久化、置信区间更新)。同时将 exec_task() 与
task_mon_pro() 中的任务相关 STA 操作也委托给 StatCollector。
新增:
- eqpalg/utility/stat_collector.h -- StatCollector 接口
- eqpalg/utility/stat_collector.cpp -- StatCollector 实现
修改:
- eqpalg/algs/exp_base.h -- 替换 sta_ptr_ 为 stat_collector_
- eqpalg/algs/exp_base.cpp -- cron_proc/reload_ci_dist/reset_dev_data/
exec_task/task_mon_pro 委托给 StatCollector
2026-05-15 14:21:36 +08:00
Huamonarch
b9cf5f4e9e
refactor: 提取 BoundChecker 上下限检测组件
...
从 ExpBase 提取 detect_up_down() 逻辑和哨兵值处理至独立的 BoundChecker 类。
将 DetectMode 从 struct 升级为 enum class。
2026-05-15 14:09:56 +08:00
Huamonarch
c4bcb6610b
refactor: 删除旧反馈状态方法和标志(已由 FbStateMachine 替代)
2026-05-15 13:57:20 +08:00
Huamonarch
0106e553a0
refactor: 集成 FbStateMachine 到 ExpBase::mon_proc()
2026-05-15 13:36:30 +08:00
Huamonarch
fad4ee8e38
test: FbStateMachine 状态转换单元测试
2026-05-15 13:27:27 +08:00
Huamonarch
9f66fc10b3
feat: FbStateMachine 状态转换 + 变量操作实现
2026-05-15 13:22:16 +08:00
Huamonarch
f2f6d6ffb1
feat: 添加 FbStateMachine 头文件
2026-05-15 13:19:19 +08:00
Huamonarch
e9b2c178ba
refactor: 删除 ExpModule 类(已被 ExpressionEngine 替代)
2026-05-15 13:15:05 +08:00
Huamonarch
3f8d281596
fix: 清理 ExpBase 子类中的 exp_act_/exp_feedback_/exp_result_ 残留引用
...
将 exp_bound、exp_times、exp_sample2D 中对已删除成员的引用替换为
expr_engine_->evaluate()/evaluateBool() 调用。
exp_sample2D 中原来绑定 exp_feedback_ 和 exp_result_ 的 sample_X/sample_Y
表达式现在通过 expr_engine_->registerExpression() 注册。
2026-05-15 13:14:17 +08:00
Huamonarch
38d0942a6c
refactor: 非 ExpBase 算法适配 ExpressionEngine API
2026-05-15 13:08:30 +08:00
Huamonarch
7c2fe7f7bb
refactor: ExpBase 表达式管理迁移到 ExpressionEngine
2026-05-15 12:59:11 +08:00
Huamonarch
96ca4d02bb
refactor: AlgBase 从 ExpModule 迁移到 ExpressionEngine
2026-05-15 12:38:49 +08:00
Huamonarch
f10da49f65
test: ExpressionEngine 单元测试用例
2026-05-15 12:35:31 +08:00
Huamonarch
693d3b5197
feat: ExpressionEngine firstFill + printVars 实现
2026-05-15 12:32:20 +08:00
Huamonarch
e575efdc8a
feat: ExpressionEngine FunVars 控制 + hold 变量管理
2026-05-15 12:30:11 +08:00
Huamonarch
50173683db
feat: ExpressionEngine 变量刷新实现(MEMORY + IHDB)
2026-05-15 12:27:58 +08:00
Huamonarch
da9eb2ea2e
feat: ExpressionEngine 核心实现(注册 + 求值)
2026-05-15 12:25:30 +08:00
Huamonarch
2f7ca1e123
feat: 添加 ExpressionEngine 头文件声明
2026-05-15 12:17:27 +08:00
Huamonarch
ec8e44ce5d
test: 为 eqpalg 添加测试基础设施(test_harness + test_main)
2026-05-15 12:15:14 +08:00
Huamonarch
b99cd0a73c
Add change documentation for 2026-05-13 eqpalg fixes and optimizations
...
Covers 9 commits: TaskRecord compile fixes, dual-layer ShmSpinLock,
rm -rf cleanup, update_cold handshake fix, ExpTimes DB robustness
and async persistence with AsyncDbWorker.
2026-05-13 17:10:09 +08:00
Huamonarch
11e5a6aeef
Use angle-bracket include for async_db_worker.h
...
Matches codebase convention: all includes use <> paths, never "".
2026-05-13 13:51:49 +08:00
Huamonarch
f80a917ab7
Async-ify ExpTimes DB persistence with global singleton worker thread
...
Add AsyncDbWorker: a persistent background thread with dedup queue that
executes DB2 writes asynchronously, keeping the mon 20ms cycle free of
blocking I/O.
Changes:
- async_db_worker.h/.cc: singleton worker, submit() with rule_id dedup,
drain_and_stop() for clean shutdown
- eqp_stat.h/.cc: new update_static(ruleid, shear_times, running_time)
overload that skips redundant DB reads for known values (reduces
5 SELECTs to 3 per persist cycle)
- exp_times.cc: extract persist_exp_times() as a standalone function,
update_history_times() snapshots values and submits to worker
(returns immediately), reset_dev_data() uses direct SHM update
- eqpalg_icei.cpp: alg_mgr_.reset() → drain_and_stop() in destructor
ensures all algorithm threads are stopped before draining the worker
Risk: re-run cmake .. to pick up the new async_db_worker.cc file.
2026-05-13 13:32:50 +08:00
Huamonarch
6ed178b367
Fix: protect update_history_times snapshot restore from DB failures
...
Three fixes in update_history_times():
1. Wrap DB operations in try-catch — exception no longer skips the
snapshot restore, preventing permanent loss of accumulated counts
2. Treat get_history_times() -1 return (DB failure) as skip, not as
"record exists" → no more silent UPDATE on non-existent rows
3. Only call update_static and advance last_load_time_ on success,
so a failed persist retries on the next cycle instead of waiting
another rw_time_ minutes
2026-05-13 12:59:16 +08:00
Huamonarch
b3932b0af8
Fix: update_cold must not overwrite SHM stat_values and fetch_mark
...
Mon's update_map_rule() called update_cold() which blindly copied
RuleStatLocal's stat_values (always empty in mon) and fetch_mark
(always false in mon) into SHM, destroying accumulated data and
breaking the mon-cron handshake.
stat_values and fetch_mark are managed exclusively by the
add_stat_value/get_stat_value handshake. The cold sync path only
needs to transport running_time and shear_times.
2026-05-13 11:22:42 +08:00
Huamonarch
b8596d311f
Remove rm -rf of MapRuleStat_boost.mmap on startup
...
Dynamic shared-memory vectors no longer cause segfaults from
unbounded growth, so the brute-force file deletion on every
start is unnecessary. Consistent with e21b2af which removed
the same pattern for TaskData_boost.mmap.
2026-05-13 09:47:52 +08:00
Huamonarch
0a5397345c
Fix: access TaskRecord::data_record vector after TaskData refactor
...
Commit e21b2af changed TaskShm map value from DataRecord (flat array)
to TaskRecord (struct wrapping shm_vector_f), but three call sites in
exp_base.cpp didn't drill into the .data_record member — they called
size()/operator[]/push_back() on TaskRecord itself, which has none.
2026-05-13 09:15:20 +08:00