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

Commit fc9ff29

Browse files
committed
WPERF-997 Add groups of metrics and translation strings
See merge request Linaro/WindowsPerf/vs-extension!111 === ChangeLog === * feat: set checkbox label note to always visible * feat: add translation for new strings * feat: update all data on VS start * feat: add groups of metrics to Metric list * fix: extra line in event search box
1 parent 5a1ce59 commit fc9ff29

12 files changed

+196
-28
lines changed

WindowsPerfGUI/Options/WPAOptions.xaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
77
d:DesignHeight="450"
88
d:DesignWidth="800"
9+
Background="white"
910
mc:Ignorable="d">
1011
<ScrollViewer>
1112
<StackPanel>
@@ -34,7 +35,7 @@
3435
<TextBlock
3536
x:Name="EnvironmentVariableNotice"
3637
FontSize="10"
37-
Visibility="Collapsed" />
38+
Text="Note: The default search location is the directory specified by the WPA_ADDITIONAL_SEARCH_DIRECTORIES environment variable." />
3839
</StackPanel>
3940
</StackPanel>
4041
</ScrollViewer>

WindowsPerfGUI/Options/WPAOptions.xaml.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,15 @@ public void Initialize()
5353
if (!string.IsNullOrEmpty(WperfDefaults.DefaultWPASearchDir))
5454
{
5555
checkboxLabel += $": {WperfDefaults.DefaultWPASearchDir}";
56+
}else
57+
{
58+
checkboxLabel += ": Environment variable is not set";
5659
}
5760

5861
UseDefaultSearchLocation.Content = checkboxLabel;
5962

6063
if (!string.IsNullOrEmpty(WperfDefaults.DefaultWPASearchDir))
6164
{
62-
EnvironmentVariableNotice.Visibility = System.Windows.Visibility.Visible;
6365
EnvironmentVariableNotice.Text =
6466
$"WPA_ADDITIONAL_SEARCH_DIRECTORIES=\"{WperfDefaults.DefaultWPASearchDir}\"";
6567
}

WindowsPerfGUI/Resources/Locals/SamplingSettingsLanguagePack.Designer.cs

Lines changed: 36 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

WindowsPerfGUI/Resources/Locals/SamplingSettingsLanguagePack.fr-FR.resx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,4 +195,16 @@
195195
<data name="LoadJSONSamplingButton" xml:space="preserve">
196196
<value>Chargez le fichier JSON dans l'extension</value>
197197
</data>
198+
<data name="SPEEventListBoxHeader" xml:space="preserve">
199+
<value>Filtres de SPE</value>
200+
</data>
201+
<data name="SPEEventComboBoxPlaceholder" xml:space="preserve">
202+
<value>-- Ajouter un Filtre de SPE --</value>
203+
</data>
204+
<data name="SPEEventGroupBoxHeaderLabel" xml:space="preserve">
205+
<value>Filtres de SPE</value>
206+
</data>
207+
<data name="EnableSPECheckBoxText" xml:space="preserve">
208+
<value>Activer mode SPE</value>
209+
</data>
198210
</root>

WindowsPerfGUI/Resources/Locals/SamplingSettingsLanguagePack.pl.resx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,4 +195,16 @@
195195
<data name="LoadJSONSamplingButton" xml:space="preserve">
196196
<value>Załaduj plik JSON do rozszerzenia</value>
197197
</data>
198+
<data name="SPEEventListBoxHeader" xml:space="preserve">
199+
<value>Filtry SPE</value>
200+
</data>
201+
<data name="SPEEventComboBoxPlaceholder" xml:space="preserve">
202+
<value>-- Dodaj filtry SPE --</value>
203+
</data>
204+
<data name="SPEEventGroupBoxHeaderLabel" xml:space="preserve">
205+
<value>Filtry SPE</value>
206+
</data>
207+
<data name="EnableSPECheckBoxText" xml:space="preserve">
208+
<value>Włącz tryb SPE</value>
209+
</data>
198210
</root>

WindowsPerfGUI/Resources/Locals/SamplingSettingsLanguagePack.pt-BR.resx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,4 +195,16 @@
195195
<data name="LoadJSONSamplingButton" xml:space="preserve">
196196
<value>Carregue o arquivo JSON na extensão</value>
197197
</data>
198+
<data name="SPEEventListBoxHeader" xml:space="preserve">
199+
<value>Filtros SPE</value>
200+
</data>
201+
<data name="SPEEventComboBoxPlaceholder" xml:space="preserve">
202+
<value>-- Adicionar filtros SPE --</value>
203+
</data>
204+
<data name="SPEEventGroupBoxHeaderLabel" xml:space="preserve">
205+
<value>Filtros SPE</value>
206+
</data>
207+
<data name="EnableSPECheckBoxText" xml:space="preserve">
208+
<value>Ativar modo SPE</value>
209+
</data>
198210
</root>

WindowsPerfGUI/Resources/Locals/SamplingSettingsLanguagePack.resx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,4 +195,16 @@
195195
<data name="LoadJSONSamplingButton" xml:space="preserve">
196196
<value>Load JSON file into extension</value>
197197
</data>
198+
<data name="SPEEventListBoxHeader" xml:space="preserve">
199+
<value>SPE Filters</value>
200+
</data>
201+
<data name="SPEEventComboBoxPlaceholder" xml:space="preserve">
202+
<value>-- Add SPE Filters --</value>
203+
</data>
204+
<data name="SPEEventGroupBoxHeaderLabel" xml:space="preserve">
205+
<value>SPE Filters</value>
206+
</data>
207+
<data name="EnableSPECheckBoxText" xml:space="preserve">
208+
<value>Enable SPE mode</value>
209+
</data>
198210
</root>

WindowsPerfGUI/SDK/WperfOutputs/WperfList.cs

Lines changed: 60 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
using Newtonsoft.Json;
3232
using System.Collections.Generic;
3333
using System.Linq;
34+
using System.Reflection.Emit;
3435

3536
namespace WindowsPerfGUI.SDK.WperfOutputs
3637
{
@@ -74,9 +75,9 @@ public List<PredefinedEvent> PredefinedEvents
7475
{
7576
predefinedEvents = value.Where(e => e.EventType != "[Kernel PMU event]" && e.EventType != "[SPE filter]").ToList();
7677
List<PredefinedEvent> _speFilters = value.Where(e => e.EventType == "[SPE filter]").ToList();
77-
78+
7879
if (_speFilters.Count == 0) _speFilters = defaultPredefinedSPEFilters;
79-
80+
8081
PredefinedSPEFilters = _speFilters;
8182
}
8283
}
@@ -98,8 +99,65 @@ public List<PredefinedEvent> PredefinedEvents
9899

99100
[JsonProperty("Predefined_Metrics")]
100101
public List<PredefinedMetric> PredefinedMetrics { get; set; }
102+
103+
[JsonProperty("Predefined_Groups_of_Metrics")]
104+
public List<PredefinedGroupsOfMetric> PredefinedGroupsOfMetrics { get; set; }
105+
106+
107+
public List<PredefinedMetricAndGroupOfMetrics> PredefinedMetricsAndGroupsOfMetrics
108+
{
109+
get
110+
{
111+
List<PredefinedMetricAndGroupOfMetrics> metricsAndGroupsOfMetrics = new List<PredefinedMetricAndGroupOfMetrics>();
112+
foreach (var predefinedMetric in PredefinedMetrics)
113+
{
114+
metricsAndGroupsOfMetrics.Add(new PredefinedMetricAndGroupOfMetrics()
115+
{
116+
Label = predefinedMetric.ToString(),
117+
Metric = predefinedMetric.Metric
118+
});
119+
}
120+
foreach (var predefinedGroupOfMetric in PredefinedGroupsOfMetrics)
121+
{
122+
metricsAndGroupsOfMetrics.Add(new PredefinedMetricAndGroupOfMetrics()
123+
{
124+
Label = predefinedGroupOfMetric.ToString(),
125+
Metric = predefinedGroupOfMetric.Group
126+
});
127+
}
128+
return metricsAndGroupsOfMetrics;
129+
}
130+
}
131+
132+
public class PredefinedMetricAndGroupOfMetrics
133+
{
134+
public string Metric { get; set; }
135+
public string Label { get; set; }
136+
public override string ToString()
137+
{
138+
return Label;
139+
140+
}
141+
}
142+
}
143+
144+
public partial class PredefinedGroupsOfMetric
145+
{
146+
[JsonProperty("Group")]
147+
public string Group { get; set; }
148+
149+
[JsonProperty("Metrics")]
150+
public string Metrics { get; set; }
151+
152+
[JsonProperty("Description")]
153+
public string Description { get; set; }
154+
public override string ToString()
155+
{
156+
return $"{Group} | {{{Metrics}}}";
157+
}
101158
}
102159

160+
103161
public partial class PredefinedEvent
104162
{
105163
[JsonProperty("Alias_Name")]

WindowsPerfGUI/ToolWindows/CountingSetting/CountingSettingDialog.xaml.cs

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
using WindowsPerfGUI.ToolWindows.SamplingSetting;
4848
using WindowsPerfGUI.Utils;
4949
using WindowsPerfGUI.Utils.ListSearcher;
50+
using static WindowsPerfGUI.SDK.WperfOutputs.WperfList;
5051

5152
namespace WindowsPerfGUI.ToolWindows.CountingSetting
5253
{
@@ -61,14 +62,8 @@ public CountingSettingDialog()
6162
OpenInWPAButton.IsEnabled = !string.IsNullOrEmpty(WperfClient.OutputPath);
6263
SaveAsButton.IsEnabled = OpenInWPAButton.IsEnabled;
6364
StopCountingButton.IsEnabled = false;
64-
var metricList = new List<PredefinedMetric>(
65-
WPerfOptions.Instance.WperfList.PredefinedMetrics
66-
);
67-
var eventList = new List<PredefinedEvent>(
68-
WPerfOptions.Instance.WperfList.PredefinedEvents
69-
);
70-
EventComboBox.ItemsSource = eventList;
71-
MetricComboBox.ItemsSource = metricList;
65+
ResetMetricComboBox();
66+
ResetEventComboBox();
7267
CpuCoresGrid.ItemsSource = CpuCores.InitCpuCores();
7368
ProjectTargetConfigLabel.Content = SolutionProjectOutput.SelectedConfigLabel;
7469
if (CountingSettings.countingSettingsForm.FilePath != null)
@@ -98,6 +93,8 @@ public CountingSettingDialog()
9893
wperfClient.OnCountingFinished += HandleCountingFinished;
9994
}
10095

96+
97+
10198
private void HandleCountingFinished(
10299
object sender,
103100
(List<CountingEvent> countingEvents, string stdError) e
@@ -247,7 +244,7 @@ private void EventComboBox_PreviewKeyUp(object sender, System.Windows.Input.KeyE
247244
else
248245
{
249246
EventComboBoxPlaceholder.Visibility = Visibility.Visible;
250-
EventComboBox.ItemsSource = WPerfOptions.Instance.WperfList.PredefinedEvents;
247+
ResetEventComboBox();
251248
}
252249
}
253250

@@ -256,7 +253,7 @@ private void AddEventButton_Click(object sender, RoutedEventArgs e)
256253
var newCountingEvent = (EventComboBox.SelectedItem as PredefinedEvent)?.AliasName;
257254

258255
EventComboBox.SelectedIndex = -1;
259-
EventComboBox.ItemsSource = WPerfOptions.Instance.WperfList.PredefinedEvents;
256+
ResetEventComboBox();
260257

261258
foreach (
262259
var item in CountingSettings.countingSettingsForm.CountingEventList.Select(
@@ -405,10 +402,9 @@ var predefinedMetric in ((List<PredefinedMetric>)MetricComboBox.ItemsSource).Sel
405402

406403
private void AddMetricButton_Click(object sender, RoutedEventArgs e)
407404
{
408-
var newCountingMetric = (MetricComboBox.SelectedItem as PredefinedMetric)?.Metric;
405+
var newCountingMetric = (MetricComboBox.SelectedItem as PredefinedMetricAndGroupOfMetrics)?.Metric;
409406

410-
MetricComboBox.SelectedIndex = -1;
411-
MetricComboBox.ItemsSource = WPerfOptions.Instance.WperfList.PredefinedMetrics;
407+
ResetMetricComboBox();
412408

413409
foreach (
414410
var item in CountingSettings.countingSettingsForm.CountingMetricList.Select(
@@ -429,7 +425,20 @@ var item in CountingSettings.countingSettingsForm.CountingMetricList.Select(
429425
CountingSettings.countingSettingsForm.CountingMetricList.Add(newCountingMetric);
430426
MetricComboBoxPlaceholder.Visibility = Visibility.Visible;
431427
}
432-
428+
private void ResetEventComboBox()
429+
{
430+
var eventList = new List<PredefinedEvent>(
431+
WPerfOptions.Instance.WperfList.PredefinedEvents
432+
);
433+
EventComboBox.ItemsSource = eventList;
434+
}
435+
private void ResetMetricComboBox ()
436+
{
437+
var metricList = new List<PredefinedMetricAndGroupOfMetrics>(
438+
WPerfOptions.Instance.WperfList.PredefinedMetricsAndGroupsOfMetrics
439+
);
440+
MetricComboBox.ItemsSource = metricList;
441+
}
433442
private void RemoveMetricButton_Click(object sender, RoutedEventArgs e)
434443
{
435444
int selectedIndex = CountingMetricListBox.SelectedIndex;

WindowsPerfGUI/ToolWindows/SamplingSetting/SamplingSettingDialog.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
Checked="CheckBox_Checked"
108108
IsChecked="{Binding IsSPEEnabled, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
109109
Unchecked="CheckBox_Unchecked">
110-
<TextBlock Text="Enable SPE mode" TextWrapping="Wrap" />
110+
<TextBlock Text="{x:Static locals:SamplingSettingsLanguagePack.EnableSPECheckBoxText}" TextWrapping="Wrap" />
111111
</CheckBox>
112112
<CheckBox Margin="0,5,0,0" IsChecked="{Binding ForceLock, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}">
113113
<TextBlock Text="{x:Static locals:MainLanguagePack.ForceLock}" TextWrapping="Wrap" />

0 commit comments

Comments
 (0)