Sign in
Sign up
Explore
Enterprise
Education
Search
Help
Terms of use
About Us
Explore
Enterprise
Education
Gitee Premium
Gitee AI
AI teammates
Sign in
Sign up
Gitee 2025 OpenSource,We need your vote!
Fetch the repository succeeded.
Donate
Please sign in before you donate.
Cancel
Sign in
Scan WeChat QR to Pay
Cancel
Complete
Prompt
Switch to Alipay.
OK
Cancel
Watch
Unwatch
Watching
Releases Only
Ignoring
12
Star
16
Fork
38
openEuler
/
libkperf
Code
Issues
1
Pull Requests
2
Wiki
Insights
Pipelines
Service
JavaDoc
PHPDoc
Quality Analysis
Jenkins for Gitee
Tencent CloudBase
Tencent Cloud Serverless
悬镜安全
Aliyun SAE
Codeblitz
SBOM
Don’t show this again
294
修复对多线程应用生成perf.data无法读取的问题;修复go错误码问题
Merged
Galaxy:perf_data
openEuler:master
Galaxy
create on 2025-07-24 16:20
Clone/Download
HTTPS
SSH
Copy
Email Patch
Diff file
修复对多线程应用生成perf.data无法读取的问题。 修复go错误码问题。 --- ##### 问题: pr期望解决的问题 LD_LIBRARY_PATH=./output/lib/ ./pmu_perfdata -e cycles,branch-misses -- /tmp/test 对多线程应用采集多个事件,运行的应用会持续创建线程,在此场景下输出perf.data,用perf script读取会报错bad address。 ##### 原因: 问题产生的原因 原因是perf.data会包含PERF_RECORD_FORK。 由于采集时,attr.sample_id_all=1,对于非PERF_RECORD_SAMPLE,会记录额外id信息: ``` struct sample_id { { u32 pid, tid; } /* if PERF_SAMPLE_TID set */ { u64 time; } /* if PERF_SAMPLE_TIME set */ { u64 id; } /* if PERF_SAMPLE_ID set */ { u64 stream_id;} /* if PERF_SAMPLE_STREAM_ID set */ { u32 cpu, res; } /* if PERF_SAMPLE_CPU set */ { u64 id; } /* if PERF_SAMPLE_IDENTIFIER set */ }; ``` 但是PERF_RECORD_FORK写入perf.data的时候并没有带上这些信息,perf script在读取的时候需要通过id来确认PERF_RECORD_FORK属于哪个event(perf_evlist__event2id), 因此读到了错误的id,无法找到对应的event。 ##### 方法: 问题解决的方法 在生成perf.data的时候去掉sample_id_all,这样,perf script在读取的时候,对非PERF_RECORD_SAMPLE,不会进入perf_evlist__event2id,绕过该逻辑。 造成的影响是,perf.data内的PERF_RECORD_FORK不会包含时间戳和id信息(因为sample_type只有PERF_SAMPLE_TIME和PERF_SAMPLE_ID),对于编译反馈优化来说暂无影响。
This pull request needs to pass some approval items
Type
Assign personnel
Status
Reviewer
yangyongguang
openeuler-ci-bot
陈臻
bingo
PshySimon
chendh6
znzjugod
Completed
(0/0 )
Tester
openeuler-ci-bot
Completed
(0/0 )
How to merge Pull Request
git checkout master
git pull https://gitee.com/GalaxyG/libkperf.git perf_data
git push origin master
Comments
7
Commits
1
Files
3
Checks
Code problems
0
Bulk operation
Expand
Collapse
Reviewer
Code Owner
Reviewer
bingo
hubin95
yangyongguang
yangyongguang
陈臻
Vchanger
Galaxy
GalaxyG
jinyao320
jinyao320
zhangyuhan
eggilu
wangning126
wangning126
znzjugod
znzjugod
chendh6
chendh6
PshySimon
pshysimon
openeuler-ci-bot
openeuler-ci-bot
No Setting
Min number
0
Tester
bingo
hubin95
yangyongguang
yangyongguang
陈臻
Vchanger
Galaxy
GalaxyG
jinyao320
jinyao320
zhangyuhan
eggilu
wangning126
wangning126
znzjugod
znzjugod
chendh6
chendh6
PshySimon
pshysimon
openeuler-ci-bot
openeuler-ci-bot
No Setting
Min number
0
Priority
Not specified
Serious
Main
Secondary
Unimportant
Label
openeuler-cla/yes
lgtm
approved
ci_successful
sig/A-Tune
Link Issue
No link issue
Successfully merged pull requests will close issues
Milestone
No related milestones
Participators
(3)
1
https://gitee.com/openeuler/libkperf.git
git@gitee.com:openeuler/libkperf.git
openeuler
libkperf
libkperf
Going to Help Center
Search
Git 命令在线学习
如何在 Gitee 导入 GitHub 仓库
Git 仓库基础操作
企业版和社区版功能对比
SSH 公钥设置
如何处理代码冲突
仓库体积过大,如何减小?
如何找回被删除的仓库数据
Gitee 产品配额说明
GitHub仓库快速导入Gitee及同步更新
什么是 Release(发行版)
将 PHP 项目自动发布到 packagist.org
Repository Report
Back to the top
Login prompt
This operation requires login to the code cloud account. Please log in before operating.
Go to login
No account. Register