Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/bin/sh | |
| 2 | |
| 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | |
| 4 # Use of this source code is governed by a BSD-style license that can be | |
| 5 # found in the LICENSE file. | |
| 6 | |
| 7 getfield() { | |
| 8 shift $1 | |
| 9 echo $1 | |
| 10 } | |
| 11 | |
| 12 EVENT=$1 | |
| 13 shift | |
| 14 if [ $# -eq 0 ]; then | |
| 15 set -- time | |
| 16 fi | |
| 17 | |
| 18 while [ $# -gt 0 ]; do | |
| 19 case "$1" in | |
| 20 time) | |
| 21 TAG=uptime | |
| 22 FIELD=1 | |
| 23 ;; | |
| 24 read-sectors) | |
| 25 TAG=disk | |
| 26 FIELD=3 | |
| 27 ;; | |
| 28 write-sectors) | |
| 29 TAG=disk | |
| 30 FIELD=7 | |
| 31 ;; | |
| 32 *) | |
| 33 shift | |
| 34 continue | |
| 35 ;; | |
| 36 esac | |
| 37 STATFILE=/tmp/${TAG}-${EVENT} | |
| 38 if [ -f $STATFILE ]; then | |
| 39 getfield $FIELD $(tail -1 $STATFILE) | |
| 40 fi | |
| 41 shift | |
| 42 done | |
| OLD | NEW |