} // End Function GetEventCaption protected void NewEventArrived(ProfilerEvent evt, bool last) { // if (evt == m_EventStarted || evt == m_EventPaused || evt == m_EventStopped) return; //m_columns.Add(new PerfColumn { Caption = "Event Class", Column = ProfilerEventColumns.EventClass, Width = 122 }); //m_columns.Add(new PerfColumn { Caption = "Text Data", Column = ProfilerEventColumns.TextData, Width = 255 }); //m_columns.Add(new PerfColumn { Caption = "Login Name", Column = ProfilerEventColumns.LoginName, Width = 79 }); //m_columns.Add(new PerfColumn { Caption = "CPU", Column = ProfilerEventColumns.CPU, Width = 82, Alignment = HorizontalAlignment.Right, Format = "#,0" }); //m_columns.Add(new PerfColumn { Caption = "Reads", Column = ProfilerEventColumns.Reads, Width = 78, Alignment = HorizontalAlignment.Right, Format = "#,0" }); //m_columns.Add(new PerfColumn { Caption = "Writes", Column = ProfilerEventColumns.Writes, Width = 78, Alignment = HorizontalAlignment.Right, Format = "#,0" }); //m_columns.Add(new PerfColumn { Caption = "Duration, ms", Column = ProfilerEventColumns.Duration, Width = 82, Alignment = HorizontalAlignment.Right, Format = "#,0" }); //m_columns.Add(new PerfColumn { Caption = "SPID", Column = ProfilerEventColumns.SPID, Width = 50, Alignment = HorizontalAlignment.Right }); //m_columns.Add(new PerfColumn { Caption = "Start time", Column = ProfilerEventColumns.StartTime, Width = 140, Format = "yyyy-MM-ddThh:mm:ss.ffff" }); //m_columns.Add(new PerfColumn { Caption = "End time", Column = ProfilerEventColumns.EndTime, Width = 140, Format = "yyyy-MM-ddThh:mm:ss.ffff" }); //m_columns.Add(new PerfColumn { Caption = "DatabaseName", Column = ProfilerEventColumns.DatabaseName, Width = 70 }); //m_columns.Add(new PerfColumn { Caption = "Object name", Column = ProfilerEventColumns.ObjectName, Width = 70 }); //m_columns.Add(new PerfColumn { Caption = "Application name", Column = ProfilerEventColumns.ApplicationName, Width = 70 }); //m_columns.Add(new PerfColumn { Caption = "Host name", Column = ProfilerEventColumns.HostName, Width = 70 }); // System.Console.WriteLine(evt); System.Console.ResetColor(); string caption = GetEventCaption(evt); System.Console.Write(caption); System.Console.Write(new string(' ', System.Console.BufferWidth - System.Console.CursorLeft)); if (!this.m_isWindows) { System.Console.Write(System.Environment.NewLine); } string td = evt.GetFormattedData(ProfilerEventColumns.TextData, null); // System.Console.WriteLine(td); // System.Windows.Forms.RichTextBox rich, // RTFBuilder rb = new RTFBuilder { // BackColor = System.Drawing.Color.White // }; // rich.Text = ""; ConsoleOutputWriter cw = new ConsoleOutputWriter() { BackColor = System.Drawing.Color.White }; if (!string.IsNullOrEmpty(td)) { // var lex = new YukonLexer(); lex.SyntaxHighlight(cw, td); this.m_Lex.SyntaxHighlight(cw, td); // rich.Rtf = this.m_Lex.SyntaxHighlight(rb, td); } // for(int i = 0; i < 65; ++i) // 65 is size of array // System.Console.WriteLine(evt.GetFormattedData(i, null)); //for (int i = 1; i < this.m_columns.Count; ++i) //{ // System.Console.WriteLine(i); // System.Console.WriteLine(this.m_columns[i].Caption); // System.Console.WriteLine(evt.GetFormattedData(this.m_columns[i].Column, this.m_columns[i].Format)); //} // Next i } // End Sub NewEventArrived
private string GetFormattedValue(ProfilerEvent evt, int column, string format) { return ProfilerEventColumns.Duration == column ? (evt.Duration / 1000).ToString(format) : evt.GetFormattedData(column, format); }