Closed Bug 864597 Opened 11 years ago Closed 11 years ago

Create a b2g-info utility

Categories

(Firefox OS Graveyard :: GonkIntegration, enhancement)

ARM
Gonk (Firefox OS)
enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: dhylands, Unassigned)

References

Details

Attachments

(1 file)

Create a b2g-toolbox utility, similar to system/core/toolbox.

Initially, this would contain b2g-ps and b2g-procrank, rewritten from sh into C.

The rational for rewriting into C is for performance.
Severity: normal → enhancement
Assignee: nobody → vd
We got bitten in bug 879529 because we don't have an easy way to display thread priorities, so I'm going to take a stab at this.

(Of course one could modify the existing script to display thread priorities, but I think only dhylands has enough sh-fu to accomplish this.)
Please do! I have been too occupied lately.
Assignee: vd → nobody
Comment on attachment 759542 [details]
Pointer to Github pull request: https://github.com/mozilla-b2g/gonk-misc/pull/96

This turned out to be a fair bit more code than I expected, although it's not particularly complicated.

I still think this is more maintainable than the b2g-ps and b2g-procrank shell scripts, which require shell-fu beyond anyone except dhylands, but maybe that's only because I wrote it.  :)

This script is also a 3.5x speedup over b2g-procrank (0.34s vs 0.09s on my phone), despite delivering a lot more information than b2g-procrank.  This makes a big difference when you want to watch memory usage by running the script in a loop.

The output is also nicer, and there's just one script to run to get all the information you need.

What do you think, Dave?
Attachment #759542 - Flags: review?(dhylands)
$ adb shell b2g-info
                         |     megabytes    |
           NAME PID NICE  USS  PSS  RSS VSIZE OOM_ADJ USER   
            b2g 146    0 49.4 53.3 64.5 168.8       0 root   
          Usage 374   18 10.7 14.1 24.6  64.2       6 app_374
     Homescreen 375   18 12.6 16.3 27.1  67.8       4 app_375
(Preallocated a 383   18  7.9 10.7 20.4  58.6       6 root   

System memory info:
            Total 176.5 MB
     Used - cache  98.7 MB
  B2G procs (PSS)  94.4 MB
    Non-B2G procs   4.3 MB
     Free + cache  77.8 MB
             Free  38.9 MB
            Cache  38.9 MB

Low-memory killer parameters:
  notify_trigger 10240 KB

  oom_adj min_free
        6 20480 KB
        4  8192 KB
        3  7168 KB
        2  6144 KB
        1  5120 KB
        0  4096 KB
Whiteboard: [good first bug][mentor=dhylands][lang=c]
$ adb shell b2g-info -t
                         |     megabytes    |
           NAME TID NICE  USS  PSS  RSS VSIZE OOM_ADJ USER   
            b2g 146    0 49.5 53.3 64.5 168.8       0 root   
Binder Thread # 221    0
Binder Thread # 227    0
            b2g 247    0
 Gecko_IOThread 249    0
       XPCOM CC 250    0
  Socket Thread 251    0
   JS GC Helper 252    0
JS Sour~ Thread 253    0
    JS Watchdog 254    0
   Hang Monitor 255    0
            b2g 256    0
     Compositor 257    0
ImageBridgeChil 258    0
          Timer 259    0
     DOM Worker 260    0
   JS GC Helper 261    0
JS Sour~ Thread 262    0
     DOM Worker 263    0
     DOM Worker 264    0
   JS GC Helper 265    0
JS Sour~ Thread 266    0
   JS GC Helper 267    0
JS Sour~ Thread 268    0
     DOM Worker 269    0
   JS GC Helper 270    0
JS Sour~ Thread 271    0
            b2g 272    0
    InputReader 273   -8
    GonkSensors 274    0
   HTML5 Parser 277    0
            b2g 317    0
      Cache I/O 321    0
    Cert Verify 359    0
     GL updater 362  -10
  mozStorage #1 395    0
Proxy R~olution 478    0
            b2g 685    0
-------------------------------------------------------------
           NAME TID NICE  USS  PSS  RSS VSIZE OOM_ADJ USER   
          Usage 374   18 10.7 14.1 24.6  64.2       6 app_374
Binder Thread # 438   18
Chrome_ChildThr 439   18
Binder Thread # 440   18
       XPCOM CC 441   18
   JS GC Helper 446   18
JS Sour~ Thread 447   18
    JS Watchdog 448   18
  Socket Thread 449   18
(Preallocated a 454   18
ImageBridgeChil 455   18
          Timer 477   18
   HTML5 Parser 484   18
-------------------------------------------------------------
           NAME TID NICE  USS  PSS  RSS VSIZE OOM_ADJ USER   
     Homescreen 375   18 12.6 16.3 27.1  67.8       4 app_375
Binder Thread # 384   18
Chrome_ChildThr 385   18
Binder Thread # 386   18
       XPCOM CC 387   18
   JS GC Helper 388   18
JS Sour~ Thread 389   18
    JS Watchdog 390   18
  Socket Thread 391   18
(Preallocated a 393   18
ImageBridgeChil 394   18
          Timer 397   18
   HTML5 Parser 399   18
-------------------------------------------------------------
           NAME TID NICE  USS  PSS  RSS VSIZE OOM_ADJ USER   
(Preallocated a 383   18  7.9 10.7 20.4  58.6       6 root   
Binder Thread # 442   18
Chrome_ChildThr 443   18
Binder Thread # 444   18
       XPCOM CC 445   18
   JS GC Helper 450   18
JS Sour~ Thread 451   18
    JS Watchdog 452   18
  Socket Thread 453   18
(Preallocated a 456   18
ImageBridgeChil 457   18
          Timer 481   18

System memory info:
            Total 176.5 MB
     Used - cache  98.7 MB
  B2G procs (PSS)  94.4 MB
    Non-B2G procs   4.3 MB
     Free + cache  77.8 MB
             Free  38.9 MB
            Cache  38.9 MB

Low-memory killer parameters:
  notify_trigger 10240 KB

  oom_adj min_free
        6 20480 KB
        4  8192 KB
        3  7168 KB
        2  6144 KB
        1  5120 KB
        0  4096 KB
The -p/-m/-c args are mainly for use by scripts.
Summary: Create a b2g-toolbox utility → Create a b2g-info utility
FWIW I originally started out with a tool called b2g-toolbox, which had two commands: |b2g-toolbox ps| and |b2g-toolbox pids|.

But in using it, I decided that it would be easier to use if there was just one command you could run that would print out all the information you needed.  So I renamed |b2g-toolbox ps|to b2g-info and hid |pids| behind -p/-m/-c.  I think this is much better from a usability pov.
Comment on attachment 759542 [details]
Pointer to Github pull request: https://github.com/mozilla-b2g/gonk-misc/pull/96

r=me with a fix to safe_opendir and caching the results of pagesize
Attachment #759542 - Flags: review?(dhylands) → review+
> Merted.

Sigh, sometimes I wish bugzilla had an edit button.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: