Ejemplo n.º 1
0
		public bool Initialize(ProfilerWindowBase mainWindow, Connection connection, Snapshot snapshot)
		{
			if(mainWindow == null)
				throw new ArgumentNullException("mainWindow");
			if(connection == null)
				throw new ArgumentNullException("connection");

			m_mainWindow = mainWindow;
			m_connection = connection;
			m_snapshot = snapshot;

			Graph.GraphPane.Title.Text = "Performance Counters";
			Graph.GraphPane.XAxis.Title.Text = "Time";
			Graph.GraphPane.YAxis.Title.Text = "Value";

			try
			{
				UpdateCounters();
				m_refreshTimer.Enabled = true;
				return true;
			}
			catch
			{
				MessageBox.Show("This connection does not have any performance counter data.", "Performance Counter Visualizer",
					MessageBoxButtons.OK, MessageBoxIcon.Error);
				return false;
			}
		}
Ejemplo n.º 2
0
		public bool Initialize(ProfilerWindowBase mainWindow, Connection connection, Snapshot snapshot)
		{
			if(connection == null)
				throw new ArgumentNullException("connection");

			m_connection = connection;
			this.Text = Utilities.GetStandardCaption(connection);

			return true;
		}
Ejemplo n.º 3
0
		public bool Initialize(ProfilerWindowBase mainWindow, Connection connection)
		{
			m_host = new ElementHost();
			m_host.Dock = DockStyle.Fill;
			this.Controls.Add(m_host);

			m_universe = new Universe(connection, m_host);
			m_host.Child = m_universe;
			this.Text = Utilities.GetStandardCaption(connection);
			return true;
		}
Ejemplo n.º 4
0
		public bool Initialize(ProfilerWindowBase mainWindow, Connection connection, Snapshot snapshot)
		{
			if(mainWindow == null)
				throw new ArgumentNullException("mainWindow");
			if(connection == null)
				throw new ArgumentNullException("connection");

			m_mainWindow = mainWindow;
			m_connection = connection;
			m_snapshot = snapshot;

			UpdateHotspots();
			return true;
		}
Ejemplo n.º 5
0
		public bool Initialize(ProfilerWindowBase mainWindow, Connection connection, Snapshot snapshot)
		{
			if(mainWindow == null)
				throw new ArgumentNullException("mainWindow");
			if(connection == null)
				throw new ArgumentNullException("connection");

			m_mainWindow = mainWindow;
			m_connection = connection;
			m_snapshot = snapshot;
			m_refreshTimer.Enabled = m_connection.IsConnected;

			UpdateFunctionList();
			return true;
		}
Ejemplo n.º 6
0
		private bool Connect(string host, int port)
		{
			string dbFile = m_resultsFileTextBox.Text;

			//connect to data engine before launching the process -- we don't want to launch if this fails
			IDataEngine storage = null;
			try
			{
				//storage = new SqlServerCompactEngine(dbFile, true);
				if(SQLiteRadio.Checked)
					storage = new SQLiteEngine(dbFile, true);
				else if(SQLiteMemoryRadio.Checked)
					storage = new SQLiteMemoryEngine();
				else
					throw new NotImplementedException();
			}
			catch(Exception ex)
			{
				MessageBox.Show(ex.Message, "Launch Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
				return false;
			}

			ConnectProgress progress = new ConnectProgress(host, port, storage, 10);
			progress.ShowDialog(this);

			if(progress.Client != null)
			{
				Connection conn = new Connection(storage);
				conn.RunClient(progress.Client);
				conn.SetAutoSnapshots(10000, false);

				var profilerWindow = new ProfilerWindow(m_mainWindow, conn);
				profilerWindow.Show();

				TypeEntry visEntry = m_visualizerCombo.SelectedItem as TypeEntry;
				if(visEntry != null && visEntry.Type != null)
					profilerWindow.AddVisualizer(visEntry.Type);

				profilerWindow.BringToFront();
			}
			else
			{
				storage.Dispose();
				return false;
			}

			return true;
		}
Ejemplo n.º 7
0
		public Universe(Connection connection, ElementHost host)
		{
			InitializeComponent();

			m_connection = connection;
			m_host = host;

			m_container = new D3DImageSlimDX();
			m_container.IsFrontBufferAvailableChanged += new DependencyPropertyChangedEventHandler(OnIsFrontBufferAvailableChanged);
			RenderImage.Source = m_container;

			m_scene = new Scene(m_host, m_connection);
			var texture = m_scene.SharedTexture;
			m_container.SetBackBufferSlimDX(texture);
			BeginRenderingScene();
		}
Ejemplo n.º 8
0
		public ProfilerWindow(SlimTune mainWindow, Connection conn)
			: base(conn)
		{
			InitializeComponent();
			this.Text = Utilities.GetStandardCaption(conn);
			m_mainWindow = mainWindow;
			m_mainWindow.AddWindow(this);

			Connection.Disconnected += new EventHandler(Connection_Disconnected);
			Connection.DataEngine.DataFlush += new EventHandler(DataEngine_DataFlush);

			string host = string.IsNullOrEmpty(conn.HostName) ? "(file)" : conn.HostName;
			HostLabel.Text = "Host: " + host;
			string port = conn.Port == 0 ? "(file)" : conn.Port.ToString();
			PortLabel.Text = "Port: " + port;
			EngineLabel.Text = "Engine: " + conn.DataEngine.Engine;
			NameLabel.Text = "Name: " + conn.DataEngine.Name;

			string status;
			if(conn.Port == 0)
			{
				status = "Opened From File";
			}
			else if(conn.IsConnected)
			{
				status = "Running";
				SnapshotButton.Enabled = true;
			}
			else
			{
				status = "Stopped";
				ReconnectButton.Enabled = true;
			}
			StatusLabel.Text = "Status: " + status;

			foreach(var vis in Utilities.GetVisualizerList(false))
			{
				m_visualizerCombo.Items.Add(vis);
			}
			m_visualizerCombo.SelectedIndex = 0;

			RefreshSnapshots();
		}
Ejemplo n.º 9
0
		public ThreadView(Connection conn, Scene scene)
		{
			m_connection = conn;
			m_device = scene.Device;
			m_context = m_device.ImmediateContext;

			var bytecode = ShaderBytecode.CompileFromFile(RenderSupport.ContentPath + "\\Universe.fx", "fx_5_0", ShaderFlags.None, EffectFlags.None);
			m_effect = new Effect(m_device, bytecode);
			var pass = m_effect.GetTechniqueByIndex(0).GetPassByIndex(0);
			m_layout = new InputLayout(m_device, pass.Description.Signature, QuadVertex.Elements);

			m_vertices = new SlimDX.Direct3D11.Buffer(m_device, new BufferDescription()
			{
				CpuAccessFlags = CpuAccessFlags.Write,
				BindFlags = BindFlags.VertexBuffer,
				SizeInBytes = 6 * MaxQuads * QuadVertex.SizeBytes,
				Usage = ResourceUsage.Dynamic
			});

			m_texture = Texture2D.FromFile(m_device, RenderSupport.ContentPath + "\\stars.png");
			m_textureView = new ShaderResourceView(m_device, m_texture);
		}
Ejemplo n.º 10
0
		public ProfilerWindowBase(Connection conn)
		{
			Visualizers = new List<IVisualizer>();
			Connection = conn;
		}
Ejemplo n.º 11
0
		public bool Initialize(ProfilerWindowBase mainWindow, Connection connection, Snapshot snapshot)
		{
			if(mainWindow == null)
				throw new ArgumentNullException("mainWindow");
			if(connection == null)
				throw new ArgumentNullException("connection");

			m_mainWindow = mainWindow;
			m_connection = connection;
			m_snapshot = snapshot;

			var toolstrip = mainWindow.GetToolStrip(this);
			m_toolstripButton = new ToolStripSplitButton("Filters");
			m_toolstripButton.Image = new Bitmap(SlimTuneUI.CoreVis.Properties.Resources.FiltersButtonImage);

			m_filters = GetFilters();
			RefreshFilters();

			toolstrip.Items.Add(m_toolstripButton);

			UpdateTopLevel();
			return true;
		}
Ejemplo n.º 12
0
		private void OpenFile(string file)
		{
			Type engineType = Utilities.FindEngine(file);
			if(engineType == null)
			{
				MessageBox.Show(string.Format("Unable to find an engine for {0}.", file),
					"Error Opening File", MessageBoxButtons.OK, MessageBoxIcon.Error);
				return;
			}

			try
			{
				//arguments are filename, createNew
				IDataEngine engine = (IDataEngine) Activator.CreateInstance(engineType, file, false);

				var conn = new Connection(engine);
				var window = new ProfilerWindow(this, conn);
				window.Show();
			}
			catch(System.Reflection.TargetInvocationException ex)
			{
				MessageBox.Show("Unable to create engine: " + ex.InnerException.Message,
					"Error Opening File", MessageBoxButtons.OK, MessageBoxIcon.Error);
			}
			catch(Exception ex)
			{
				MessageBox.Show("Unknown error: " + ex.Message, "Error Opening File",
					MessageBoxButtons.OK, MessageBoxIcon.Error);
			}
		}
Ejemplo n.º 13
0
		private bool LaunchLocal()
		{
			string dbFile = m_resultsFileTextBox.Text;

			if(!m_launcher.CheckParams())
				return false;

			//connect to data engine before launching the process -- we don't want to launch if this fails
			IDataEngine data = null;
			if(m_connectCheckBox.Checked)
			{
				try
				{
					this.Cursor = Cursors.WaitCursor;
					if(m_sqliteRadio.Checked)
						data = new SQLiteEngine(dbFile, true);
					else if(m_sqliteMemoryRadio.Checked)
						data = new SQLiteMemoryEngine();
					else
						throw new NotImplementedException();
				}
				catch(Exception ex)
				{
					MessageBox.Show(ex.Message, "Launch Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
					return false;
				}
				finally
				{
					this.Cursor = Cursors.Default;
				}
			}

			if(!m_launcher.Launch())
			{
				if(data != null)
					data.Dispose();
				return false;
			}

			//connect, if we're asked to
			if(m_connectCheckBox.Checked)
			{
				ConnectProgress progress = new ConnectProgress("localhost", m_launcher.ListenPort, data, 10);
				progress.ShowDialog(this);

				if(progress.Client != null)
				{
					Connection conn = new Connection(data);
					conn.Executable = m_launcher.Name;
					conn.RunClient(progress.Client);
					//TODO: set options like auto snapshot frequency
					conn.SetAutoSnapshots(10000, false);

					var profilerWindow = new ProfilerWindow(m_mainWindow, conn);
					profilerWindow.Show();

					TypeEntry visEntry = m_visualizerCombo.SelectedItem as TypeEntry;
					if(visEntry != null && visEntry.Type != null)
						profilerWindow.AddVisualizer(visEntry.Type);

					profilerWindow.BringToFront();
				}
				else
				{
					//connection failed, shut down the storage
					data.Dispose();
				}
			}

			return true;
		}