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 the wrong thread name in the trace profiling function. #385

Merged
merged 4 commits into from
Dec 7, 2022

Conversation

yaofighting
Copy link
Contributor

Signed-off-by: yaofighting siyao@zju.edu.cn

Fix the thread name error in the trace profiling function, and optimize the segment field in the cycle_queue in collector.

Problem1. Thread name error

Analysis-Probe

When the java probe thread itself generates its own java_futex information for the first time, it enters Probe-side parse_ jf() function, at this time parse_ tm() thread has not been processed yet, so the ptid_comm map has no thread name information of this thread. However, in the code logic, it only writes the logic to assign the thread name when the thread exists in the ptid_commmap. When the map does not exist, it does nothing. (Therefore, the comm field in kindling_event is actually the comm of the previous data.) like this:
if (key != ptid_comm.end()) { strcpy(p_kindling_event->context.tinfo.comm, key->second); }

Analysis-Collector

At this time, the incorrect comm data will enter the ConsumeEvent ->ConsumeJavaFutexEvent ->PutEventToSegments logic in the Go side cpuanalyzer to establish the first entry information of the thread. At this time, a ring will be initialized and the thread name information will be initialized. Unless the ring is cleaned up later, the thread name information will not be updated in a timely manner, so it's also a problem in collector.

Solution

For theProbe-side, add the default comm data value, and for the Collector-side, ensure that the thread name information is updated every time the ring is updated.

Problem2. Data redundancy in Collector-Segment

optimize the segment field in the cycle_queue in collector.

Signed-off-by: yaofighting <siyao@zju.edu.cn>
Signed-off-by: yaofighting <siyao@zju.edu.cn>
probe/src/cgo/kindling.cpp Outdated Show resolved Hide resolved
Signed-off-by: yaofighting <siyao@zju.edu.cn>
Signed-off-by: yaofighting <siyao@zju.edu.cn>
@dxsup dxsup merged commit fa9fceb into KindlingProject:main Dec 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants