Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="package"></param>
        private void CreateForkRow(RCPackage package)
        {
            string newThreadName    = package.ReadString(1);
            string parentThreadName = package.ReadString(3);
            long   timestamp        = package.ReadLong(4);

            if (!this.threadsToColumns.ContainsKey(newThreadName))
            {
                int idxOfCol = this.gridLog.Columns.Add(newThreadName, newThreadName);
                this.threadsToColumns.Add(newThreadName, idxOfCol);
            }
            if (!this.threadsToColumns.ContainsKey(parentThreadName))
            {
                int idxOfCol = this.gridLog.Columns.Add(parentThreadName, parentThreadName);
                this.threadsToColumns.Add(parentThreadName, idxOfCol);
            }

            object[] rowContent = new object[this.threadsToColumns.Count];
            rowContent[this.threadsToColumns[newThreadName]]    = "THREAD_START";
            rowContent[this.threadsToColumns[parentThreadName]] = "THREAD_FORK";

            int idxOfRow = this.gridLog.Rows.Add(rowContent);

            this.gridLog.Rows[idxOfRow].HeaderCell.Value = timestamp.ToString();

            DataGridViewCell cellOfNew    = this.gridLog[this.threadsToColumns[newThreadName], idxOfRow];
            DataGridViewCell cellOfParent = this.gridLog[this.threadsToColumns[parentThreadName], idxOfRow];

            cellOfNew.Style.BackColor    = Color.LightGreen;
            cellOfParent.Style.BackColor = Color.LightGreen;

            if (!this.doubleSelections.ContainsKey(cellOfNew))
            {
                this.doubleSelections.Add(cellOfNew, cellOfParent);
            }
            if (!this.doubleSelections.ContainsKey(cellOfParent))
            {
                this.doubleSelections.Add(cellOfParent, cellOfNew);
            }
        }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="package"></param>
        private void CreateJoinRow(RCPackage package)
        {
            string runningThreadName = package.ReadString(1);
            string waitingThreadName = package.ReadString(3);
            long   timestamp         = package.ReadLong(4);

            if (!this.threadsToColumns.ContainsKey(runningThreadName))
            {
                int idxOfCol = this.gridLog.Columns.Add(runningThreadName, runningThreadName);
                this.threadsToColumns.Add(runningThreadName, idxOfCol);
            }
            if (!this.threadsToColumns.ContainsKey(waitingThreadName))
            {
                int idxOfCol = this.gridLog.Columns.Add(waitingThreadName, waitingThreadName);
                this.threadsToColumns.Add(waitingThreadName, idxOfCol);
            }

            object[] rowContent = new object[this.threadsToColumns.Count];
            rowContent[this.threadsToColumns[runningThreadName]] = "THREAD_FINISH";
            rowContent[this.threadsToColumns[waitingThreadName]] = "THREAD_JOIN";

            int idxOfRow = this.gridLog.Rows.Add(rowContent);

            this.gridLog.Rows[idxOfRow].HeaderCell.Value = timestamp.ToString();

            DataGridViewCell cellOfRunning = this.gridLog[this.threadsToColumns[runningThreadName], idxOfRow];
            DataGridViewCell cellOfWaiting = this.gridLog[this.threadsToColumns[waitingThreadName], idxOfRow];

            cellOfRunning.Style.BackColor = Color.LightPink;
            cellOfWaiting.Style.BackColor = Color.LightPink;

            if (!this.doubleSelections.ContainsKey(cellOfRunning))
            {
                this.doubleSelections.Add(cellOfRunning, cellOfWaiting);
            }
            if (!this.doubleSelections.ContainsKey(cellOfWaiting))
            {
                this.doubleSelections.Add(cellOfWaiting, cellOfRunning);
            }
        }
Пример #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="package"></param>
        private void CreateExceptionRow(RCPackage package)
        {
            string threadName = package.ReadString(1);
            long   timestamp  = package.ReadLong(2);
            bool   isFatal    = (package.ReadByte(3) == (byte)0x00) ? false : true;
            string ex         = package.ReadString(4);

            if (!this.threadsToColumns.ContainsKey(threadName))
            {
                int idxOfCol = this.gridLog.Columns.Add(threadName, threadName);
                this.threadsToColumns.Add(threadName, idxOfCol);
            }

            object[] rowContent = new object[this.threadsToColumns.Count];
            rowContent[this.threadsToColumns[threadName]] = isFatal ? "FATAL_EXCEPTION" : "EXCEPTION";

            int idxOfRow = this.gridLog.Rows.Add(rowContent);

            this.gridLog.Rows[idxOfRow].HeaderCell.Value = timestamp.ToString();

            DataGridViewCell cellOfException = this.gridLog[this.threadsToColumns[threadName], idxOfRow];

            cellOfException.Style.BackColor = isFatal ? Color.Red : Color.Yellow;

            if (isFatal)
            {
                if (!this.fatalExceptions.ContainsKey(cellOfException))
                {
                    this.fatalExceptions.Add(cellOfException, ex);
                }
            }
            else
            {
                if (!this.normalExceptions.ContainsKey(cellOfException))
                {
                    this.normalExceptions.Add(cellOfException, ex);
                }
            }
        }
Пример #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="package"></param>
        private void CreateEventFormatRow(RCPackage package)
        {
            string threadName = package.ReadString(1);
            long   timestamp  = package.ReadLong(2);
            string evt        = package.ReadString(3);

            if (!this.threadsToColumns.ContainsKey(threadName))
            {
                int idxOfCol = this.gridLog.Columns.Add(threadName, threadName);
                this.threadsToColumns.Add(threadName, idxOfCol);
            }

            object[] rowContent = new object[this.threadsToColumns.Count];
            rowContent[this.threadsToColumns[threadName]] = evt;

            int idxOfRow = this.gridLog.Rows.Add(rowContent);

            this.gridLog.Rows[idxOfRow].HeaderCell.Value = timestamp.ToString();

            DataGridViewCell cellOfEvent = this.gridLog[this.threadsToColumns[threadName], idxOfRow];

            cellOfEvent.Style.BackColor = Color.LightGray;
        }