| 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 # This script collects UMA metrics when the device is coming out of |
| 8 # suspend or, if the machine shut down while in suspend, at boot time. |
| 9 # |
| 10 # Usage: |
| 11 # -b -- indicates that this script is invoked at boot time. |
| 12 |
| 13 F_SUSPEND_AT=/var/log/metrics/suspend-to-ram-time |
| 14 [ -r $F_SUSPEND_AT ] || exit |
| 15 |
| 16 RESUME_AT=`cat /sys/class/rtc/rtc0/since_epoch` |
| 17 SUSPEND_AT=`cat $F_SUSPEND_AT` |
| 18 |
| 19 rm -f $F_SUSPEND_AT |
| 20 |
| 21 TIME_IN_SUSPEND_NAME=Power.TimeInSuspendAtResume |
| 22 [ "$1" = "-b" ] && TIME_IN_SUSPEND_NAME=Power.TimeInSuspendAtBoot |
| 23 |
| 24 if [ $RESUME_AT -gt $SUSPEND_AT ]; then |
| 25 # Converts seconds to minutes rounding to the nearest whole minute. |
| 26 TIME_IN_SUSPEND=$((($RESUME_AT - $SUSPEND_AT + 30) / 60)) |
| 27 /usr/bin/metrics_client $TIME_IN_SUSPEND_NAME $TIME_IN_SUSPEND 1 10000 50 |
| 28 fi |
| OLD | NEW |