1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
|
// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ash/borealis/borealis_metrics.h"
#include "base/metrics/histogram_functions.h"
#include "chrome/browser/ash/borealis/borealis_installer.h"
#include "chrome/browser/ash/borealis/borealis_types.mojom.h"
namespace borealis {
using borealis::mojom::InstallResult;
const char kBorealisInstallNumAttemptsHistogram[] =
"Borealis.Install.NumAttempts";
const char kBorealisInstallResultHistogram[] = "Borealis.Install.Result";
const char kBorealisInstallSourceHistogram[] = "Borealis.Install.Source";
const char kBorealisInstallOverallTimeHistogram[] =
"Borealis.Install.OverallTime";
// Same as Borealis.Install.OverallTime, but with more appropriate bucket sizes.
const char kBorealisInstallOverallTimeHistogram2[] =
"Borealis.Install.OverallTime2";
const char kBorealisLaunchSourceHistogram[] = "Borealis.Launch.Source";
const char kBorealisShutdownNumAttemptsHistogram[] =
"Borealis.Shutdown.NumAttempts";
const char kBorealisShutdownResultHistogram[] = "Borealis.Shutdown.Result";
const char kBorealisStabilityHistogram[] = "Borealis.Stability";
const char kBorealisStartupNumAttemptsHistogram[] =
"Borealis.Startup.NumAttempts";
const char kBorealisStartupResultHistogram[] = "Borealis.Startup.Result";
const char kBorealisStartupOverallTimeHistogram[] =
"Borealis.Startup.OverallTime";
// Same as Borealis.Startup.OverallTime, but with more appropriate bucket sizes.
const char kBorealisStartupOverallTimeHistogram2[] =
"Borealis.Startup.OverallTime2";
const char kBorealisStartupTimeToFirstWindowHistogram[] =
"Borealis.Startup.TimeToFirstWindow";
const char kBorealisUninstallNumAttemptsHistogram[] =
"Borealis.Uninstall.NumAttempts";
const char kBorealisUninstallResultHistogram[] = "Borealis.Uninstall.Result";
void RecordBorealisInstallNumAttemptsHistogram() {
base::UmaHistogramBoolean(kBorealisInstallNumAttemptsHistogram, true);
}
void RecordBorealisInstallResultHistogram(InstallResult install_result) {
base::UmaHistogramEnumeration(kBorealisInstallResultHistogram,
install_result);
}
void RecordBorealisInstallSourceHistogram(BorealisLaunchSource install_source) {
base::UmaHistogramEnumeration(kBorealisInstallSourceHistogram,
install_source);
}
void RecordBorealisInstallOverallTimeHistogram(base::TimeDelta install_time) {
base::UmaHistogramTimes(kBorealisInstallOverallTimeHistogram, install_time);
base::UmaHistogramLongTimes(kBorealisInstallOverallTimeHistogram2,
install_time);
}
void RecordBorealisLaunchSourceHistogram(BorealisLaunchSource launch_source) {
base::UmaHistogramEnumeration(kBorealisLaunchSourceHistogram, launch_source);
}
void RecordBorealisUninstallNumAttemptsHistogram() {
base::UmaHistogramBoolean(kBorealisUninstallNumAttemptsHistogram, true);
}
void RecordBorealisUninstallResultHistogram(
BorealisUninstallResult uninstall_result) {
base::UmaHistogramEnumeration(kBorealisUninstallResultHistogram,
uninstall_result);
}
void RecordBorealisStartupNumAttemptsHistogram() {
base::UmaHistogramBoolean(kBorealisStartupNumAttemptsHistogram, true);
}
void RecordBorealisStartupResultHistogram(
BorealisStartupResult startup_result) {
base::UmaHistogramEnumeration(kBorealisStartupResultHistogram,
startup_result);
}
void RecordBorealisStartupOverallTimeHistogram(base::TimeDelta startup_time) {
base::UmaHistogramTimes(kBorealisStartupOverallTimeHistogram, startup_time);
base::UmaHistogramMediumTimes(kBorealisStartupOverallTimeHistogram2,
startup_time);
}
void RecordBorealisStartupTimeToFirstWindowHistogram(
base::TimeDelta startup_time) {
base::UmaHistogramMediumTimes(kBorealisStartupTimeToFirstWindowHistogram,
startup_time);
}
void RecordBorealisShutdownNumAttemptsHistogram() {
base::UmaHistogramBoolean(kBorealisShutdownNumAttemptsHistogram, true);
}
void RecordBorealisShutdownResultHistogram(
BorealisShutdownResult shutdown_result) {
base::UmaHistogramEnumeration(kBorealisShutdownResultHistogram,
shutdown_result);
}
} // namespace borealis
std::ostream& operator<<(std::ostream& stream,
borealis::BorealisStartupResult result) {
switch (result) {
case borealis::BorealisStartupResult::kSuccess:
return stream << "Success";
case borealis::BorealisStartupResult::kCancelled:
return stream << "Cancelled";
case borealis::BorealisStartupResult::kDiskImageFailed:
return stream << "Disk Image failed";
case borealis::BorealisStartupResult::kStartVmFailed:
return stream << "Start VM failed";
case borealis::BorealisStartupResult::kAwaitBorealisStartupFailed:
return stream << "Await Borealis Startup failed";
case borealis::BorealisStartupResult::kSyncDiskFailed:
return stream << "Syncing Disk failed";
case borealis::BorealisStartupResult::kRequestWaylandFailed:
return stream << "Request Wayland failed";
case borealis::BorealisStartupResult::kDisallowed:
return stream << "Borealis is not allowed";
case borealis::BorealisStartupResult::kDlcCancelled:
return stream << "DLC install was cancelled";
case borealis::BorealisStartupResult::kDlcOffline:
return stream << "Device is offline";
case borealis::BorealisStartupResult::kDlcNeedUpdateError:
return stream
<< "DLC service couldn't find an image at the correct version";
case borealis::BorealisStartupResult::kDlcNeedRebootError:
return stream << "Device needs to be rebooted";
case borealis::BorealisStartupResult::kDlcNeedSpaceError:
return stream << "Device needs more space to install DLC";
case borealis::BorealisStartupResult::kDlcBusyError:
return stream << "DLC service is busy";
case borealis::BorealisStartupResult::kDlcInternalError:
return stream << "DLC reported an internal error";
case borealis::BorealisStartupResult::kDlcUnsupportedError:
return stream << "Borealis DLC is not supported";
case borealis::BorealisStartupResult::kDlcUnknownError:
return stream << "DLC service ran into an unknown error";
case borealis::BorealisStartupResult::kConciergeUnavailable:
return stream << "Concierge is unavailable";
case borealis::BorealisStartupResult::kEmptyDiskResponse:
return stream << "Concierge returned an empty disk response";
case borealis::BorealisStartupResult::kStartVmEmptyResponse:
return stream << "Concierge returned an empty startup request";
}
}
|