YueChen-C / py-ios-device

IOS Professional Performance Testing Tool . You can get CPU, GPU, Memory , Lifecycle and other metrics from real iOS devices . IOS 专业性能测试工具
GNU General Public License v3.0
633 stars 179 forks source link

APP cpuUsage greater than 100% #109

Open VishalKumarX100 opened 1 year ago

VishalKumarX100 commented 1 year ago

Smartphone (please complete the following information):

Device - iphone 12 OS -16 Pyidevice Version 2.2.0

Describe the bug While using this command for getting app CPU usage, sometimes I am getting cpuUsage greater than 100%. what does this field signify in the output pasted below. Is this related to cores. or this is an error

pyidevice instruments sysmontap --bundle_id com.bundle.id --processes -cf tmp.txt --udid 00000108-000ABCD00001E

[('appPackage', {'memRShrd': 13647872, 'arch': 16777228, 'sandbox': True, 'diskBytesRead': 25415680, 'timerWakeBin2': 0, 'responsibleUniqueID': 0, 'msgRecv': 3459, 'latencyQosTier': 0, 'procFlags': 20987952, 'cpuUsage': 0.04797930536131817, 'tdev': -1, 'timerWakeBin1': 0, 'sysCallsMach': 17065, 'machPortCount': 233, 'rgid': 501, 'memCompressed': 0, 'platIdleWakeups': 29, 'tpgid': 0, 'wqNumThreads': 4, 'wqState': 0, 'restricted': False, 'sysCallsUnix': 70016, 'ppid': 1, 'svgid': 501, 'wqRunThreads': 0, 'procXstatus': 0, 'vmPageIns': 665, 'name': 'JobGet', 'policy': 1, 'ctxSwitch': 12519, 'memResidentSize': 105889792, 'threadCount': 12, 'pjobc': 0, 'threadsSystem': 351165916, 'uid': 501, 'priority': 31, 'memAnon': 32718848, 'cpuTotalSystem': 740381000, 'physFootprint': 32572992, 'nice': 0, 'uniqueID': 1800, 'comm': 'bundle.id', 'throughputQosTier': 0, 'nfiles': 50, 'coalitionID': 674, 'intWakeups': 200, 'memRPrvt': 23707648, 'ruid': 501, 'wiredSize': 0, 'pid': 1800, 'procAge': 38104946750, 'numRunning': 0, 'memAnonPeak': 33505280, 'powerScore': 0.04797930536131817, 'memVirtualSize': 418504065024, 'gid': 501, 'appSleep': False, 'responsiblePID': 1, 'msgSent': 9719, 'diskBytesWritten': 10215424, 'cowFaults': 637, 'pgid': 1800, 'procStatus': 2, 'totalEnergyScore': 158731846142, 'threadsUser': 436358791, 'faults': 9371, 'wqBlockedThreads': 0, 'parentUniqueID': 1, 'startAbsTime': 493105043857, 'memPurgeable': 344064, 'cpuTotalUser': 822345791, 'avgPowerScore': 416.5649336381765, 'suddenTerm': False, 'svuid': 501})]

YueChen-C commented 1 year ago

cpuUsage may be greater than 100% when multi-core cpu is used

VishalKumarX100 commented 1 year ago

@YueChen-C , I am concerned about the CPU usage for an IOS application. how to get the correct data. Also is there any way to determine the number of CPU cores through py-ios-device

YueChen-C commented 1 year ago

Fields EnabledCPUs and SystemCPUUsage returned by sysmontap

VishalKumarX100 commented 1 year ago

@YueChen-C I am trying to use sysmontap for APP cpu usage, for system CPU I am using monitor.

APP - pyidevice instruments sysmontap --bundle_id io.bundle.id --processes --proc_filter cpuUsage --udid 00008101-ID SYS - pyidevice instruments monitor --filter cpu --udid 00008101-ID

should I divide APP CPU usage by the number of cores I wanted to confirm for APP CPU usage can you please confirm

VishalKumarX100 commented 1 year ago

@YueChen-C , dividing by the number of cores for APP CPU utilization is giving unexpected results. it works for SYS CPU