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. 20
      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 @@
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Include="Src\ProfilerRunner.cs" /> <Compile Include="Src\ProfilerRunner.cs" />
<Compile Include="Src\SharpDevelopTranslation.cs" />
<Compile Include="Src\Views\ProfilerView.xaml.cs"> <Compile Include="Src\Views\ProfilerView.xaml.cs">
<DependentUpon>ProfilerView.xaml</DependentUpon> <DependentUpon>ProfilerView.xaml</DependentUpon>
</Compile> </Compile>

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

@ -30,9 +30,9 @@ namespace ICSharpCode.Profiler.AddIn.Commands
/// </summary> /// </summary>
public override void Run() 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; var items = from item in list select item.Node;
List<string> parts = new List<string>(); List<string> parts = new List<string>();
@ -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"); 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
{ {
public class RunTestWithProfilerCommand : AbstractRunTestCommand public class RunTestWithProfilerCommand : AbstractRunTestCommand
{ {
ProfilerRunner runner;
protected override void RunTests(UnitTestApplicationStartHelper helper) protected override void RunTests(UnitTestApplicationStartHelper helper)
{ {
TestRunnerCategory.AppendLine(helper.GetCommandLine()); TestRunnerCategory.AppendLine(helper.GetCommandLine());
@ -32,7 +34,7 @@ namespace ICSharpCode.Profiler.AddIn.Commands
startInfo.WorkingDirectory = UnitTestApplicationStartHelper.UnitTestApplicationDirectory; startInfo.WorkingDirectory = UnitTestApplicationStartHelper.UnitTestApplicationDirectory;
LoggingService.Info("starting profiler..."); 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 { runner.RunFinished += delegate {
WorkbenchSingleton.SafeThreadCall(() => FileService.OpenFile(path)); WorkbenchSingleton.SafeThreadCall(() => FileService.OpenFile(path));
@ -72,22 +74,12 @@ namespace ICSharpCode.Profiler.AddIn.Commands
LoggingService.Info("shutting profiler down..."); 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() protected override void OnStop()
{ {
// if (ProfilerService.CurrentProfiler.IsRunning) { if (this.runner != null && this.runner.Profiler.IsRunning) {
// LoggingService.Info("stopping profiler..."); LoggingService.Info("stopping profiler...");
// ProfilerService.CurrentProfiler.Stop(); runner.Stop();
// } }
} }
} }
} }

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

@ -44,9 +44,9 @@ namespace ICSharpCode.Profiler.AddIn.Commands
parts.Add("GetNodeByPath(" + string.Join(",", path.Select(i => i.ToString()).ToArray()) + ")"); 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) if (nameId == null)
header = "Merged Nodes"; header = StringParser.Parse("${res:AddIns.Profiler.Commands.SetAsRoot.TabTitle}:");
Parent.CreateTab(header, "Merge(" + string.Join(",", parts.ToArray()) + ")"); 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
public override void Run() public override void Run()
{ {
var selectedItem = GetSelectedItems().FirstOrDefault(); var selectedItem = GetSelectedItems().FirstOrDefault();
if (selectedItem != null) 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"); "from f in Functions where f.Signature == \"" + selectedItem.GetSignature() + "\" select f");
} }
} }

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

@ -1,7 +1,8 @@
<Window x:Class="ICSharpCode.Profiler.AddIn.Dialogs.ProfileExecutableForm" <Window x:Class="ICSharpCode.Profiler.AddIn.Dialogs.ProfileExecutableForm"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 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"> WindowStyle="ToolWindow" ShowInTaskbar="False" ResizeMode="NoResize" SizeToContent="WidthAndHeight">
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
@ -13,24 +14,21 @@
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*" /> <ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<TextBlock TextWrapping="Wrap" Grid.ColumnSpan="3" Margin="3"> <TextBlock TextWrapping="Wrap" Grid.ColumnSpan="3" Margin="3" Text="{sd:Localize AddIns.Profiler.ProfileExecutableForm.DescriptionText}" />
Select the path of the executable you want to profile.<LineBreak /> <Label Grid.Row="1" Content="{sd:Localize AddIns.Profiler.ProfileExecutableForm.ExePathText}" />
Optionally you can specify working directory and command line arguments to start the process.
</TextBlock>
<Label Grid.Row="1">Path to executable:</Label>
<TextBox Margin="3" Name="txtExePath" Grid.Column="1" Grid.Row="1" /> <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> <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" /> <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> <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" /> <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"> <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="btnStartClick" Content="{sd:Localize AddIns.Profiler.ProfileExecutableForm.StartText}" />
<Button Margin="3" Padding="5,0,5,0" Click="btnCancelClick">Cancel</Button> <Button Margin="3" Padding="5,0,5,0" Click="btnCancelClick" Content="{sd:Localize Global.CancelButtonText}" />
</StackPanel> </StackPanel>
</Grid> </Grid>
</Window> </Window>

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

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

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

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

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

@ -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 @@
<UserControl x:Class="ICSharpCode.Profiler.AddIn.Views.ProfilerView" <UserControl x:Class="ICSharpCode.Profiler.AddIn.Views.ProfilerView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 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:y="clr-namespace:ICSharpCode.Profiler.Controls;assembly=ICSharpCode.Profiler.Controls"
xmlns:local="clr-namespace:ICSharpCode.Profiler.AddIn.Views"> xmlns:local="clr-namespace:ICSharpCode.Profiler.AddIn.Views">
<UserControl.Resources> <UserControl.Resources>
@ -29,21 +30,20 @@
</ScrollViewer> </ScrollViewer>
<ToolBar Height="27" Name="toolBar1" VerticalAlignment="Top"> <ToolBar Height="27" Name="toolBar1" VerticalAlignment="Top">
<Menu> <Menu>
<MenuItem Name="mnuQueryHistory" Header="Query History"> <MenuItem Name="mnuQueryHistory" Header="{sd:Localize AddIns.Profiler.ProfilingView.QueryHistoryText}">
<MenuItem Name="mnuClearQueryHistory" Header="Clear History" Click="mnuClearQueryHistoryClick" /> <MenuItem Name="mnuClearQueryHistory" Header="{sd:Localize AddIns.Profiler.ProfilingView.ClearQueryHistoryText}" Click="ClearQueryHistoryClick" />
<Separator /> <Separator />
</MenuItem> </MenuItem>
</Menu> </Menu>
</ToolBar> </ToolBar>
<TabControl Name="tabView" HorizontalAlignment="Stretch" Margin="0,120,0,0" SelectionChanged="tabView_SelectionChanged"> <TabControl Name="tabView" HorizontalAlignment="Stretch" Margin="0,120,0,0" SelectionChanged="TabViewSelectionChanged">
<TabItem Header="Overview"> <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" /> <y:QueryView x:Name="treeView" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ShowQueryItems="False" CurrentQuery="from t in Threads select t" IsQueryModifiable="False" />
</TabItem> </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" /> <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>
<TabItem Name="dummyTab" Header=""> <TabItem Name="dummyTab" />
</TabItem>
</TabControl> </TabControl>
</Grid> </Grid>
</UserControl> </UserControl>

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

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

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

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

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

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

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

@ -70,7 +70,13 @@ namespace ICSharpCode.Profiler.Controls
get { return (bool)GetValue(ShowQueryItemsProperty); } 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 #endregion
void txtSearchKeyDown(object sender, KeyEventArgs e) void txtSearchKeyDown(object sender, KeyEventArgs e)

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

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

Loading…
Cancel
Save