Commit 44335428 authored by Will Harris's avatar Will Harris Committed by Commit Bot

Renumber base::win::Version and stop emitting histograms based on it.

Add missing WIN10_19H2 entry, and update tests.

BUG=1130738

Change-Id: Ia9208cebdd092c084468bf31482907afe56a4ef3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2458328
Auto-Submit: Will Harris <wfh@chromium.org>
Reviewed-by: default avatarMark Pearson <mpearson@chromium.org>
Reviewed-by: default avatarBruce Dawson <brucedawson@chromium.org>
Commit-Queue: Mark Pearson <mpearson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#816845}
parent f219131c
...@@ -258,6 +258,8 @@ Version OSInfo::MajorMinorBuildToVersion(int major, int minor, int build) { ...@@ -258,6 +258,8 @@ Version OSInfo::MajorMinorBuildToVersion(int major, int minor, int build) {
if (major == 10) { if (major == 10) {
if (build >= 19041) if (build >= 19041)
return Version::WIN10_20H1; return Version::WIN10_20H1;
if (build >= 18363)
return Version::WIN10_19H2;
if (build >= 18362) if (build >= 18362)
return Version::WIN10_19H1; return Version::WIN10_19H1;
if (build >= 17763) if (build >= 17763)
......
...@@ -31,9 +31,6 @@ namespace win { ...@@ -31,9 +31,6 @@ namespace win {
// syntactic sugar reasons; see the declaration of GetVersion() below. // syntactic sugar reasons; see the declaration of GetVersion() below.
// NOTE: Keep these in order so callers can do things like // NOTE: Keep these in order so callers can do things like
// "if (base::win::GetVersion() >= base::win::Version::VISTA) ...". // "if (base::win::GetVersion() >= base::win::Version::VISTA) ...".
//
// This enum is used in metrics histograms, so they shouldn't be reordered or
// removed. New values can be added before Version::WIN_LAST.
enum class Version { enum class Version {
PRE_XP = 0, // Not supported. PRE_XP = 0, // Not supported.
XP = 1, XP = 1,
...@@ -50,10 +47,9 @@ enum class Version { ...@@ -50,10 +47,9 @@ enum class Version {
WIN10_RS4 = 12, // Redstone 4: Version 1803, Build 17134. WIN10_RS4 = 12, // Redstone 4: Version 1803, Build 17134.
WIN10_RS5 = 13, // Redstone 5: Version 1809, Build 17763. WIN10_RS5 = 13, // Redstone 5: Version 1809, Build 17763.
WIN10_19H1 = 14, // 19H1: Version 1903, Build 18362. WIN10_19H1 = 14, // 19H1: Version 1903, Build 18362.
WIN10_20H1 = 15, // 20H1: Version 2004, Build 19041. WIN10_19H2 = 15, // 19H2: Version 1909, Build 18363.
// On edit, update tools\metrics\histograms\enums.xml "WindowsVersion" and WIN10_20H1 = 16, // 20H1: Version 2004, Build 19041.
// "GpuBlacklistFeatureTestResultsWindows2". WIN_LAST, // Indicates error condition.
WIN_LAST, // Indicates error condition.
}; };
// A rough bucketing of the available types of versions of Windows. This is used // A rough bucketing of the available types of versions of Windows. This is used
......
...@@ -10,11 +10,16 @@ ...@@ -10,11 +10,16 @@
namespace base { namespace base {
namespace win { namespace win {
TEST(WindowsVersion, GetVersionExAndKernelVersionMatch) { TEST(WindowsVersion, GetVersionExAndKernelOsVersionMatch) {
// If this fails, we're running in compatibility mode, or need to update the // If this fails, we're running in compatibility mode, or need to update the
// application manifest. // application manifest.
EXPECT_EQ(OSInfo::GetInstance()->version(), // Note: not all versions of Windows return identical build numbers e.g.
OSInfo::GetInstance()->Kernel32Version()); // 1909/19H2 kernel32.dll has build number 18362 but OS version build number
// 18363.
EXPECT_EQ(OSInfo::GetInstance()->Kernel32VersionNumber().major,
OSInfo::GetInstance()->version_number().major);
EXPECT_EQ(OSInfo::GetInstance()->Kernel32VersionNumber().minor,
OSInfo::GetInstance()->version_number().minor);
} }
TEST(OSInfo, MajorMinorBuildToVersion) { TEST(OSInfo, MajorMinorBuildToVersion) {
...@@ -22,6 +27,8 @@ TEST(OSInfo, MajorMinorBuildToVersion) { ...@@ -22,6 +27,8 @@ TEST(OSInfo, MajorMinorBuildToVersion) {
Version::WIN10_20H1); Version::WIN10_20H1);
EXPECT_EQ(OSInfo::MajorMinorBuildToVersion(10, 0, 19041), EXPECT_EQ(OSInfo::MajorMinorBuildToVersion(10, 0, 19041),
Version::WIN10_20H1); Version::WIN10_20H1);
EXPECT_EQ(OSInfo::MajorMinorBuildToVersion(10, 0, 18363),
Version::WIN10_19H2);
EXPECT_EQ(OSInfo::MajorMinorBuildToVersion(10, 0, 18362), EXPECT_EQ(OSInfo::MajorMinorBuildToVersion(10, 0, 18362),
Version::WIN10_19H1); Version::WIN10_19H1);
EXPECT_EQ(OSInfo::MajorMinorBuildToVersion(10, 0, 17763), Version::WIN10_RS5); EXPECT_EQ(OSInfo::MajorMinorBuildToVersion(10, 0, 17763), Version::WIN10_RS5);
......
...@@ -152,12 +152,6 @@ bool IsApplockerRunning(); ...@@ -152,12 +152,6 @@ bool IsApplockerRunning();
void RecordStartupMetrics() { void RecordStartupMetrics() {
#if defined(OS_WIN) #if defined(OS_WIN)
const base::win::OSInfo& os_info = *base::win::OSInfo::GetInstance(); const base::win::OSInfo& os_info = *base::win::OSInfo::GetInstance();
base::UmaHistogramEnumeration("Windows.GetVersionExVersion",
os_info.version(),
base::win::Version::WIN_LAST);
base::UmaHistogramEnumeration("Windows.Kernel32Version",
os_info.Kernel32Version(),
base::win::Version::WIN_LAST);
int patch = os_info.version_number().patch; int patch = os_info.version_number().patch;
int build = os_info.version_number().build; int build = os_info.version_number().build;
int patch_level = 0; int patch_level = 0;
......
...@@ -78230,6 +78230,9 @@ Called by update_scheduler_enums.py.--> ...@@ -78230,6 +78230,9 @@ Called by update_scheduler_enums.py.-->
</enum> </enum>
<enum name="WindowsVersion"> <enum name="WindowsVersion">
<obsolete>
Removed from code Oct 2020.
</obsolete>
<int value="0" label="Pre-XP"/> <int value="0" label="Pre-XP"/>
<int value="1" label="XP"/> <int value="1" label="XP"/>
<int value="2" label="2003 Server"/> <int value="2" label="2003 Server"/>
...@@ -78244,7 +78247,7 @@ Called by update_scheduler_enums.py.--> ...@@ -78244,7 +78247,7 @@ Called by update_scheduler_enums.py.-->
<int value="11" label="Windows 10 RS3"/> <int value="11" label="Windows 10 RS3"/>
<int value="12" label="Windows 10 RS4"/> <int value="12" label="Windows 10 RS4"/>
<int value="13" label="Windows 10 RS5"/> <int value="13" label="Windows 10 RS5"/>
<int value="14" label="Windows 10 19H1"/> <int value="14" label="Windows 10 19H1 or 19H2"/>
<int value="15" label="Windows 10 20H1"/> <int value="15" label="Windows 10 20H1"/>
</enum> </enum>
...@@ -60,6 +60,10 @@ reviews. Googlers can read more about this at go/gwsq-gerrit. ...@@ -60,6 +60,10 @@ reviews. Googlers can read more about this at go/gwsq-gerrit.
<histogram name="Windows.GetVersionExVersion" enum="WindowsVersion" <histogram name="Windows.GetVersionExVersion" enum="WindowsVersion"
expires_after="never"> expires_after="never">
<obsolete>
Removed 10/2020 as this histogram has been replaced by the synthetic
histogram Windows.WindowsVersion generated from Windows.PatchLevel.
</obsolete>
<!-- expires-never: Needed to measure Windows ecosystem. --> <!-- expires-never: Needed to measure Windows ecosystem. -->
<owner>wfh@chromium.org</owner> <owner>wfh@chromium.org</owner>
...@@ -149,6 +153,11 @@ reviews. Googlers can read more about this at go/gwsq-gerrit. ...@@ -149,6 +153,11 @@ reviews. Googlers can read more about this at go/gwsq-gerrit.
<histogram name="Windows.Kernel32Version" enum="WindowsVersion" <histogram name="Windows.Kernel32Version" enum="WindowsVersion"
expires_after="never"> expires_after="never">
<obsolete>
Removed 10/2020 as this histogram has been replaced by the synthetic
histogram Windows.WindowsVersionKernel32 generated from
Windows.PatchLevelKernel32.
</obsolete>
<!-- expires-never: Needed to measure Windows ecosystem. --> <!-- expires-never: Needed to measure Windows ecosystem. -->
<owner>wfh@chromium.org</owner> <owner>wfh@chromium.org</owner>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment