Skip to content

Commit

Permalink
change to return ret.get(pid), ref #83
Browse files Browse the repository at this point in the history
  • Loading branch information
codeskyblue committed Apr 28, 2021
1 parent 6960ad3 commit 1d8d49c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tidevice/_instruments.py
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,7 @@ def stop_network_sampling(self, pid: int):
ch_network = 'com.apple.xcode.debug-gauge-data-providers.NetworkStatistics'
return self.call_message(ch_network, 'stopSamplingForPIDs:', [{pid}])

def get_process_network_stats(self, pid: int) -> Iterator[dict]:
def get_process_network_stats(self, pid: int) -> Optional[Iterator[dict]]:
"""
经测试数据始终不是很准,用safari测试,每次刷新图片的时候,rx.bytes总是不动
"""
Expand All @@ -939,7 +939,7 @@ def get_process_network_stats(self, pid: int) -> Iterator[dict]:
'net.tx.packets.delta'
}, {pid}]
ret = self.call_message(ch_network, 'sampleAttributes:forPIDs:', args)
return ret[pid] if pid in ret else ret
return ret.get(pid)

def iter_network(self) -> Iterator[dict]:
"""
Expand Down

0 comments on commit 1d8d49c

Please sign in to comment.