Exemplo n.º 1
0
        public override void ActivateItem()
        {
            HeapShotProfilingSnapshot     snapshot = (HeapShotProfilingSnapshot)CurrentNode.DataItem;
            HeapShotProfilingSnapshotView view     = new HeapShotProfilingSnapshotView();

            view.Load(snapshot, false);
            IdeApp.Workbench.OpenDocument(view, true);
        }
Exemplo n.º 2
0
        public override void BuildNode(ITreeBuilder builder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon)
        {
            HeapShotProfilingSnapshot snapshot = (HeapShotProfilingSnapshot)dataObject;

            label = snapshot.Name;
            icon  = Context.GetIcon("md-prof-snapshot");
            snapshot.NameChanged += nameChangedHandler;
        }
		public void Load (HeapShotProfilingSnapshot snapshot, bool inverse)
		{
			this.snapshot = snapshot;

			if (allObjects)
				viewer.FillAllTypes (snapshot.ObjectMap);//viewer.FillType (snapshot.ObjectMap, viewer.SelectedType);
			else
				viewer.FillType (snapshot.ObjectMap, typeName);
			viewer.Show ();
			//TODO: toggle 'inverse' on all child views when toggled in the 'all objects' view
		}
        public void Load(HeapShotProfilingSnapshot snapshot, bool inverse)
        {
            this.snapshot = snapshot;

            if (allObjects)
            {
                viewer.FillAllTypes(snapshot.ObjectMap);                 //viewer.FillType (snapshot.ObjectMap, viewer.SelectedType);
            }
            else
            {
                viewer.FillType(snapshot.ObjectMap, typeName);
            }
            viewer.Show();
            //TODO: toggle 'inverse' on all child views when toggled in the 'all objects' view
        }
Exemplo n.º 5
0
        private void AsyncTakeSnapshot(object state)
        {
            string dumpFile = null;

            lock (sync)
                dumpFile = Context.FileName;

            int  attempts = 40;
            bool success  = false;

            while (!success)
            {
                if (--attempts == 0)
                {
                    OnSnapshotFailed(EventArgs.Empty);
                    return;
                }

                Thread.Sleep(500);
                if (!File.Exists(dumpFile))
                {
                    continue;
                }

                try {
                    string destFile = GetSaveLocation();
                    if (destFile != null)                       //ignore if Cancel is clicked in the save dialog
                    {
                        File.Copy(dumpFile, destFile);
                        File.Delete(dumpFile);

                        IProfilingSnapshot snapshot = new HeapShotProfilingSnapshot(this, destFile);
                        OnSnapshotTaken(new ProfilingSnapshotEventArgs(snapshot));
                    }
                    success = true;
                } catch (Exception ex) {
                    LoggingService.LogError("HeapShotProfiler", "AsyncTakeSnapshot", ex);
                }
            }

            lock (sync)
                State = ProfilerState.Profiling;
        }
Exemplo n.º 6
0
		private void AsyncTakeSnapshot (object state)
		{
			string dumpFile = null;
			lock (sync)
				dumpFile = Context.FileName;
			
			int attempts = 40;
			bool success = false;
			
			while (!success) {
				if (--attempts == 0) {
					OnSnapshotFailed (EventArgs.Empty);
					return;
				}
				
				Thread.Sleep (500);
				if (!File.Exists (dumpFile))
					continue;

				try {
					string destFile = GetSaveLocation ();
					if (destFile != null) { //ignore if Cancel is clicked in the save dialog
						File.Copy (dumpFile, destFile);
						File.Delete (dumpFile);

						IProfilingSnapshot snapshot = new HeapShotProfilingSnapshot (this, destFile);
						OnSnapshotTaken (new ProfilingSnapshotEventArgs (snapshot));
					}
					success = true;
				} catch (Exception ex) {
					LoggingService.LogError ("HeapShotProfiler", "AsyncTakeSnapshot", ex);
				}
			}
			
			lock (sync)
				State = ProfilerState.Profiling;
		}
Exemplo n.º 7
0
        public override string GetNodeName(ITreeNavigator thisNode, object dataObject)
        {
            HeapShotProfilingSnapshot snapshot = (HeapShotProfilingSnapshot)dataObject;

            return(snapshot.Name);
        }