Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Tool for continously displaying b2g-procrank. r=jlebar

  • Loading branch information...
commit 715069ce81c4d0842af0bb229dfdd2f4b9edfe2e 1 parent a706c84
@philikon philikon authored
Showing with 35 additions and 0 deletions.
  1. +35 −0 display-procrank.py
View
35 display-procrank.py
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+"""
+Continuously display b2g-procrank.
+"""
+
+from __future__ import print_function
+
+import sys
+import time
+import subprocess
+
+def shell(cmd, cwd=None):
+ proc = subprocess.Popen(cmd, shell=True, cwd=cwd,
+ stdout=sys.stdout, stderr=subprocess.PIPE)
+ (out, err) = proc.communicate()
+ if proc.returncode:
+ print("Command %s failed with error code %d" % (cmd, proc.returncode), file=sys.stderr)
+ if err:
+ print(err, file=sys.stderr)
+ raise subprocess.CalledProcessError(proc.returncode, cmd, err)
+ return out
+
+
+def main():
+ try:
+ while True:
+ print(chr(27) + "[0;0H") # move cursor to top left
+ shell("adb shell b2g-procrank")
+ print(chr(27) + "[J") # erase screen from current line down
+ time.sleep(1)
+ except KeyboardInterrupt:
+ pass
+
+if __name__ == "__main__":
+ main()
Please sign in to comment.
Something went wrong with that request. Please try again.