Skip to content
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

fix cpuAnalyzer's cache will cause oom #362

Merged
merged 4 commits into from
Nov 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
-
- Add a new tool: A debug tool for Trace Profiling is provided for developers to troubleshoot problems.([#363](https://github.com/CloudDectective-Harmonycloud/kindling/pull/363))


### Enhancements
-
-
Expand All @@ -18,7 +19,7 @@
-
-
-
-
- Fix the bug that cpuEvent cache size continuously increases even if trace profiling is not enabled.([#362](https://github.com/CloudDectective-Harmonycloud/kindling/pull/362))
- Fix the bug that duplicate CPU events are indexed into Elasticsearch. ([#359](https://github.com/KindlingProject/kindling/pull/359))
- Fix the bug of incomplete records when threads arrive at the cpu analyzer for the first time. ([#364](https://github.com/CloudDectective-Harmonycloud/kindling/pull/364))

Expand Down
16 changes: 9 additions & 7 deletions probe/src/cgo/kindling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,15 +194,17 @@ int getEvent(void **pp_kindling_event)
p_kindling_event = (kindling_event_t_for_go *) *pp_kindling_event;
uint16_t userAttNumber = 0;
uint16_t source = get_kindling_source(ev->get_type());
for (auto it = qls.begin(); it != qls.end(); it++) {
KindlingInterface *plugin = qobject_cast<KindlingInterface *>(*it);
if (plugin) {
plugin->addCache(ev, inspector);
}
if(is_start_profile){
for (auto it = qls.begin(); it != qls.end(); it++) {
KindlingInterface *plugin = qobject_cast<KindlingInterface *>(*it);
if (plugin) {
plugin->addCache(ev, inspector);
}

}
}

if (ev->get_type() == PPME_SYSCALL_WRITE_X && fdInfo != nullptr && fdInfo->is_file()) {
if (is_start_profile && ev->get_type() == PPME_SYSCALL_WRITE_X && fdInfo != nullptr && fdInfo->is_file()) {
auto data_param = ev->get_param_value_raw("data");
if (data_param != nullptr) {
char *data_val = data_param->m_val;
Expand All @@ -224,7 +226,7 @@ int getEvent(void **pp_kindling_event)

}

if (ev_type == PPME_CPU_ANALYSIS_E) {
if (is_start_profile && ev_type == PPME_CPU_ANALYSIS_E) {
char* tmp_comm;

map<uint64_t, char*>::iterator key = ptid_comm.find(threadInfo->m_pid<<32 | (threadInfo->m_tid & 0xFFFFFFFF));
Expand Down