AMParser icon indicating copy to clipboard operation
AMParser copied to clipboard

what CPU usage means

Open mstr-dfeng opened this issue 10 years ago • 4 comments

为什么我解析出来的CPU usage (刚开始的几个sample)这么大? Sample 0: Process: Usher CPU Usage: 0.00% Res Size: 12464.00 KiB Virt Size: 400908.00 KiB Timestamp: 2014/05/13 22:15:47:667 Sample 1: Process: Usher CPU Usage: 80.94% Res Size: 19276.00 KiB Virt Size: 419512.00 KiB Timestamp: 2014/05/13 22:15:48:714 Sample 2: Process: Usher CPU Usage: 74.09% Res Size: 38132.00 KiB Virt Size: 484316.00 KiB Timestamp: 2014/05/13 22:15:49:758 Sample 3: Process: Usher CPU Usage: 61.27% Res Size: 38756.00 KiB Virt Size: 484352.00 KiB Timestamp: 2014/05/13 22:15:50:798 Sample 4: Process: Usher CPU Usage: 21.99% Res Size: 38796.00 KiB Virt Size: 485308.00 KiB Timestamp: 2014/05/13 22:15:51:836 Sample 5: Process: Usher CPU Usage: 1.18% Res Size: 38796.00 KiB Virt Size: 485308.00 KiB Timestamp: 2014/05/13 22:15:52:875 Sample 6: Process: Usher CPU Usage: 1.19% Res Size: 38796.00 KiB Virt Size: 485308.00 KiB Timestamp: 2014/05/13 22:15:53:913 Sample 7: Process: Usher CPU Usage: 1.18% Res Size: 38800.00 KiB Virt Size: 485308.00 KiB Timestamp: 2014/05/13 22:15:54:950 Sample 8: Process: Usher CPU Usage: 1.21% Res Size: 38800.00 KiB Virt Size: 485308.00 KiB Timestamp: 2014/05/13 22:15:55:989 Sample 9: Process: Usher CPU Usage: 1.29% Res Size: 38804.00 KiB Virt Size: 485312.00 KiB Timestamp: 2014/05/13 22:15:57:027 Sample 10: Process: Usher CPU Usage: 1.18% Res Size: 38804.00 KiB Virt Size: 485312.00 KiB Timestamp: 2014/05/13 22:15:58:064 Sample 11: Process: Usher CPU Usage: 1.18% Res Size: 38780.00 KiB Virt Size: 484272.00 KiB Timestamp: 2014/05/13 22:15:59:102 Sample 12: Process: Usher CPU Usage: 1.32% Res Size: 38764.00 KiB Virt Size: 483752.00 KiB Timestamp: 2014/05/13 22:16:00:140 Sample 13: Process: Usher CPU Usage: 1.27% Res Size: 38032.00 KiB Virt Size: 482532.00 KiB Timestamp: 2014/05/13 22:16:01:177 Sample 14: Process: Usher CPU Usage: 1.21% Res Size: 38020.00 KiB Virt Size: 482520.00 KiB Timestamp: 2014/05/13 22:16:02:214 Sample 15: Process: Usher CPU Usage: 1.18% Res Size: 38024.00 KiB Virt Size: 482524.00 KiB Timestamp: 2014/05/13 22:16:03:250 Sample 16: Process: Usher CPU Usage: 1.40% Res Size: 38024.00 KiB Virt Size: 482524.00 KiB Timestamp: 2014/05/13 22:16:04:288 Sample 17: Process: Usher CPU Usage: 1.38% Res Size: 38024.00 KiB Virt Size: 482524.00 KiB Timestamp: 2014/05/13 22:16:05:330 Sample 18: Process: Usher CPU Usage: 1.15% Res Size: 38024.00 KiB Virt Size: 482524.00 KiB Timestamp: 2014/05/13 22:16:06:367 Sample 19: Process: Usher CPU Usage: 1.28% Res Size: 38024.00 KiB Virt Size: 482524.00 KiB Timestamp: 2014/05/13 22:16:07:404 Sample 20: Process: Usher CPU Usage: 1.16% Res Size: 38024.00 KiB Virt Size: 482524.00 KiB Timestamp: 2014/05/13 22:16:08:442 。。。。。。 这里的CPU Usage,Res Size, Virt Size指的是 一个进程的?还是所有进程的?如果是一个进程的,CPU怎么会到80%啊?是不是因为Appium server的影响,导致刚开始的CPU usage比较大?但是我用Instruments 打开这个trace 文件,Usher 的CPU usage 显示的是2%,这个是平均值?我只有34个sample,按这个log上的CPU usage,平均值也不止6%的。

mstr-dfeng avatar May 14 '14 07:05 mstr-dfeng

在代码里应该是指定了一个process的,在Instruments里默认看到的是结束时候CPU的一个瞬时值,要看每个时间点的CPU usage要在Instruments左边栏里找到Process Detail Tracking,然后勾选Track inspection head那项,这里有截图:https://developer.apple.com/library/ios/documentation/AnalysisTools/Reference/Instruments_User_Reference/ActivityMonitorInstrument/ActivityMonitorInstrument.html#//apple_ref/doc/uid/TP40011355-CH43

zijie0 avatar May 14 '14 08:05 zijie0

哦,那这些解析出来的数据都是一个Process 的?我指定的process 的是Usher,那应该就是Usher 的CPU和Memory 数据, 那 CPU Usage,Res Size, Virt Size 分别指的是

  1. % CPU The percentage of the CPU used by the process.
  2. Real Mem
  3. Virtual Mem 吗?

我今天跑了一次脚本,用的Activity 的trace template,用appium 测试Usher,部分结果是这样的: Sample 52: Process: Usher, CPU Usage: 106.16%, Res Size: 51948.00 KiB, Virt Size: 527964.00 KiB, Timestamp: 2014/05/15 14:59:04:995 Sample 53: Process: Usher, CPU Usage: 109.04%, Res Size: 51956.00 KiB, Virt Size: 527964.00 KiB, Timestamp: 2014/05/15 14:59:06:036 Sample 54: Process: Usher, CPU Usage: 69.35%, Res Size: 50872.00 KiB, Virt Size: 526812.00 KiB, Timestamp: 2014/05/15 14:59:07:077 Sample 55: Process: Usher, CPU Usage: 55.63%, Res Size: 50956.00 KiB, Virt Size: 526484.00 KiB, Timestamp: 2014/05/15 14:59:08:115 Sample 56: Process: Usher, CPU Usage: 58.97%, Res Size: 50556.00 KiB, Virt Size: 526068.00 KiB, Timestamp: 2014/05/15 14:59:09:160 Sample 57: Process: Usher, CPU Usage: 50.42%, Res Size: 50364.00 KiB, Virt Size: 525636.00 KiB, Timestamp: 2014/05/15 14:59:10:201 Sample 58: Process: Usher, CPU Usage: 44.40%, Res Size: 55116.00 KiB, Virt Size: 531960.00 KiB, Timestamp: 2014/05/15 14:59:11:274 Sample 59: Process: Usher, CPU Usage: 92.77%, Res Size: 55744.00 KiB, Virt Size: 532808.00 KiB, Timestamp: 2014/05/15 14:59:12:325 Sample 60: Process: Usher, CPU Usage: 98.23%, Res Size: 56432.00 KiB, Virt Size: 534504.00 KiB, Timestamp: 2014/05/15 14:59:13:382 Sample 61: Process: Usher, CPU Usage: 108.99%, Res Size: 57716.00 KiB, Virt Size: 535608.00 KiB, Timestamp: 2014/05/15 14:59:14:429 Sample 62: Process: Usher, CPU Usage: 114.79%, Res Size: 57972.00 KiB, Virt Size: 536448.00 KiB, Timestamp: 2014/05/15 14:59:15:474 Sample 63: Process: Usher, CPU Usage: 122.25%, Res Size: 58572.00 KiB, Virt Size: 537148.00 KiB, Timestamp: 2014/05/15 14:59:16:513 Sample 64: Process: Usher, CPU Usage: 118.14%, Res Size: 58096.00 KiB, Virt Size: 536416.00 KiB, Timestamp: 2014/05/15 14:59:17:555 Sample 65: Process: Usher, CPU Usage: 100.47%, Res Size: 58132.00 KiB, Virt Size: 536432.00 KiB, Timestamp: 2014/05/15 14:59:18:593 Sample 66: Process: Usher, CPU Usage: 90.99%, Res Size: 58148.00 KiB, Virt Size: 536492.00 KiB, Timestamp: 2014/05/15 14:59:19:634 Sample 67: Process: Usher, CPU Usage: 98.81%, Res Size: 59096.00 KiB, Virt Size: 537452.00 KiB, Timestamp: 2014/05/15 14:59:20:678 Sample 68: Process: Usher, CPU Usage: 96.85%, Res Size: 58340.00 KiB, Virt Size: 538220.00 KiB, Timestamp: 2014/05/15 14:59:21:719

有些CPU % 居然超过了 100 ! 这是正常的吗?而且CPU % 一直挺高的,这个CPU % 具体指的是 这个process 或者 app 占device 的CPU 百分比吗,如果是的话,从log来看,所有process 的CPU% 加在一起经常超过100%。

mstr-dfeng avatar May 15 '14 08:05 mstr-dfeng

求教下,为什么的trace文件的解析结果没有CPU Usage等相关的数据?

image

yanjian824 avatar Jun 23 '14 08:06 yanjian824

可能是Process name 指定错了吧,trace 文件里面没有DoorReader 的信息

mstr-dfeng avatar Jun 24 '14 09:06 mstr-dfeng