private void UpdateItem(ListViewItem item, ThreadDetails thread, bool modified)
		{
			((ListItemTag)item.Tag).m_details = thread;

			string[] subitem = new string[item.SubItems.Count];

			subitem[1] = thread.ID < 0 ? "--" : thread.ID.ToString();
			subitem[2] = thread.Location;
			subitem[3] = thread.State.ToString();
			subitem[4] = thread.PeakTime < 0 ? "--" : (thread.PeakTime).ToString("0.0000");
			subitem[5] = thread.AverageTime < 0 ? "--" : (thread.AverageTime).ToString("0.0000");
			subitem[6] = thread.StackSize < 0 ? "--" : thread.StackSize.ToString();
			subitem[7] = thread.StackUsed < 0 ? "--" : thread.StackUsed.ToString();

			if (modified)
			{
				for (int index = 1; index < item.SubItems.Count; ++index)
					if (item.SubItems[index].Text != subitem[index])
						item.SubItems[index].ForeColor = Color.Red;
			}

			item.SubItems[1].Text = subitem[1];
			item.SubItems[2].Text = subitem[2];
			item.SubItems[3].Text = subitem[3];
			item.SubItems[4].Text = subitem[4];
			item.SubItems[5].Text = subitem[5];
			item.SubItems[6].Text = subitem[6];
			item.SubItems[7].Text = subitem[7];
		}
Exemple #2
0
        void ProcessMessage_ThreadsUpdate()
        {
            int count = m_readBuffer.ReadInt32();

            List <ThreadDetails> threads = new List <ThreadDetails>();

            for (int index = 0; index < count; ++index)
            {
                LuaValue       thread    = new LuaValue(m_readBuffer.ReadObjectID(), LuaValueType.THREAD);
                LuaValue       parent    = new LuaValue(m_readBuffer.ReadObjectID(), LuaValueType.THREAD);
                string         name      = m_readBuffer.ReadString();
                int            threadid  = m_readBuffer.ReadInt32();
                string         location  = m_readBuffer.ReadString();
                LuaThreadState state     = (LuaThreadState)m_readBuffer.ReadInt32();
                int            stackSize = m_readBuffer.ReadInt16();
                int            stackUsed = m_readBuffer.ReadInt16();
                double         peak      = m_readBuffer.ReadNumber();
                double         average   = m_readBuffer.ReadNumber();
                bool           modified  = m_readBuffer.ReadInt16() != 0;
                bool           valid     = m_readBuffer.ReadInt16() != 0;

                ThreadDetails details = new ThreadDetails(thread, parent, name, threadid, location, state, stackSize, stackUsed, peak, average, valid);
                threads.Add(details);
            }

            OnThreadUpdate(new ThreadUpdateEventArgs(threads.ToArray()));
        }
		private void InsertChildren(List<KeyValuePair<ThreadDetails, ListViewItem> > items, long parent, int parentIndex, int indent)
		{
			foreach (KeyValuePair<ThreadDetails, ListViewItem> pair in items)
			{
				ThreadDetails thread = pair.Key;
				ListViewItem item = pair.Value;

				if (thread.Parent.Value == parent)
				{
					item.IndentCount = indent;
					threadListView.Items.Add(item);
					InsertChildren(items, thread.Thread.Value, item.Index, indent + 1);
				}
			}
		}
		private ListViewItem CreateItem(ThreadDetails thread, int index, int indent)
		{
			//ListViewItem item = new ListViewItem(mDebugger.ValueCache.Get(thread.Thread));
			ListViewItem item = new ListViewItem(thread.Name);//"Thread " + thread.Thread.Value.ToString() + " (" + thread.Parent.Value.ToString() + ")");
			item.Name = thread.Thread.ToString();
			item.Tag = new ListItemTag(thread, index, indent);
			item.UseItemStyleForSubItems = false;

			item.SubItems.Add("");
			item.SubItems.Add("");
			item.SubItems.Add("");
			item.SubItems.Add("");
			item.SubItems.Add("");
			item.SubItems.Add("");
			item.SubItems.Add("");

			return item;
		}
			public int Compare(object x, object y)
			{
				ListViewItem lhsItem = x as ListViewItem;
				ListViewItem rhsItem = y as ListViewItem;
				ListItemTag lhsTag = lhsItem.Tag as ListItemTag;
				ListItemTag rhsTag = rhsItem.Tag as ListItemTag;
				ThreadDetails lhs = lhsTag.m_details;
				ThreadDetails rhs = rhsTag.m_details;

				switch (m_sortColumn)
				{
					case 0: return m_sortOrder * String.Compare(lhs.Name, rhs.Name);
					case 1: return m_sortOrder * ((int)lhs.ID - (int)rhs.ID);
					case 2: return m_sortOrder * String.Compare(lhs.Location, rhs.Location);
					case 3: return m_sortOrder * ((int)lhs.State - (int)rhs.State);
					case 4: return m_sortOrder * Math.Sign(lhs.PeakTime - rhs.PeakTime);
					case 5: return m_sortOrder * Math.Sign(lhs.AverageTime - rhs.AverageTime);
					case 6: return m_sortOrder * (lhs.StackSize - rhs.StackSize);
					case 7: return m_sortOrder * (lhs.StackUsed - rhs.StackUsed);
					default: return 0;
				}
			}
			public ListItemTag(ThreadDetails details, int index, int indent)
			{
				m_details = details;
				m_index = index;
				m_indent = indent;
			}
Exemple #7
0
		void ProcessMessage_ThreadsUpdate()
		{
			int count = m_readBuffer.ReadInt32();

			List<ThreadDetails> threads = new List<ThreadDetails>();

			for (int index = 0; index < count; ++index)
			{
				LuaValue thread = new LuaValue(m_readBuffer.ReadObjectID(), LuaValueType.THREAD);
				LuaValue parent = new LuaValue(m_readBuffer.ReadObjectID(), LuaValueType.THREAD);
				string name = m_readBuffer.ReadString();
				int threadid = m_readBuffer.ReadInt32();
				string location = m_readBuffer.ReadString();
				LuaThreadState state = (LuaThreadState)m_readBuffer.ReadInt32();
				int stackSize = m_readBuffer.ReadInt16();
				int stackUsed = m_readBuffer.ReadInt16();
				double peak = m_readBuffer.ReadNumber();
				double average = m_readBuffer.ReadNumber();
				bool modified = m_readBuffer.ReadInt16() != 0;
				bool valid = m_readBuffer.ReadInt16() != 0;

				ThreadDetails details = new ThreadDetails(thread, parent, name, threadid, location, state, stackSize, stackUsed, peak, average, valid);
				threads.Add(details);
			}

			OnThreadUpdate(new ThreadUpdateEventArgs(threads.ToArray()));
		}
		public ThreadUpdateEventArgs(ThreadDetails [] threads)
		{
			mThreads = threads;
		}