RuntimeRestartCollector
public
class
RuntimeRestartCollector
extends BaseDeviceMetricCollector
java.lang.Object | ||
↳ | com.android.tradefed.device.metric.BaseDeviceMetricCollector | |
↳ | com.android.tradefed.device.metric.RuntimeRestartCollector |
Collector that collects timestamps of runtime restarts (system server crashes) during the test run, if any.
Outputs results in counts, wall clock time in seconds and in HH:mm:ss format, and system uptime in nanoseconds and HH:mm:ss format.
This collector uses two sources for system server crashes:
- The system_restart_sec list from StatsdStatsReport, which is a rolling list of 20 timestamps when the system server crashes, in seconds, with newer crashes appended to the end (when the list fills up, older timestamps fall off the beginning).
- The AppCrashOccurred statsd atom, where a system server crash shows up as a system_server process crash (this behavior is documented in the statsd atoms.proto definition). The event metric gives the device uptime when the crash occurs.
Both can be useful information, as the former makes it easy to correlate timestamps in logs, while the latter serves as a longevity metric.
Summary
Fields | |
---|---|
public
static
final
String |
METRIC_PREFIX
|
public
static
final
String |
METRIC_SUFFIX_COUNT
|
public
static
final
String |
METRIC_SUFFIX_SYSTEM_TIMESTAMP_FORMATTED
|
public
static
final
String |
METRIC_SUFFIX_SYSTEM_TIMESTAMP_SECS
|
public
static
final
String |
METRIC_SUFFIX_UPTIME_FORMATTED
|
public
static
final
String |
METRIC_SUFFIX_UPTIME_NANOS
|
public
static
final
String |
SYSTEM_SERVER_KEYWORD
|
public
static
final
SimpleDateFormat |
TIME_FORMATTER
|
Public constructors | |
---|---|
RuntimeRestartCollector()
|
Public methods | |
---|---|
void
|
onTestRunEnd(DeviceMetricData runData,
Pull the timestamps at the end of the test run and report the difference with existing ones, if any. |
void
|
onTestRunStart(DeviceMetricData runData)
Store the existing timestamps of system server restarts prior to the test run as statsd keeps a running log of them, and push the config to collect app crashes. |
Fields
METRIC_PREFIX
public static final String METRIC_PREFIX
METRIC_SUFFIX_COUNT
public static final String METRIC_SUFFIX_COUNT
METRIC_SUFFIX_SYSTEM_TIMESTAMP_FORMATTED
public static final String METRIC_SUFFIX_SYSTEM_TIMESTAMP_FORMATTED
METRIC_SUFFIX_SYSTEM_TIMESTAMP_SECS
public static final String METRIC_SUFFIX_SYSTEM_TIMESTAMP_SECS
METRIC_SUFFIX_UPTIME_FORMATTED
public static final String METRIC_SUFFIX_UPTIME_FORMATTED
METRIC_SUFFIX_UPTIME_NANOS
public static final String METRIC_SUFFIX_UPTIME_NANOS
SYSTEM_SERVER_KEYWORD
public static final String SYSTEM_SERVER_KEYWORD
TIME_FORMATTER
public static final SimpleDateFormat TIME_FORMATTER
Public constructors
RuntimeRestartCollector
public RuntimeRestartCollector ()
Public methods
onTestRunEnd
public void onTestRunEnd (DeviceMetricData runData,currentRunMetrics)
Pull the timestamps at the end of the test run and report the difference with existing ones, if any.
Parameters | |
---|---|
runData |
DeviceMetricData : the DeviceMetricData holding the data for the run. Will be the same
object as during onTestRunStart(com.android.tradefed.device.metric.DeviceMetricData) . |
currentRunMetrics |
: the current map of metrics passed to ERROR(/#testRunEnded(long,Map)) . |
Throws | |
---|---|
DeviceNotAvailableException |
onTestRunStart
public void onTestRunStart (DeviceMetricData runData)
Store the existing timestamps of system server restarts prior to the test run as statsd keeps a running log of them, and push the config to collect app crashes.
Parameters | |
---|---|
runData |
DeviceMetricData : the DeviceMetricData holding the data for the run. |
Throws | |
---|---|
DeviceNotAvailableException |