Browse Source

Added missing resource strings for the profiler

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@4879 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Siegfried Pammer 16 years ago
parent
commit
eec0d0d072
  1. 1
      src/AddIns/Misc/Profiler/Frontend/AddIn/AddIn.csproj
  2. 6
      src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Commands/FindCallsOfSelected.cs
  3. 22
      src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Commands/RunTestWithProfilerCommand.cs
  4. 4
      src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Commands/SetAsRoot.cs
  5. 3
      src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Commands/ShowFunctions.cs
  6. 22
      src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Dialogs/ProfileExecutableForm.xaml
  7. 2
      src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Dialogs/ProfileExecutableForm.xaml.cs
  8. 22
      src/AddIns/Misc/Profiler/Frontend/AddIn/Src/ProfilerRunner.cs
  9. 78
      src/AddIns/Misc/Profiler/Frontend/AddIn/Src/SharpDevelopTranslation.cs
  10. 14
      src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Views/ProfilerView.xaml
  11. 11
      src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Views/ProfilerView.xaml.cs
  12. 10
      src/AddIns/Misc/Profiler/Frontend/Controls/CallTreeNodeViewModel.cs
  13. 84
      src/AddIns/Misc/Profiler/Frontend/Controls/ControlsTranslation.cs
  14. 30
      src/AddIns/Misc/Profiler/Frontend/Controls/QueryView.xaml
  15. 8
      src/AddIns/Misc/Profiler/Frontend/Controls/QueryView.xaml.cs
  16. 14
      src/AddIns/Misc/Profiler/Frontend/Controls/RingDiagramControl.cs

1
src/AddIns/Misc/Profiler/Frontend/AddIn/AddIn.csproj

@ -71,6 +71,7 @@ @@ -71,6 +71,7 @@
<SubType>Code</SubType>
</Compile>
<Compile Include="Src\ProfilerRunner.cs" />
<Compile Include="Src\SharpDevelopTranslation.cs" />
<Compile Include="Src\Views\ProfilerView.xaml.cs">
<DependentUpon>ProfilerView.xaml</DependentUpon>
</Compile>

6
src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Commands/FindCallsOfSelected.cs

@ -30,9 +30,9 @@ namespace ICSharpCode.Profiler.AddIn.Commands @@ -30,9 +30,9 @@ namespace ICSharpCode.Profiler.AddIn.Commands
/// </summary>
public override void Run()
{
var list = GetSelectedItems().ToList();
var list = GetSelectedItems();
if (list.Count > 0) {
if (list.Any()) {
var items = from item in list select item.Node;
List<string> parts = new List<string>();
@ -44,7 +44,7 @@ namespace ICSharpCode.Profiler.AddIn.Commands @@ -44,7 +44,7 @@ namespace ICSharpCode.Profiler.AddIn.Commands
}
}
string header = "Results";
string header = StringParser.Parse("${res:AddIns.Profiler.Commands.FindCallsOfSelected.TabTitle}");
Parent.CreateTab(header, "from c in Calls where " + string.Join(" || ", parts.ToArray()) + " select c");
}

22
src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Commands/RunTestWithProfilerCommand.cs

@ -20,6 +20,8 @@ namespace ICSharpCode.Profiler.AddIn.Commands @@ -20,6 +20,8 @@ namespace ICSharpCode.Profiler.AddIn.Commands
{
public class RunTestWithProfilerCommand : AbstractRunTestCommand
{
ProfilerRunner runner;
protected override void RunTests(UnitTestApplicationStartHelper helper)
{
TestRunnerCategory.AppendLine(helper.GetCommandLine());
@ -32,7 +34,7 @@ namespace ICSharpCode.Profiler.AddIn.Commands @@ -32,7 +34,7 @@ namespace ICSharpCode.Profiler.AddIn.Commands
startInfo.WorkingDirectory = UnitTestApplicationStartHelper.UnitTestApplicationDirectory;
LoggingService.Info("starting profiler...");
ProfilerRunner runner = new ProfilerRunner(startInfo, true, new ProfilingDataSQLiteWriter(path, true, GetUnitTestNames(helper).ToArray()));
runner = new ProfilerRunner(startInfo, true, new ProfilingDataSQLiteWriter(path, true, GetUnitTestNames(helper).ToArray()));
runner.RunFinished += delegate {
WorkbenchSingleton.SafeThreadCall(() => FileService.OpenFile(path));
@ -72,22 +74,12 @@ namespace ICSharpCode.Profiler.AddIn.Commands @@ -72,22 +74,12 @@ namespace ICSharpCode.Profiler.AddIn.Commands
LoggingService.Info("shutting profiler down...");
}
public override void Run()
{
// if (ProfilerService.IsProfilerLoaded && ProfilerService.CurrentProfiler.IsRunning) {
// MessageService.ShowError("Currently there is a profiling session in progress. " +
// "Please finish the current session before starting a new one.");
// } else {
base.Run();
// }
}
protected override void OnStop()
{
// if (ProfilerService.CurrentProfiler.IsRunning) {
// LoggingService.Info("stopping profiler...");
// ProfilerService.CurrentProfiler.Stop();
// }
if (this.runner != null && this.runner.Profiler.IsRunning) {
LoggingService.Info("stopping profiler...");
runner.Stop();
}
}
}
}

4
src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Commands/SetAsRoot.cs

@ -44,9 +44,9 @@ namespace ICSharpCode.Profiler.AddIn.Commands @@ -44,9 +44,9 @@ namespace ICSharpCode.Profiler.AddIn.Commands
parts.Add("GetNodeByPath(" + string.Join(",", path.Select(i => i.ToString()).ToArray()) + ")");
}
string header = "Merged Nodes: " + items.First().Name;
string header = string.Format(StringParser.Parse("${res:AddIns.Profiler.Commands.SetAsRoot.TabTitle}:"), items.First().Name);
if (nameId == null)
header = "Merged Nodes";
header = StringParser.Parse("${res:AddIns.Profiler.Commands.SetAsRoot.TabTitle}:");
Parent.CreateTab(header, "Merge(" + string.Join(",", parts.ToArray()) + ")");
}

3
src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Commands/ShowFunctions.cs

@ -29,9 +29,8 @@ namespace ICSharpCode.Profiler.AddIn.Commands @@ -29,9 +29,8 @@ namespace ICSharpCode.Profiler.AddIn.Commands
public override void Run()
{
var selectedItem = GetSelectedItems().FirstOrDefault();
if (selectedItem != null)
Parent.CreateTab("All functions for " + selectedItem.GetSignature(),
Parent.CreateTab(string.Format(StringParser.Parse("${res:AddIns.Profiler.Commands.ShowFunctions.TabTitle}"), selectedItem.GetSignature()),
"from f in Functions where f.Signature == \"" + selectedItem.GetSignature() + "\" select f");
}
}

22
src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Dialogs/ProfileExecutableForm.xaml

@ -1,11 +1,12 @@ @@ -1,11 +1,12 @@
<Window x:Class="ICSharpCode.Profiler.AddIn.Dialogs.ProfileExecutableForm"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Profile executable" WindowStartupLocation="CenterScreen"
xmlns:sd="http://icsharpcode.net/sharpdevelop/core"
Title="{sd:Localize AddIns.Profiler.ProfileExecutableForm.Title}" WindowStartupLocation="CenterScreen"
WindowStyle="ToolWindow" ShowInTaskbar="False" ResizeMode="NoResize" SizeToContent="WidthAndHeight">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
@ -13,24 +14,21 @@ @@ -13,24 +14,21 @@
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock TextWrapping="Wrap" Grid.ColumnSpan="3" Margin="3">
Select the path of the executable you want to profile.<LineBreak />
Optionally you can specify working directory and command line arguments to start the process.
</TextBlock>
<Label Grid.Row="1">Path to executable:</Label>
<TextBlock TextWrapping="Wrap" Grid.ColumnSpan="3" Margin="3" Text="{sd:Localize AddIns.Profiler.ProfileExecutableForm.DescriptionText}" />
<Label Grid.Row="1" Content="{sd:Localize AddIns.Profiler.ProfileExecutableForm.ExePathText}" />
<TextBox Margin="3" Name="txtExePath" Grid.Column="1" Grid.Row="1" />
<Button Margin="3" Padding="5,0,5,0" Grid.Column="2" Grid.Row="1" Click="btnSelectFileClick">...</Button>
<Label Grid.Row="2">Working directory:</Label>
<Label Grid.Row="2" Content="{sd:Localize AddIns.Profiler.ProfileExecutableForm.WorkingDirText}" />
<TextBox Margin="3" Name="txtWorkingDir" Grid.Row="2" Grid.Column="1" />
<Button Margin="3" Padding="5,0,5,0" Grid.Column="2" Grid.Row="2" Click="btnSelectDirClick">...</Button>
<Label Grid.Row="3">Command-Line Arguments:</Label>
<Label Grid.Row="3" Content="{sd:Localize AddIns.Profiler.ProfileExecutableForm.CmdLineArgsText}" />
<TextBox Margin="3" Name="txtArgs" Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="3" />
<StackPanel Grid.ColumnSpan="3" Grid.Row="4" Orientation="Horizontal" HorizontalAlignment="Center">
<Button Margin="3" Padding="5,0,5,0" Click="btnStartClick">Start Profiling</Button>
<Button Margin="3" Padding="5,0,5,0" Click="btnCancelClick">Cancel</Button>
<Button Margin="3" Padding="5,0,5,0" Click="btnStartClick" Content="{sd:Localize AddIns.Profiler.ProfileExecutableForm.StartText}" />
<Button Margin="3" Padding="5,0,5,0" Click="btnCancelClick" Content="{sd:Localize Global.CancelButtonText}" />
</StackPanel>
</Grid>
</Window>

2
src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Dialogs/ProfileExecutableForm.xaml.cs

@ -60,7 +60,7 @@ namespace ICSharpCode.Profiler.AddIn.Dialogs @@ -60,7 +60,7 @@ namespace ICSharpCode.Profiler.AddIn.Dialogs
MessageService.ShowError(ex.Message);
}
} catch (ArgumentNullException) {
MessageService.ShowError("Invalid data, please try again!");
MessageService.ShowError(StringParser.Parse("${res:AddIns.Profiler.ProfileExecutable.ErrorMessage}"));
} catch (FileNotFoundException ex) {
MessageService.ShowError(ex.Message);
} catch (DirectoryNotFoundException ex2) {

22
src/AddIns/Misc/Profiler/Frontend/AddIn/Src/ProfilerRunner.cs

@ -65,9 +65,8 @@ namespace ICSharpCode.Profiler.AddIn @@ -65,9 +65,8 @@ namespace ICSharpCode.Profiler.AddIn
}
PrintProfilerOptions();
this.profiler.RegisterFailed += delegate { MessageService.ShowError("Could not register the profiler into COM Registry. Cannot start profiling!"); };
this.profiler.DeregisterFailed += delegate { MessageService.ShowError("Could not unregister the profiler from COM Registry!"); };
this.profiler.RegisterFailed += delegate { MessageService.ShowError("${res:AddIns.Profiler.Messages.RegisterFailed}"); };
this.profiler.DeregisterFailed += delegate { MessageService.ShowError("${res:AddIns.Profiler.Messages.UnregisterFailed}"); };
this.profiler.OutputUpdated += delegate { SetOutputText(profiler.ProfilerOutput); };
this.profiler.SessionEnded += delegate { FinishSession(); };
}
@ -84,7 +83,7 @@ namespace ICSharpCode.Profiler.AddIn @@ -84,7 +83,7 @@ namespace ICSharpCode.Profiler.AddIn
void FinishSession()
{
using (AsynchronousWaitDialog dlg = AsynchronousWaitDialog.ShowWaitDialog("Preparing for analysis", true)) {
using (AsynchronousWaitDialog dlg = AsynchronousWaitDialog.ShowWaitDialog(StringParser.Parse("${res:AddIns.Profiler.Messages.PreparingForAnalysis}"), true)) {
profiler.Dispose();
WorkbenchSingleton.SafeThreadAsyncCall(() => { controlWindow.AllowClose = true; this.controlWindow.Close(); });
@ -122,18 +121,17 @@ namespace ICSharpCode.Profiler.AddIn @@ -122,18 +121,17 @@ namespace ICSharpCode.Profiler.AddIn
return null;
if (!currentProj.IsStartable) {
if (MessageService.AskQuestion("This project cannot be started. Do you want to profile the solution's StartUp project instead?")) {
if (MessageService.AskQuestion("${res:AddIns.Profiler.Messages.NoStartableProjectWantToProfileStartupProject}")) {
currentProj = ProjectService.OpenSolution.StartupProject as AbstractProject;
if (currentProj == null) {
MessageService.ShowError("No startable project was found. Aborting ...");
MessageService.ShowError("${res:AddIns.Profiler.Messages.NoStartableProjectFound}");
return null;
}
} else
return null;
}
if (!File.Exists(currentProj.OutputAssemblyFullPath)) {
MessageService.ShowError("This project cannot be started because the executable file was not found, " +
"please ensure that the project and all its depencies are built correctly!");
MessageService.ShowError("${res:AddIns.Profiler.Messages.FileNotFound}");
return null;
}
@ -147,26 +145,26 @@ namespace ICSharpCode.Profiler.AddIn @@ -147,26 +145,26 @@ namespace ICSharpCode.Profiler.AddIn
static void EnsureProfileCategory()
{
if (profileCategory == null) {
MessageViewCategory.Create(ref profileCategory, "Profile", "Profile");
MessageViewCategory.Create(ref profileCategory, "Profile", StringParser.Parse("${res:AddIns.Profiler.MessageViewCategory}"));
}
}
public static void SetOutputText(string text)
{
EnsureProfileCategory();
profileCategory.SetText(text);
profileCategory.SetText(StringParser.Parse(text));
}
public static void AppendOutputText(string text)
{
EnsureProfileCategory();
profileCategory.AppendText(text);
profileCategory.AppendText(StringParser.Parse(text));
}
public static void AppendOutputLine(string text)
{
EnsureProfileCategory();
profileCategory.AppendLine(text);
profileCategory.AppendLine(StringParser.Parse(text));
}
#endregion
}

78
src/AddIns/Misc/Profiler/Frontend/AddIn/Src/SharpDevelopTranslation.cs

@ -0,0 +1,78 @@ @@ -0,0 +1,78 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Siegfried Pammer" email="siegfriedpammer@gmail.com"/>
// <version>$Revision$</version>
// </file>
using ICSharpCode.Core;
using System;
using ICSharpCode.Profiler.Controls;
namespace ICSharpCode.Profiler.AddIn
{
/// <summary>
/// Description of SharpDevelopTranslation.
/// </summary>
public class SharpDevelopTranslation : ControlsTranslation
{
public override string WaitBarText {
get { return StringParser.Parse("${res:AddIns.Profiler.ProfilingView.WaitBarText}"); }
}
public override string NameColumnText {
get { return StringParser.Parse("${res:AddIns.Profiler.ProfilingView.NameColumnText}"); }
}
public override string CallCountColumnText {
get { return StringParser.Parse("${res:AddIns.Profiler.ProfilingView.CallCountColumnText}"); }
}
public override string CallsText {
get { return StringParser.Parse("${res:AddIns.Profiler.ProfilingView.CallsText}"); }
}
public override string CpuCyclesText {
get { return StringParser.Parse("${res:AddIns.Profiler.ProfilingView.CpuCyclesText}"); }
}
public override string ExecuteQueryText {
get { return StringParser.Parse("${res:AddIns.Profiler.ProfilingView.ExecuteQueryText}"); }
}
public override string ExpandHotPathSubtreeText {
get { return StringParser.Parse("${res:AddIns.Profiler.ProfilingView.ExpandHotPathSubtreeText}"); }
}
public override string SearchLabelText {
get { return StringParser.Parse("${res:AddIns.Profiler.ProfilingView.SearchLabelText}"); }
}
public override string ShowQueryBarText {
get { return StringParser.Parse("${res:AddIns.Profiler.ProfilingView.ShowQueryBarText}"); }
}
public override string TimePercentageOfParentColumnText {
get { return StringParser.Parse("${res:AddIns.Profiler.ProfilingView.TimePercentageOfParentColumnText}"); }
}
public override string TimeSpentColumnText {
get { return StringParser.Parse("${res:AddIns.Profiler.ProfilingView.TimeSpentColumnText}"); }
}
public override string TimeSpentPerCallColumnText {
get { return StringParser.Parse("${res:AddIns.Profiler.ProfilingView.TimeSpentPerCallColumnText}"); }
}
public override string TimeSpentSelfColumnText {
get { return StringParser.Parse("${res:AddIns.Profiler.ProfilingView.TimeSpentSelfColumnText}"); }
}
public override string TimeSpentSelfPerCallColumnText {
get { return StringParser.Parse("${res:AddIns.Profiler.ProfilingView.TimeSpentSelfPerCallColumnText}"); }
}
public override string TimeText {
get { return StringParser.Parse("${res:AddIns.Profiler.ProfilingView.TimeText}"); }
}
}
}

14
src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Views/ProfilerView.xaml

@ -1,6 +1,7 @@ @@ -1,6 +1,7 @@
<UserControl x:Class="ICSharpCode.Profiler.AddIn.Views.ProfilerView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sd="http://icsharpcode.net/sharpdevelop/core"
xmlns:y="clr-namespace:ICSharpCode.Profiler.Controls;assembly=ICSharpCode.Profiler.Controls"
xmlns:local="clr-namespace:ICSharpCode.Profiler.AddIn.Views">
<UserControl.Resources>
@ -29,21 +30,20 @@ @@ -29,21 +30,20 @@
</ScrollViewer>
<ToolBar Height="27" Name="toolBar1" VerticalAlignment="Top">
<Menu>
<MenuItem Name="mnuQueryHistory" Header="Query History">
<MenuItem Name="mnuClearQueryHistory" Header="Clear History" Click="mnuClearQueryHistoryClick" />
<MenuItem Name="mnuQueryHistory" Header="{sd:Localize AddIns.Profiler.ProfilingView.QueryHistoryText}">
<MenuItem Name="mnuClearQueryHistory" Header="{sd:Localize AddIns.Profiler.ProfilingView.ClearQueryHistoryText}" Click="ClearQueryHistoryClick" />
<Separator />
</MenuItem>
</Menu>
</ToolBar>
<TabControl Name="tabView" HorizontalAlignment="Stretch" Margin="0,120,0,0" SelectionChanged="tabView_SelectionChanged">
<TabItem Header="Overview">
<TabControl Name="tabView" HorizontalAlignment="Stretch" Margin="0,120,0,0" SelectionChanged="TabViewSelectionChanged">
<TabItem Header="{sd:Localize AddIns.Profiler.ProfilingView.OverviewTabText}">
<y:QueryView x:Name="treeView" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ShowQueryItems="False" CurrentQuery="from t in Threads select t" IsQueryModifiable="False" />
</TabItem>
<TabItem Header="Top 20">
<TabItem Header="{sd:Localize AddIns.Profiler.ProfilingView.Top20TabText}">
<y:QueryView x:Name="top20View" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ShowQueryItems="False" CurrentQuery="(from f in Functions where f.CallCount > 0 &amp;&amp; f.IsUserCode orderby f.CpuCyclesSpentSelf descending select f).Take(20)" IsQueryModifiable="False" />
</TabItem>
<TabItem Name="dummyTab" Header="">
</TabItem>
<TabItem Name="dummyTab" />
</TabControl>
</Grid>
</UserControl>

11
src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Views/ProfilerView.xaml.cs

@ -33,11 +33,14 @@ namespace ICSharpCode.Profiler.AddIn.Views @@ -33,11 +33,14 @@ namespace ICSharpCode.Profiler.AddIn.Views
this.timeLine.SelectedStartIndex = 0;
this.timeLine.SelectedEndIndex = this.timeLine.ValuesList.Count;
var translation = new SharpDevelopTranslation();
foreach (TabItem item in this.tabView.Items) {
if (item.Content != null) {
QueryView view = item.Content as QueryView;
view.Reporter = new ErrorReporter(UpdateErrorList);
view.Provider = provider;
view.Translation = translation;
view.SetRange(this.timeLine.SelectedStartIndex, this.timeLine.SelectedEndIndex);
view.ContextMenuOpening += delegate(object sender, ContextMenuEventArgs e) {
object source = (e.OriginalSource is Shape) ? e.OriginalSource : view;
@ -87,7 +90,7 @@ namespace ICSharpCode.Profiler.AddIn.Views @@ -87,7 +90,7 @@ namespace ICSharpCode.Profiler.AddIn.Views
e.CanExecute = this.timeLine.IsEnabled && this.timeLine.ValuesList.Count > 0;
}
void closeButton_Click(object sender, RoutedEventArgs e)
void CloseButtonClick(object sender, RoutedEventArgs e)
{
int index = tabView.Items.IndexOf(((Button)sender).Tag);
if (index == tabView.SelectedIndex)
@ -108,7 +111,7 @@ namespace ICSharpCode.Profiler.AddIn.Views @@ -108,7 +111,7 @@ namespace ICSharpCode.Profiler.AddIn.Views
);
}
void tabView_SelectionChanged(object sender, SelectionChangedEventArgs e)
void TabViewSelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (dummyTab.IsSelected)
Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)(() => CreateTab("New Tab", string.Empty)));
@ -168,7 +171,7 @@ namespace ICSharpCode.Profiler.AddIn.Views @@ -168,7 +171,7 @@ namespace ICSharpCode.Profiler.AddIn.Views
newTab.Header = new StackPanel { Orientation = Orientation.Horizontal, Children = { header, closeButton } };
closeButton.Click += new RoutedEventHandler(closeButton_Click);
closeButton.Click += new RoutedEventHandler(CloseButtonClick);
closeButton.Tag = newTab;
QueryView view;
@ -225,7 +228,7 @@ namespace ICSharpCode.Profiler.AddIn.Views @@ -225,7 +228,7 @@ namespace ICSharpCode.Profiler.AddIn.Views
return index;
}
void mnuClearQueryHistoryClick(object sender, RoutedEventArgs e)
void ClearQueryHistoryClick(object sender, RoutedEventArgs e)
{
while (mnuQueryHistory.Items.Count > 2)
mnuQueryHistory.Items.RemoveAt(2);

10
src/AddIns/Misc/Profiler/Frontend/Controls/CallTreeNodeViewModel.cs

@ -140,7 +140,7 @@ namespace ICSharpCode.Profiler.Controls @@ -140,7 +140,7 @@ namespace ICSharpCode.Profiler.Controls
return text;
}
public object CreateToolTip()
public object CreateToolTip(ControlsTranslation translation)
{
if (node.IsThread)
return Name; // only name for threads
@ -151,11 +151,11 @@ namespace ICSharpCode.Profiler.Controls @@ -151,11 +151,11 @@ namespace ICSharpCode.Profiler.Controls
((!string.IsNullOrEmpty(node.ReturnType)) ? node.ReturnType + " " : ""),
new Bold { Inlines = { node.Name } },
"(" + ((node.Parameters.Count > 0) ? string.Join(", ", node.Parameters.ToArray()) : "") + ")\n",
new Bold { Inlines = { "CPU Cycles:" } },
new Bold { Inlines = { translation.CpuCyclesText } },
" " + node.CpuCyclesSpent + "\n",
new Bold { Inlines = { "Time:" } },
new Bold { Inlines = { translation.TimeText } },
" " + node.TimeSpent.ToString("f6") + "ms\n",
new Bold { Inlines = { "Calls:" } },
new Bold { Inlines = { translation.CallsText } },
" " + node.CallCount.ToString()
}
};
@ -382,7 +382,6 @@ namespace ICSharpCode.Profiler.Controls @@ -382,7 +382,6 @@ namespace ICSharpCode.Profiler.Controls
}
#region IViewModel<CallTreeNodeViewModel> Member
int visibleElementCount = 1;
public virtual int VisibleElementCount
@ -397,7 +396,6 @@ namespace ICSharpCode.Profiler.Controls @@ -397,7 +396,6 @@ namespace ICSharpCode.Profiler.Controls
return new Thickness((level - 1) * 12, 0, 2, 0);
}
}
#endregion
}
}

84
src/AddIns/Misc/Profiler/Frontend/Controls/ControlsTranslation.cs

@ -18,5 +18,89 @@ namespace ICSharpCode.Profiler.Controls @@ -18,5 +18,89 @@ namespace ICSharpCode.Profiler.Controls
return "Refreshing view, please wait ...";
}
}
public virtual string NameColumnText {
get {
return "Name";
}
}
public virtual string CallCountColumnText {
get {
return "Call count";
}
}
public virtual string TimeSpentColumnText {
get {
return "Time spent";
}
}
public virtual string TimeSpentSelfColumnText {
get {
return "Time spent (self)";
}
}
public virtual string TimeSpentPerCallColumnText {
get {
return "Time spent/call";
}
}
public virtual string TimeSpentSelfPerCallColumnText {
get {
return "Time spent (self)/call";
}
}
public virtual string TimePercentageOfParentColumnText {
get {
return "% of parent";
}
}
public virtual string SearchLabelText {
get {
return "Search:";
}
}
public virtual string ShowQueryBarText {
get {
return "Show query bar";
}
}
public virtual string ExecuteQueryText {
get {
return "Execute query";
}
}
public virtual string ExpandHotPathSubtreeText {
get {
return "Expand selected hot path";
}
}
public virtual string CpuCyclesText {
get {
return "CPU cycles:";
}
}
public virtual string TimeText {
get {
return "Time:";
}
}
public virtual string CallsText {
get {
return "Calls:";
}
}
}
}

30
src/AddIns/Misc/Profiler/Frontend/Controls/QueryView.xaml

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
<UserControl x:Class="ICSharpCode.Profiler.Controls.QueryView"
<UserControl x:Class="ICSharpCode.Profiler.Controls.QueryView" x:Name="queryView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:ICSharpCode.Profiler.Controls">
@ -71,7 +71,7 @@ @@ -71,7 +71,7 @@
<local:TreeListView x:Name="treeView" Grid.Row="2" SelectionMode="Extended">
<ListView.View>
<local:CustomGridView>
<GridViewColumn Header="Name" Width="240" x:Name="nameColumn">
<GridViewColumn Header="{Binding Translation.NameColumnText, ElementName=queryView}" Width="240" x:Name="nameColumn">
<GridViewColumn.CellTemplate>
<DataTemplate>
<local:CustomGridViewScrollableCell CurrentScrollPosition="{Binding ElementName=treeView, Path=View.CurrentScrollPosition}">
@ -84,42 +84,42 @@ @@ -84,42 +84,42 @@
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="Call count" Width="60" x:Name="callCountColumn">
<GridViewColumn Header="{Binding Translation.CallCountColumnText, ElementName=queryView}" Width="60" x:Name="callCountColumn">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding CallCount}" HorizontalAlignment="Right" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="Time spent" Width="110" x:Name="timeSpentColumn">
<GridViewColumn Header="{Binding Translation.TimeSpentColumnText, ElementName=queryView}" Width="110" x:Name="timeSpentColumn">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock HorizontalAlignment="Right" Text="{Binding TimeSpent}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="Time spent (self)" Width="110" x:Name="timeSpentSelfColumn">
<GridViewColumn Header="{Binding Translation.TimeSpentSelfColumnText, ElementName=queryView}" Width="110" x:Name="timeSpentSelfColumn">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock HorizontalAlignment="Right" Text="{Binding TimeSpentSelf}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="Time spent/call" Width="110" x:Name="timeSpentPerCallColumn">
<GridViewColumn Header="{Binding Translation.TimeSpentPerCallColumnText, ElementName=queryView}" Width="110" x:Name="timeSpentPerCallColumn">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock HorizontalAlignment="Right" Text="{Binding TimeSpentPerCall}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="Time spent (self)/call" Width="110" x:Name="timeSpentSelfPerCallColumn">
<GridViewColumn Header="{Binding Translation.TimeSpentSelfPerCallColumnText, ElementName=queryView}" Width="110" x:Name="timeSpentSelfPerCallColumn">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock HorizontalAlignment="Right" Text="{Binding TimeSpentSelfPerCall}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="% of parent" Width="80" x:Name="percentColumn">
<GridViewColumn Header="{Binding Translation.TimePercentageOfParentColumnText, ElementName=queryView}" Width="80" x:Name="percentColumn">
<GridViewColumn.CellTemplate>
<DataTemplate>
<DockPanel LastChildFill="false">
@ -139,18 +139,18 @@ @@ -139,18 +139,18 @@
</ListView.ItemContainerStyle>
</local:TreeListView>
<ToolBar Height="26" Grid.Row="0" Grid.ColumnSpan="2">
<Label>Search:</Label>
<TextBox Name="txtSearch" Width="150" KeyDown="txtSearchKeyDown"></TextBox>
<CheckBox Content="Show Query Bar" IsChecked="{Binding ShowQueryItems}" />
<Button Content="Expand hot path in selected subtree" Name="btnExpandHotPathSubtree" Click="BtnExpandHotPathSubtreeClick" />
<Label Content="{Binding Translation.SearchLabelText, ElementName=queryView}" />
<TextBox Name="txtSearch" Width="150" KeyDown="txtSearchKeyDown" />
<CheckBox Content="{Binding Translation.ShowQueryBarText, ElementName=queryView}" IsChecked="{Binding ShowQueryItems}" />
<Button Content="{Binding Translation.ExpandHotPathSubtreeText, ElementName=queryView}" Name="btnExpandHotPathSubtree" Click="BtnExpandHotPathSubtreeClick" />
</ToolBar>
<DockPanel Name="queryPanel" Visibility="{Binding ShowQueryItems, Converter={StaticResource VisibilityConverter}}" Grid.Row="1" Grid.ColumnSpan="2">
<Button Name="btnExecuteQuery" DockPanel.Dock="Right" Click="btnExecuteQueryClick">Execute Query</Button>
<TextBox Name="txtQuery" TextChanged="txtQueryTextChanged" KeyDown="txtQueryKeyDown"></TextBox>
<Button Name="btnExecuteQuery" DockPanel.Dock="Right" Click="btnExecuteQueryClick" Content="{Binding Translation.ExecuteQueryText, ElementName=queryView}" />
<TextBox Name="txtQuery" TextChanged="txtQueryTextChanged" KeyDown="txtQueryKeyDown" />
</DockPanel>
<GridSplitter Width="5" Grid.Column="1" HorizontalAlignment="Left" Grid.Row="2" />
<Viewbox Name="diagramView" Grid.Column="1" Grid.Row="2" Margin="5,0,0,0">
<local:RingDiagramControl x:Name="ringDiagram" SelectedRoot="{Binding SelectedItem, Mode=TwoWay, ElementName=treeView}" />
<local:RingDiagramControl x:Name="ringDiagram" Translation="{Binding Translation, ElementName=queryView}" SelectedRoot="{Binding SelectedItem, Mode=TwoWay, ElementName=treeView}" />
</Viewbox>
</Grid>
</UserControl>

8
src/AddIns/Misc/Profiler/Frontend/Controls/QueryView.xaml.cs

@ -70,7 +70,13 @@ namespace ICSharpCode.Profiler.Controls @@ -70,7 +70,13 @@ namespace ICSharpCode.Profiler.Controls
get { return (bool)GetValue(ShowQueryItemsProperty); }
}
public ControlsTranslation Translation { get; set; }
public static readonly DependencyProperty TranslationProperty = DependencyProperty.Register(
"Translation", typeof(ControlsTranslation), typeof(QueryView));
public ControlsTranslation Translation {
set { SetValue(TranslationProperty, value); }
get { return (ControlsTranslation)GetValue(TranslationProperty); }
}
#endregion
void txtSearchKeyDown(object sender, KeyEventArgs e)

14
src/AddIns/Misc/Profiler/Frontend/Controls/RingDiagramControl.cs

@ -32,6 +32,14 @@ namespace ICSharpCode.Profiler.Controls @@ -32,6 +32,14 @@ namespace ICSharpCode.Profiler.Controls
set { SetValue(SelectedRootProperty, value); }
}
public static readonly DependencyProperty TranslationProperty = DependencyProperty.Register(
"Translation", typeof(ControlsTranslation), typeof(RingDiagramControl));
public ControlsTranslation Translation {
set { SetValue(TranslationProperty, value); }
get { return (ControlsTranslation)GetValue(TranslationProperty); }
}
protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e)
{
base.OnPropertyChanged(e);
@ -43,6 +51,7 @@ namespace ICSharpCode.Profiler.Controls @@ -43,6 +51,7 @@ namespace ICSharpCode.Profiler.Controls
{
this.hierarchyStack = new Stack<CallTreeNodeViewModel>();
this.task = new SingleTask(this.Dispatcher);
this.Translation = new ControlsTranslation();
}
void Update(CallTreeNodeViewModel item)
@ -73,7 +82,7 @@ namespace ICSharpCode.Profiler.Controls @@ -73,7 +82,7 @@ namespace ICSharpCode.Profiler.Controls
ell.HorizontalAlignment = HorizontalAlignment.Center;
ell.Fill = Brushes.Gray;
ell.Stroke = Brushes.Black;
ell.ToolTip = item.CreateToolTip();
ell.ToolTip = item.CreateToolTip(Translation);
ell.Tag = item;
ell.MouseLeftButtonDown += (sender, e) =>
@ -151,11 +160,10 @@ namespace ICSharpCode.Profiler.Controls @@ -151,11 +160,10 @@ namespace ICSharpCode.Profiler.Controls
p.WedgeAngle = wedgeAngle;
p.RotationAngle = rotationAngle;
p.Stroke = Brushes.Black;
p.ToolTip = node.CreateToolTip();
p.ToolTip = node.CreateToolTip(Translation);
p.VerticalAlignment = VerticalAlignment.Center;
p.HorizontalAlignment = HorizontalAlignment.Center;
p.Tag = node;
//p.ContextMenu = this.ContextMenu.;
p.MouseLeftButtonDown += new MouseButtonEventHandler(
delegate(object sender, MouseButtonEventArgs e) {

Loading…
Cancel
Save