-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
optimize: take action #198
Conversation
Codecov Report
@@ Coverage Diff @@
## master #198 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 9 9
Lines 296 296
=========================================
Hits 296 296 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
#define CLEAR_DATA \ | ||
DebugT(module_type, env_data->thread_id(), "<%s> %s dump_data cleared.", \ | ||
notify_type.c_str(), unique_key.c_str()); \ | ||
delete dump_data; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
得看看怎么把这个变成智能指针 -。-
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我也想过这里用智能指针,不过我不太熟悉怕反而写出来 bug,要不合并后你来看看是否可以重构成智能指针?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个 pr 主要目的还是清理掉已经无用的旧逻辑
Commits: - [2f700fd] docs: update readme (#207) - [f4eb960] feat: support node-v19.x (#206) - [333593e] chore: make test more reliable (#205) - [c574ca2] feat: save Elf BuildId in corefile. (#204) - [b779aa2] feat: support finish profiling before process exit (#203) - [6a1701f] refactor: replace dump actions static storages with EnvironmentData (#202) - [7608a86] fix: ignore clean error (#200) - [2a6eaba] chore: static dispatch on dumpaction (#199) - [7d3fbb2] optimize: take action (#198) PR-URL: #208
背景
早期 1.x 版本在尚未实现
worker_threads
监控时,开发者的采样操作会通过requestInterrupt
&uv_async_send
同时通知js 主线程 —— 这意味着HandleAction
在早期实现中会执行两次。因此旧版实现中在
HandleAction
执行前校验了TransactionDone
这个函数,通过${uuid}::${action}
的唯一 key 设置状态判断当前的 action 是否已经由requestInterrupt
oruv_async_send
执行过了,如果已经执行过,则清理 data 然后返回。而在最新的实现中,将
HandleAction
放置到一个 lambda 回调中:并且这个回调函数会放入每一个 EnvData 对应的
std:list
中,这样requestInterrupt
&uv_async_send
先触发的那一个会通过std::list::swap
执行回调,后触发拿到的std::list
为空不会再触发。这样
HandleAction
只会执行一次,旧版本中设计的TransactionDone
逻辑不再需要。优化
移除当前实现中为
HandleAction
执行两次所做的冗余设计逻辑