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
634 stars 179 forks source link

ValueError: math domain error #44

Closed mutexz closed 2 years ago

mutexz commented 2 years ago

你好,我在使用py-ios-device执行pyidevice instruments monitor命令时,出现如下的错误提示:

2021-10-09 11:08:04 [ERROR] [Instrument] dvt.py[line:247] math domain error
Traceback (most recent call last):
  File "c:\python36\lib\site-packages\ios_device\servers\dvt.py", line 234, in _receiver
    self._channel_callbacks[(2 ** 32 - dtx.channel_code)](dtx)
  File "c:\python36\lib\site-packages\ios_device\cli\instruments.py", line 257, in on_callback_message
    print("Memory  >>", Memory.decode(data))
  File "c:\python36\lib\site-packages\ios_device\util\utils.py", line 211, in decode
    Swap_Used = convertBytes(system.get("__vmSwapUsage"))
  File "c:\python36\lib\site-packages\ios_device\util\utils.py", line 122, in convertBytes
    math.log(_bytes, 1024)  # 求对数(对数:若 a**b = N 则 b 叫做以 a 为底 N 的对数)
ValueError: math domain error

设备是iPhone 12 Pro, 系统版本iOS 14.7.1 不太清楚为何会出现这种问题,还麻烦帮忙看看,谢谢。

YueChen-C commented 2 years ago

为 0 的时候计算错误了,以提交相关修改

mutexz commented 2 years ago

为 0 的时候计算错误了,以提交相关修改 感谢

NASA2333 commented 1 year ago

Traceback (most recent call last): File "C:\python38\lib\site-packages\ios_device\servers\dvt.py", line 237, in _receiver self._channel_callbacks(2 ** 32 - dtx.channel_code) File "C:\python38\lib\site-packages\ios_device\cli\instruments.py", line 303, in on_callback_message print("Memory >>", Memory.decode(data)) File "C:\python38\lib\site-packages\ios_device\util\utils.py", line 209, in decode App_Memory = convertBytes((system.get('vmIntPageCount') - system.get("vmPurgeableCount")) * self.kernel_page_size) File "C:\python38\lib\site-packages\ios_device\util\utils.py", line 126, in convertBytes math.log(_bytes, 1024) # 求对数(对数:若 a**b = N 则 b 叫做以 a 为底 N 的对数) ValueError: math domain error

Aborted!

C:\Users\MIco λ pip list | grep py-ios py-ios-device 2.3.32.2

2.3.32.2 版本仍存在该问,麻烦看下