perf

Android P/Q 怎么抓取火焰图

别等时光非礼了梦想. 提交于 2019-11-28 09:40:03
1. 获取simpleperf的可执行文件 android\system\extras\simpleperf\scripts\bin\android 根据你的设备选择对应的32位或者64位的可执行文件 2. 推送可执行文件到目标机中 adb push simpleperf /data/ adb shell chmod 777 /data/simpleperf 3. 利用simpleperf抓取perf.data数据 ./simpleperf record -e cpu-cycles -p 22488 -g --duration 5 > perf.data 注:示例中的 " -p 22488 " 指的是需要分析的进程号, " -g " 意味着抓取的数据含有堆栈信息 4. pull数据到指定的目录 adb pull /data/perf.data android\system\extras\simpleperf\scripts\ 5. 在该目录下执行如下指令 python report_sample.py --symfs android/out/target/product/sdm710/symbols/vendor/lib/hw/ > out.perf 注:示例中的 " --symfs " 指定符号表 6. 从github中获取如下工具 git clone https:/

Measure page faults from a c program

天涯浪子 提交于 2019-11-28 07:03:22
I am comparing a few system calls where I read/write from/to memory. Is there any API defined to measure page faults (pages in/out) in C ? I found this library libperfstat.a but it is for AIX , I couldn't find anything for linux. Edit: I am aware of time & perf-stat commands in linux, just exploring if there is anything available for me to use inside the C program. osgx There is getrusage function (SVr4, 4.3BSD. POSIX.1-2001; but not all fields are defined in standard). In linux there are several broken fields , but man getrusage lists several interesting fields: long ru_minflt; /* page

Linux性能优化从入门到实战:04 CPU篇:CPU使用率

时间秒杀一切 提交于 2019-11-28 01:24:53
   CPU使用率 是单位时间内CPU使用情况的统计,以百分比方式展示。 $ top top - 11:46:45 up 7 days, 11:52, 1 user, load average: 0.00, 0.01, 0.00 Tasks: 198 total, 1 running, 197 sleeping, 0 stopped, 0 zombie %Cpu(s): 0.2 us, 0.2 sy, 0.0 ni, 99.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st KiB Mem : 4044232 total, 420136 free, 1061244 used, 2562852 buff/cache KiB Swap: 1046524 total, 1043128 free, 3396 used. 2619124 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 921 root 20 0 531332 138408 58972 S 0.7 3.4 41:31.24 Xorg    参数解析 如下: %user(us),代表用户态 CPU 时间。不包括下面的 nice 时间,但包括了 guest 时间。 %nice(ni),代表低优先级用户态 CPU 时间,也就是进程的

perf stat for part of program

给你一囗甜甜゛ 提交于 2019-11-27 22:24:21
问题 Is it possible with perf to collect hardware counter statistics for only part of a program's execution? If so, how? likwid offers the feature of being able to define named regions, but it would be great if this was possible on systems with just perf installed. Some previous questions have returned relevant answers, but there are still some shortcomings: Using probe I get the same error and I'm using a slightly newer kernel (3.13). Are these fixes available in a newer version? Using perf_event

从0到1发布一个npm包

强颜欢笑 提交于 2019-11-27 21:12:53
从0到1发布一个npm包 author: @TiffanysBear 最近在项目业务中有遇到一些问题,一些通用的方法或者封装的模块在PC、WAP甚至是APP中都需要使用,但是对于业务的PC、WAP、APP往往是不同的业务、不同的代码库中,尽管已经将公用的组件和方法抽离到各自公共common中,但是各个大业务大方向上的公用封装依然不能满足需求。 比如一个计算文档类型大小的方法,可能都同时存在于各个业务的common中,假设是有3处代码库中均有;如果此时的需求是将文档类型或者大小的方法进行一些修改,增加一种文档类型或者减少一种文档类型,那咱们是否是需要去共同修改上面的3处方法。这样做,很不利于代码的维护,浪费人力,增加了代码工作量。 那么,如何做到管理一些公共依赖的基础模块代码呢?这时候,封装发布一个npm包进行统一管理就是一个很好的办法了。 先po一下我在写这篇文章时,根据以下的步骤发布的一个简单封装的npm包以及github地址,大家可以先看: npm包:page-performance-monitor github地址:page-performance-monitor,欢迎 star、issue 下面,就从0开始讲起,如何从0到1发布一个npm包。先介绍一下什么是npm~ npm npm 是JavaScript 世界的包管理工具,并且是Node.js 平台的默认包管理工具

What are perf cache events meaning?

半腔热情 提交于 2019-11-27 10:32:51
问题 I am trying to figure out why a modified C program is running faster than its non modified counter part (I am adding very few lines of code to perform some additional work). In this context, I suspect " cache effects " to be the main explanation (instruction cache). Thus I reach the perf (https://perf.wiki.kernel.org/index.php/Main_Page) profiling tool but unfortunately I am not able to understand the meaning of its outputs regarding cache misses. Several events about cache are provided:

MySQL 分析利器 strace & Perf

百般思念 提交于 2019-11-27 09:28:41
Perf   安装perf      yum install -y perf   执行:      perf top / grep " " * -r Strace介绍及用途   strace 是一个用于诊断,分析linux用户态进程的工具 (pstrace,losf, gbd, pstrack, pt-pmp) MySQL启动后会启动多少线程   strace /usr/local/mysql/bin/mysqld   # /usr/local/mysql/bin/mysqld --verbose --help | grep my.cnf   /etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf ~/.my.cnf   my.cnf, $MYSQL_TCP_PORT, /etc/services, built-in default   操心系统查看:     ps -T `pidof mysqld`   利用pstack     pstack `pidof mysql`   推荐MySQL5.7以上的版本     select thread_id ,name from performanct_schema.threads 使用strace的正确姿势   最简单使用     strace -T -t -o /tmp

Good resources on how to program PEBS (Precise event based sampling) counters?

爷,独闯天下 提交于 2019-11-27 07:17:16
问题 I have been trying to log all memory accesses of a program, which as I read seems to be impossible. I have been trying to see to what extent can I go to log atleast a major portion of the memory accesses, if not all. So I was looking to program the PEBS counters in such a way that I could see changes in the number of memory access samples collected. I wanted to know if I can do this by modifying the counter-reset value of PEBS counters. (Usually this goes to zero, but I want to set it to a

What will be the exact code to get count of last level cache misses on Intel Kaby Lake architecture

拈花ヽ惹草 提交于 2019-11-27 06:51:06
问题 This question was migrated from Cryptography Stack Exchange because it can be answered on Stack Overflow. Migrated 2 years ago . I read an interesting paper, entitled "A High-Resolution Side-Channel Attack on Last-Level Cache", and wanted to find out the index hash function for my own machine—i.e., Intel Core i7-7500U (Kaby Lake architecture)—following the leads from this work. To reverse-engineer the hash function, the paper mentions the first step as: for (n=16; ; n++) { // ignore any miss