| #!/bin/sh |
| |
| # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| FREQ=$(cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq) |
| AWK_PROG=' |
| /Initial TSC value:/ { |
| sub(".*Initial TSC value: ", "") |
| initial_tsc = $0 |
| exit |
| } |
| END { |
| printf "%.2f", initial_tsc / ('$FREQ' * 1000.0) |
| } |
| ' |
| FIRMWARE_TIME=$(dmesg | awk "$AWK_PROG") |
| |
| # TODO(jrbarnette): This is a concession to existing chrome code |
| # that uses the value for reporting metrics to UMA. We'd like to |
| # move that reporting here, to reduce coupling with chrome. Once |
| # we've moved the metrics reporting here, the code to create this |
| # file can be removed. |
| echo $FIRMWARE_TIME >/tmp/firmware-boot-time |
| |
| # usage: |
| # report_disk_metrics <read-sectors> <write-sectors> |
| report_disk_metrics() { |
| metrics_client Platform.BootSectorsRead $1 1 1000000 50 |
| metrics_client Platform.BootSectorsWritten $2 1 10000 50 |
| } |
| |
| report_disk_metrics $( |
| bootstat_get_last boot-complete read-sectors write-sectors) |
| |
| send_metrics_on_resume -b |