Esempio n. 1
0
		void AnalyzeBuffer ()
		{
			if (buffer == null)
				return;
			expandedRows.Clear ();
			
			long selectedID = SelectedThreadID;
			var v = visitor;
			
			if (startTime > 0) {
				v = new AnalyseVisitor ();
				v.LookupThread = selectedID;
				v.nameDictionary = visitor.nameDictionary;
				v.StartTime = startTime;
				v.EndTime = endTime;
				for (int i = 0; i < buffer.BufferCount; i++) {
					var b = buffer.ReadBuffer (i);
					if (startTime <= b.Header.TimeBase) {
						System.Console.WriteLine ("analyze !!! " + b);
						v.CurrentBuffer = b;
						b.RunVisitor (v);
					}
				}
			}
			
			comboboxThreads.Changed -= HandleComboboxThreadsChanged;
			threadStore.Clear ();
			threadStore.AppendValues ("[All Threads]", null);
			bool first = true;
			int active = 0;
			int j = 1;
			foreach (var thread in visitor.threadDictionary.Values) {
				string name = thread.Name;
				if (string.IsNullOrEmpty (name) && first) {
					name = "GUI Thread";
				}
				first = false;
				if (thread.ThreadId == selectedID)
					active = j;
				threadStore.AppendValues (name + " (" + thread.ThreadId + ")", thread);
				j++;
			}
			comboboxThreads.Active = active;
			comboboxThreads.Changed += HandleComboboxThreadsChanged;
			store.Clear ();
			
			foreach (var threadContext in v.threadDictionary.Values) {
				if (selectedID != 0 && threadContext.ThreadId != selectedID)
					continue;
				foreach (var info in threadContext.MethodCalls.Values) {
					AppendMethodInfo (TreeIter.Zero, info);
				}
			}
			timeLineWidget.Update ();
		}
Esempio n. 2
0
		void AppendMethodInfo (TreeIter iter, AnalyseVisitor.MethodInfo info)
		{
			TreeIter subiter;
			double time = (double)totalTime;
			if (info.Parent != null) {
				time = info.Parent.TimeWithChildren;
			} else {
				if (visitor.StartTime != 0) {
					time = Math.Min (totalTime, visitor.EndTime - visitor.StartTime);
				}
			}
			if (iter.Equals (TreeIter.Zero)) {
				subiter = store.AppendValues (visitor.LookupName (info.MethodBase), 
						"", 
						info.Calls, 
						100.0 * (double)info.TimeWithChildren / time, 
						(info.TimeWithChildren - info.CalleeTime) / 1000.0, 
						info.TimeWithChildren / 1000.0, 
						info);
			} else {
				subiter = store.AppendValues (iter, visitor.LookupName (info.MethodBase), 
						"", 
						info.Calls, 
						100.0 * (double)info.TimeWithChildren / time, 
						(info.TimeWithChildren - info.CalleeTime) / 1000.0, 
						info.TimeWithChildren / 1000.0, 
						info);
			}
			if (info.MethodCalls.Count > 0) {
				store.AppendValues (subiter, "", 
						"", 
						0UL, 
						0d, 
						0d, 
						0d, 
						null);
			}
		}
Esempio n. 3
0
        void AnalyzeBuffer()
        {
            if (buffer == null)
            {
                return;
            }
            expandedRows.Clear();

            long selectedID = SelectedThreadID;
            var  v          = visitor;

            if (startTime > 0)
            {
                v = new AnalyseVisitor();
                v.LookupThread   = selectedID;
                v.nameDictionary = visitor.nameDictionary;
                v.StartTime      = startTime;
                v.EndTime        = endTime;
                for (int i = 0; i < buffer.BufferCount; i++)
                {
                    var b = buffer.ReadBuffer(i);
                    if (startTime <= b.Header.TimeBase)
                    {
                        System.Console.WriteLine("analyze !!! " + b);
                        v.CurrentBuffer = b;
                        b.RunVisitor(v);
                    }
                }
            }

            comboboxThreads.Changed -= HandleComboboxThreadsChanged;
            threadStore.Clear();
            threadStore.AppendValues("[All Threads]", null);
            bool first  = true;
            int  active = 0;
            int  j      = 1;

            foreach (var thread in visitor.threadDictionary.Values)
            {
                string name = thread.Name;
                if (string.IsNullOrEmpty(name) && first)
                {
                    name = "GUI Thread";
                }
                first = false;
                if (thread.ThreadId == selectedID)
                {
                    active = j;
                }
                threadStore.AppendValues(name + " (" + thread.ThreadId + ")", thread);
                j++;
            }
            comboboxThreads.Active   = active;
            comboboxThreads.Changed += HandleComboboxThreadsChanged;
            store.Clear();

            foreach (var threadContext in v.threadDictionary.Values)
            {
                if (selectedID != 0 && threadContext.ThreadId != selectedID)
                {
                    continue;
                }
                foreach (var info in threadContext.MethodCalls.Values)
                {
                    AppendMethodInfo(TreeIter.Zero, info);
                }
            }
            timeLineWidget.Update();
        }