blob: e3b2512b8f165e3690d3af5e78afd2195a3ccf13 [file] [log] [blame]
# Copyright (c) 2011 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.
description "Send boot stats after login prompt is visible"
author ""
# This script is primarily responsible for sending boot time statistics
# after we finish booting. Completion of this job is also the key
# to starting the 'system-services' job. This job needs to run first
# because the amount of work that starts with 'system-services' could
# otherwise delay the 'bootstat' timestamp, and make boot time
# measurements less reliable.
# Note, the 'start on' line is modified by chromeos-factoryinstall.ebuild
# and mod_for_factory. Please do not change without also changing
# those references.
# TODO(jrbarnette) The external dependencies that edit this line should
# be eliminated.
start on login-prompt-visible
# The login-prompt-visible signal is emitted every time the login
# screen is displayed. The check below makes sure boot stats are
# reported only once per boot.
if [ -n "$(bootstat_get_last boot-complete)" ]; then
exit 0
bootstat boot-complete
# If ureadahead is still running, then presumably it's performing
# a boot trace. We only care about tracing until login prompt, so
# stop the process now.
# We have to ignore the return status in case ureadahead has
# already completed, because pkill helpfully exits with a non-zero
# status when no process was found.
pkill '^ureadahead$' || true
# Report boot time and disk usage metrics to UMA.
send_boot_metrics &
end script