Skip to content
This repository was archived by the owner on Jan 17, 2025. It is now read-only.

Commit 5b6211b

Browse files
committed
WPERF-1003 fix: bugs within counting settings and edge cases
See merge request Linaro/WindowsPerf/vs-extension!112 === ChangeLog === * fix: bugs within counting settings and edge cases
1 parent fc9ff29 commit 5b6211b

File tree

9 files changed

+41
-29
lines changed

9 files changed

+41
-29
lines changed

WindowsPerfGUI/Commands/SamplingExplorerCommand.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,16 @@ internal sealed class SamplingExplorerCommand : BaseCommand<SamplingExplorerComm
4141
protected override void BeforeQueryStatus(EventArgs e)
4242
{
4343
string windowTitle = SamplingExplorerLanguagePack.WindowTitle;
44-
if (
45-
WPerfOptions.Instance.WperfCurrentVersion.Components[0].ComponentVersion
46-
!= WperfDefaults.WPERF_MIN_VERSION
47-
)
48-
windowTitle += $" - (UNSTABLE)";
44+
try
45+
{
46+
if (
47+
WPerfOptions.Instance.WperfCurrentVersion != null
48+
&& WPerfOptions.Instance.WperfCurrentVersion.Components[0].ComponentVersion
49+
!= WperfDefaults.WPERF_MIN_VERSION
50+
)
51+
windowTitle += $" - (UNSTABLE)";
52+
}
53+
catch (Exception) { }
4954
Command.Text = windowTitle;
5055
base.BeforeQueryStatus(e);
5156
}

WindowsPerfGUI/Options/WPerfOptions.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,19 +85,20 @@ public void UpdateWperfOptions(WperfVersion wperfVersion, bool hasSPESupport)
8585
#nullable enable
8686
public void UpdateWperfOptions(
8787
WperfVersion wperfVersion,
88-
WperfList? wperfList,
88+
WperfList wperfList,
8989
bool? hasSPESupport
9090
)
9191
{
9292
UpdateWperfVersion(wperfVersion);
93-
if (wperfList != null)
94-
{
95-
WperfList = wperfList;
96-
}
93+
94+
WperfList = wperfList;
95+
9796
if (hasSPESupport != null)
98-
{
9997
HasSPESupport = (bool)hasSPESupport;
100-
}
98+
99+
if (wperfList != null && hasSPESupport != null)
100+
IsWperfInitialized = true;
101+
101102
Save();
102103
}
103104
#nullable disable

WindowsPerfGUI/Options/WPerfPath.xaml.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public void Initialize()
6161
{
6262
SetWperfVersion(WPerfOptions.Instance.WperfCurrentVersion);
6363
SetPredefinedEventsAndMetrics(WPerfOptions.Instance.WperfList);
64+
WPerfVersionCheckIgnore.IsChecked = WPerfOptions.Instance.WperfVersionCheckIgnore;
6465
}
6566

6667
WPerfOptions.Instance.Save();
@@ -76,7 +77,7 @@ private void ValidateButton_Click(object sender, RoutedEventArgs e)
7677
try
7778
{
7879
(WperfVersion versions, string error) = wperf.GetVersion();
79-
wperf.GetTest();
80+
(WperfTest wperfTest, _) = wperf.GetTest();
8081
if (error != "")
8182
throw new Exception(error);
8283
SetWperfVersion(versions, shouldForce: true);
@@ -95,9 +96,10 @@ private void ValidateButton_Click(object sender, RoutedEventArgs e)
9596
(WperfList wperfList, string errorWperfList) = wperf.GetEventList();
9697
if (errorWperfList != "")
9798
throw new Exception(errorWperfList);
99+
98100
SetPredefinedEventsAndMetrics(wperfList, shouldForce: true);
99101
WPerfOptions.Instance.UpdateWperfOptions(versions, wperfList);
100-
WperfDefaults.HasSPESupport = wperf.CheckIsSPESupported();
102+
WperfDefaults.HasSPESupport = wperf.CheckIsSPESupported(versions, wperfTest);
101103
}
102104
catch (Exception ex)
103105
{

WindowsPerfGUI/SDK/WperfClient.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,10 @@ protected void InitProcess()
126126
/// <returns>
127127
/// bool
128128
/// </returns>
129-
public bool CheckIsSPESupported()
129+
public bool CheckIsSPESupported(WperfVersion versionSerializedOutput, WperfTest testSerializedOutput)
130130
{
131131
try
132132
{
133-
(WperfVersion versionSerializedOutput, _) = GetVersion();
134133
foreach (var component in versionSerializedOutput.Components)
135134
{
136135
if (!component.FeatureString.Contains("+spe"))
@@ -139,8 +138,6 @@ public bool CheckIsSPESupported()
139138
}
140139
}
141140

142-
(WperfTest testSerializedOutput, _) = GetTest();
143-
144141
TestResult speDeviceConf = testSerializedOutput
145142
.TestResults.Find(el => el.TestName == "spe_device.version_name");
146143
if (speDeviceConf == null) { return false; }

WindowsPerfGUI/ToolWindows/CountingSetting/CountingSettingDialog.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ System.Windows.Controls.SelectionChangedEventArgs e
386386
string metricName = CountingMetricListBox.SelectedItems[0] as string;
387387

388388
foreach (
389-
var predefinedMetric in ((List<PredefinedMetric>)MetricComboBox.ItemsSource).Select(
389+
var predefinedMetric in ((List<PredefinedMetricAndGroupOfMetrics>)MetricComboBox.ItemsSource).Select(
390390
(value, i) => new { value, i }
391391
)
392392
)

WindowsPerfGUI/Utils/WperfDefaults.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ static class WperfDefaults
4141

4242
public static string DefaultWPASearchDir = Environment.GetEnvironmentVariable(
4343
"WPA_ADDITIONAL_SEARCH_DIRECTORIES"
44-
);
44+
) ?? "C:\\Program Files (x86)\\Windows Kits\\10\\Windows Performance Toolkit\\CustomDataSources";
4545
#nullable disable
4646
}
4747
}

WindowsPerfGUI/WindowsPerfGUIPackage.cs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,22 @@ IProgress<ServiceProgressData> progress
107107
protected override async Task OnAfterPackageLoadedAsync(CancellationToken cancellationToken)
108108
{
109109
bool shouldIgnoreWperfVersion = WPerfOptions.Instance.WperfVersionCheckIgnore;
110-
110+
WperfClientFactory wperfClient = new();
111+
111112
try
112113
{
113-
WperfClientFactory wperfClient = new();
114-
bool speSupport = wperfClient.CheckIsSPESupported();
115-
WperfDefaults.HasSPESupport = speSupport;
116114
(WperfVersion versions, string stdVersionError) = wperfClient.GetVersion();
117-
if (!string.IsNullOrEmpty(stdVersionError)) throw new Exception("Unable to get WindowsPerf version");
115+
(WperfTest wperfTest, _) = wperfClient.GetTest();
116+
117+
bool speSupport = wperfClient.CheckIsSPESupported(versions, wperfTest);
118+
WperfDefaults.HasSPESupport = speSupport;
119+
120+
if (!string.IsNullOrEmpty(stdVersionError))
121+
{
122+
WPerfOptions.Instance.IsWperfInitialized = false;
123+
throw new Exception("Unable to get WindowsPerf version");
124+
}
125+
118126
(WperfList wperfList, string stdListError) = wperfClient.GetEventList();
119127

120128
WPerfOptions.Instance.UpdateWperfOptions(versions, wperfList, speSupport);
@@ -130,9 +138,8 @@ await VS.MessageBox.ShowWarningAsync(
130138
)
131139
);
132140
}
133-
134-
wperfClient.GetTest();
135141
}
142+
136143
catch (Exception e)
137144
{
138145
Trace.WriteLine(e.Message);

WindowsPerfGUI/source.extension.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ internal sealed partial class Vsix
1111
public const string Name = "WindowsPerf GUI";
1212
public const string Description = @"WindowsPerf GUI (Graphical User Interface) project, a Visual Studio 2022 extension designed to bring a seamless UI experience to WindowsPerf, the command-line performance profiling tool for Windows on Arm.";
1313
public const string Language = "en-US";
14-
public const string Version = "3.0.0";
14+
public const string Version = "3.0.1";
1515
public const string Author = "arm";
1616
public const string Tags = "WindowsPerf; WindowsPerfGUI;WindowsOnArm; WOA; Profiling; perf; PMU; Performance";
1717
}

WindowsPerfGUI/source.extension.vsixmanifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
33
<Metadata>
4-
<Identity Id="WindowsPerfGUI.73de2c45-cf60-4edb-a092-b09b43acf2ae" Version="3.0.0" Language="en-US" Publisher="arm" />
4+
<Identity Id="WindowsPerfGUI.73de2c45-cf60-4edb-a092-b09b43acf2ae" Version="3.0.1" Language="en-US" Publisher="arm" />
55
<DisplayName>WindowsPerf GUI</DisplayName>
66
<Description xml:space="preserve">WindowsPerf GUI (Graphical User Interface) project, a Visual Studio 2022 extension designed to bring a seamless UI experience to WindowsPerf, the command-line performance profiling tool for Windows on Arm.</Description>
77
<MoreInfo>https://gitlab.com/Linaro/WindowsPerf/vs-extension</MoreInfo>

0 commit comments

Comments
 (0)