首页 > 其他分享 >随笔-调试-perf on-cpu off-cpu

随笔-调试-perf on-cpu off-cpu

时间:2024-05-07 22:12:51浏览次数:22  
标签:opt sched perf -- FlameGraph off cpu

perf on-cpu

xpid=$(cat /var/run/xx.pid); perf record -F 99 -p $xpid --call-graph dwarf -- sleep 60

直接在控制台上查看:perf report
或者生成火焰图:
perf script --header > out.stacks
/opt/FlameGraph/stackcollapse-perf.pl < out.stacks | /opt/FlameGraph/flamegraph.pl --hash > out.svg

FlameGraph: git clone https://github.com/brendangregg/FlameGraph

perf off-cpu

# test in centos7

echo 1 | sudo tee /proc/sys/kernel/sched_schedstats
xpid=$(cat /var/run/xx.pid); perf record -e sched:sched_stat_sleep -e sched:sched_switch -e sched:sched_process_exit -p $xpid -g -o perf.data.raw sleep 10
perf inject -v -s -i perf.data.raw -o perf.data # The step is merging sched_start and sched_switch events

perf script -F comm,pid,tid,cpu,time,period,event,ip,sym,dso,trace | awk '
    NF > 4 { exec = $1; period_ms = int($5 / 1000000) }
    NF > 1 && NF <= 4 && period_ms > 0 { print $2 }
    NF < 2 && period_ms > 0 { printf "%s\n%d\n\n", exec, period_ms }' | \
    /opt/FlameGraph/stackcollapse.pl | \
    /opt/FlameGraph/flamegraph.pl --countname=ms --title="Off-CPU Time Flame Graph" --colors=io > offcpu.svg

参考

  1. Linux perf_events Off-CPU Time Flame Graph
  2. https://perf.wiki.kernel.org/index.php/Tutorial
  3. PingCAP 工欲性能调优,必先利其器(2)- 火焰图
  4. 透过Tracepoint理解内核 - 调度器框架和性能 - J.FW的文章 - 知乎

标签:opt,sched,perf,--,FlameGraph,off,cpu
From: https://www.cnblogs.com/stellar-liyanbin/p/18178521

相关文章

  • Linux性能分析工具-perf并生成火焰图
    一、perf安装及简介1.安装perf1.Ubuntu/Debianaptinstalllinux-tools-commonaptinstalllinux-tools-5.15.0-101-generic2.Centos/Redhatyuminstallperf-y2.常用的perf命令及其功能annotate读取perf.data(由perfrecord生成)并结合源代码展示详细的性......
  • A Revisiting Study of Appropriate Offline Evaluation for Top-N Recommendation Al
    目录概实验设置EvaluationMetricsMetric的一致性不同的metrics导致的算法排名差异SampledmetricsSampledmetrics是否会导致和fullranking的metrics不同的评价数据集构建数据集的选择和预处理\(k\)-corefiltering的影响数据集的切分数据集的切分方式对结果的影响数据......
  • 在英特尔至强 CPU 上使用 Optimum Intel 实现超快 SetFit 推理
    在缺少标注数据场景,SetFit是解决的建模问题的一个有前途的解决方案,其由HuggingFace与Intel实验室以及UKPLab合作共同开发。作为一个高效的框架,SetFit可用于对SentenceTransformers模型进行少样本微调。SetFit仅需很少的标注数据就能达到较高的准确率,例如,在使用3-......
  • 「云渲染平台」3D模型渲染是CPU还是GPU?
    在数字艺术创作和工程设计这两个领域中,将三维模型转换成逼真的二维图像的过程被称为模型渲染,这是一种对计算资源要求极高的技术活动。在渲染三维模型时,CPU和GPU各自承担着不同的任务。现在,让我们来了解在模型渲染的过程中,主要是消耗CPU资源还是GPU资源。一、模型渲染对CPU和GPU......
  • Hyperf 的AOP 面向切面编程实战
    概念AOP为 AspectOrientedProgramming 的缩写,意为:面向切面编程,通过动态代理等技术实现程序功能的统一维护的一种技术。AOP是OOP的延续,也是Hyperf中的一个重要内容,是函数式编程的一种衍生范型。利用AOP可以对业务逻辑的各个部分进行隔离,从而使得业务逻辑各部分之间的......
  • iperf测试抓包
    iperf测试抓包【概要】【步骤】1.2.【问题汇总】【问题x】【解决x】【总结】常用命令总结......
  • Oracle 检查当前数据库CPU和PSU补丁信息
     方法一:登录数据库,检查DBA_REGISTRY_HIST视图 select*fromdba_registry_history;ACTION_TIMEACTIONNAMESPACEVERSIONIDBUNDLE_SERIESCOMMENTS-------------------------------------------------------------------......
  • A Critical Study on Data Leakage in Recommender System Offline Evaluation
    目录概主要内容数据集统计信息Top-NRecommendationListRecommendationAccuracy理想的切分方式代码JiY.,SunA.,ZhangJ.andLiC.Acriticalstudyondataleakageinrecommendersystemofflineevaluation.TOIS,2022.概本文讨论了现在的推荐系统评价方式(如L......
  • [转帖]Introducing Exadata X10M: Extreme Scalability and Dramatically Improved Pr
    https://blogs.oracle.com/database/post/exadata-x10m  Oracleisexcitedtoannouncethenextgenerationof ExadataDatabaseMachine platform,the OracleExadataX10M.Builtonmorethanadecadeofhigh-performancedatabasehardwareandsoftware......
  • 操作系统与CPU
    我首先了解了CPU的基本结构和功能。CPU作为计算机的核心,负责执行指令、处理数据和控制计算机的各个部件。我深入研究了CPU的内部结构,包括算术逻辑单元、控制单元和寄存器等关键部件,这些部件共同协作,使CPU能够高速、准确地完成各种计算任务。在了解CPU的基本原理后,我开始探究CPU的......