| 468 | return result.decode().replace("\u0000", " ").strip() |
| 469 | |
| 470 | def get_process_net_list(self): |
| 471 | w_file = '/dev/shm/bt_net_process' |
| 472 | if not os.path.exists(w_file): return |
| 473 | self.last_net_process = self.__cache.get('net_process') |
| 474 | self.last_net_process_time = self.__cache.get('last_net_process') |
| 475 | net_process_body = self.read_file(w_file) |
| 476 | if not net_process_body: return |
| 477 | net_process = net_process_body.split('\n') |
| 478 | for np in net_process: |
| 479 | if not np: continue |
| 480 | tmp = {} |
| 481 | np_list = np.split() |
| 482 | if len(np_list) < 5: continue |
| 483 | tmp['pid'] = int(np_list[0]) |
| 484 | tmp['down'] = int(np_list[1]) |
| 485 | tmp['up'] = int(np_list[2]) |
| 486 | tmp['down_package'] = int(np_list[3]) |
| 487 | tmp['up_package'] = int(np_list[4]) |
| 488 | self.__process_net_list[str(tmp['pid'])] = tmp |
| 489 | self.__cache.set('net_process', self.__process_net_list, 600) |
| 490 | self.__cache.set('last_net_process', time.time(), 600) |
| 491 | |
| 492 | def get_process_network(self, pid): |
| 493 | ''' |