GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — droidScripts/mem.py at master · Juude/droidScripts

Expand file tree

/

mem.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
executable file
·
67 lines (50 loc) · 1.81 KB
/

mem.py

Copy path

File metadata and controls

executable file
·
67 lines (50 loc) · 1.81 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# -*- encoding:utf-8 -*-
from __future__ import division # 1.5
import sys
import threading
import subprocess
reload(sys)
sleep_time = 3.0
def is_mac_os():
return not sys.platform.system().lower().find("windows") >= 0
def inred(s):
return "%s[31;2m%s%s[0m" % (chr(27), s, chr(27))
def refresh_mem_info(package):
try:
cmd = 'adb shell dumpsys meminfo ' + package
result = subprocess.check_output(cmd, shell=True)
result = result.strip()
results = result.split('\r\n')
native_mem = 0
java_mem = 0
for line in results:
line = line.replace(" ", "|")
mem_array = line.split("|")
pd_array = []
for raw in mem_array:
raw = raw.replace("|", "")
if len(raw) > 0:
pd_array.append(raw)
pd_len = len(pd_array)
if pd_len >= 6 and pd_array[0] == 'Native':
native_mem = int(pd_array[pd_len - 2])
if pd_len >= 6 and pd_array[0] == 'Dalvik':
java_mem = int(pd_array[pd_len - 2])
if native_mem > 0 and java_mem > 0:
break
sys.stdout.write(
"\r[{0}] [{1}] [{2}]".format('native alloc = ' + inred(str(native_mem)),
'java alloc = ' + inred(str(java_mem)),
'all alloc = ' + inred(str(java_mem + native_mem))))
sys.stdout.flush()
except Exception, e:
print e.message
else:
pass
finally:
start_watcher()
def start_watcher():
thread = threading.Timer(sleep_time, refresh_mem_info(sys.argv[1:][0]))
thread.start()
if __name__ == "__main__":
start_watcher()
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.