Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(336)

Side by Side Diff: send_boot_metrics

Issue 6732024: Add SMART disk error counts to UMA (Closed) Base URL: http://git.chromium.org/git/init.git@master
Patch Set: Fix for dash Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/sh 1 #!/bin/sh
2 2
3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 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 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 FREQ=$(cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq) 7 FREQ=$(cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq)
8 AWK_PROG=' 8 AWK_PROG='
9 /Initial TSC value:/ { 9 /Initial TSC value:/ {
10 sub(".*Initial TSC value: ", "") 10 sub(".*Initial TSC value: ", "")
(...skipping 17 matching lines...) Expand all
28 # report_disk_metrics <read-sectors> <write-sectors> 28 # report_disk_metrics <read-sectors> <write-sectors>
29 report_disk_metrics() { 29 report_disk_metrics() {
30 metrics_client Platform.BootSectorsRead $1 1 1000000 50 30 metrics_client Platform.BootSectorsRead $1 1 1000000 50
31 metrics_client Platform.BootSectorsWritten $2 1 10000 50 31 metrics_client Platform.BootSectorsWritten $2 1 10000 50
32 } 32 }
33 33
34 report_disk_metrics $( 34 report_disk_metrics $(
35 bootstat_get_last boot-complete read-sectors write-sectors) 35 bootstat_get_last boot-complete read-sectors write-sectors)
36 36
37 send_metrics_on_resume -b 37 send_metrics_on_resume -b
38
39 # Report disk health from SMART (S.M.A.R.T.) parameters.
40 # The first printf avoids a newline in $smart.
41 smart="$(/usr/sbin/smartctl -A $(/usr/bin/rootdev -d) | \
42 awk '
43 /^187/ { printf "%d ", $10; }
44 /^199/ { print $10; }
45 ')"
46 # smart now contains two numbers, for instance "10 20". Extract each number
47 # using prefix and suffix substitutions. This would less cryptic if dash had
48 # arrays.
49 metrics_client Platform.SmartUncorrectableErrors ${smart% *} 1 1000000 20
50 metrics_client Platform.SmartTransferErrors ${smart#* } 1 1000000 20
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698