##// END OF EJS Templates
Added the time delta column to the interactive trace listener
cin -
r214:9c32ef39b851 v2
parent child
Show More
@@ -1,122 +1,123
1 using Implab.Parallels;
1 using Implab.Parallels;
2 using System;
2 using System;
3 using System.Collections.Generic;
3 using System.Collections.Generic;
4 using System.Linq;
4 using System.Linq;
5 using System.Text;
5 using System.Text;
6 using System.Threading;
6 using System.Threading;
7 using System.Threading.Tasks;
7 using System.Threading.Tasks;
8 using System.Windows.Forms;
8 using System.Windows.Forms;
9
9
10 namespace Implab.Diagnostics.Interactive
10 namespace Implab.Diagnostics.Interactive
11 {
11 {
12 public class InteractiveListener: ListenerBase
12 public class InteractiveListener: ListenerBase
13 {
13 {
14 TraceForm m_form;
14 TraceForm m_form;
15
15
16 SynchronizationContext m_syncGuiThread;
16 SynchronizationContext m_syncGuiThread;
17 readonly Promise m_guiStarted = new Promise();
17 readonly Promise m_guiStarted = new Promise();
18
18
19 readonly IPromise m_guiFinished;
19 readonly IPromise m_guiFinished;
20 // readonly IPromise m_workerFinished = new Promise<object>();
20 // readonly IPromise m_workerFinished = new Promise<object>();
21
21
22 readonly MTQueue<TraceViewItem> m_queue = new MTQueue<TraceViewItem>();
22 readonly MTQueue<TraceViewItem> m_queue = new MTQueue<TraceViewItem>();
23 readonly AutoResetEvent m_queueEvent = new AutoResetEvent(false);
23 readonly AutoResetEvent m_queueEvent = new AutoResetEvent(false);
24
24
25 int m_queueLength;
25 int m_queueLength;
26 bool m_exitPending;
26 bool m_exitPending;
27
27
28 readonly object m_pauseLock = new object();
28 readonly object m_pauseLock = new object();
29 bool m_paused;
29 bool m_paused;
30 readonly ManualResetEvent m_pauseEvent = new ManualResetEvent(true);
30 readonly ManualResetEvent m_pauseEvent = new ManualResetEvent(true);
31
31
32 public InteractiveListener() {
32 public InteractiveListener() {
33 m_guiFinished = AsyncPool.RunThread(GuiThread);
33 m_guiFinished = AsyncPool.RunThread(GuiThread);
34 /*m_workerFinished = */AsyncPool.RunThread(QueueThread);
34 /*m_workerFinished = */AsyncPool.RunThread(QueueThread);
35
35
36 m_guiStarted.Join();
36 m_guiStarted.Join();
37 }
37 }
38
38
39 void GuiThread() {
39 void GuiThread() {
40 m_form = new TraceForm(); // will create SynchronizationContext
40 m_form = new TraceForm(); // will create SynchronizationContext
41
41
42 m_form.PauseEvents += (s,a) => Pause();
42 m_form.PauseEvents += (s,a) => Pause();
43 m_form.ResumeEvents += (s, a) => Resume();
43 m_form.ResumeEvents += (s, a) => Resume();
44
44
45 m_syncGuiThread = SynchronizationContext.Current;
45 m_syncGuiThread = SynchronizationContext.Current;
46 m_guiStarted.Resolve();
46 m_guiStarted.Resolve();
47 Application.Run();
47 Application.Run();
48 }
48 }
49
49
50 void QueueThread() {
50 void QueueThread() {
51 while (!m_exitPending) {
51 while (!m_exitPending) {
52 if (m_paused)
52 if (m_paused)
53 m_pauseEvent.WaitOne();
53 m_pauseEvent.WaitOne();
54
54
55 TraceViewItem item;
55 TraceViewItem item;
56 if (m_queue.TryDequeue(out item)) {
56 if (m_queue.TryDequeue(out item)) {
57 Interlocked.Decrement(ref m_queueLength);
57 Interlocked.Decrement(ref m_queueLength);
58
58
59 m_syncGuiThread.Send(x => m_form.AddTraceEvent(item),null);
59 m_syncGuiThread.Post(x => m_form.AddTraceEvent(item),null);
60 } else {
60 } else {
61 m_queueEvent.WaitOne();
61 m_queueEvent.WaitOne();
62 }
62 }
63 }
63 }
64 }
64 }
65
65
66 public void Pause() {
66 public void Pause() {
67 // for consistency we need to set this properties atomically
67 // for consistency we need to set this properties atomically
68 lock (m_pauseLock) {
68 lock (m_pauseLock) {
69 m_pauseEvent.Reset();
69 m_pauseEvent.Reset();
70 m_paused = true;
70 m_paused = true;
71 }
71 }
72 }
72 }
73
73
74 public void Resume() {
74 public void Resume() {
75 // for consistency we need to set this properties atomically
75 // for consistency we need to set this properties atomically
76 lock (m_pauseLock) {
76 lock (m_pauseLock) {
77 m_paused = false;
77 m_paused = false;
78 m_pauseEvent.Set();
78 m_pauseEvent.Set();
79 }
79 }
80 }
80 }
81
81
82 void Enqueue(TraceViewItem item) {
82 void Enqueue(TraceViewItem item) {
83 m_queue.Enqueue(item);
83 m_queue.Enqueue(item);
84 if (Interlocked.Increment(ref m_queueLength) == 1)
84 if (Interlocked.Increment(ref m_queueLength) == 1)
85 m_queueEvent.Set();
85 m_queueEvent.Set();
86 }
86 }
87
87
88 public void ShowForm() {
88 public void ShowForm() {
89 m_syncGuiThread.Post(x => m_form.Show(), null);
89 m_syncGuiThread.Post(x => m_form.Show(), null);
90 }
90 }
91
91
92 public void HideForm() {
92 public void HideForm() {
93 m_syncGuiThread.Post(x => m_form.Hide(), null);
93 m_syncGuiThread.Post(x => m_form.Hide(), null);
94 }
94 }
95
95
96 void Terminate() {
96 void Terminate() {
97 m_exitPending = true;
97 m_exitPending = true;
98 Resume();
98 Resume();
99 m_syncGuiThread.Post(x => Application.ExitThread(), null);
99 m_syncGuiThread.Post(x => Application.ExitThread(), null);
100 }
100 }
101
101
102 protected override void Dispose(bool disposing) {
102 protected override void Dispose(bool disposing) {
103 if (disposing) {
103 if (disposing) {
104 Terminate();
104 Terminate();
105 m_guiFinished.Join();
105 m_guiFinished.Join();
106 }
106 }
107 base.Dispose(disposing);
107 base.Dispose(disposing);
108 }
108 }
109
109
110 public override void Write(LogEventArgs args, object entry) {
110 public override void Write(LogEventArgs args, object entry) {
111 var item = new TraceViewItem {
111 var item = new TraceViewItem {
112 Indent = args.Operation.Level,
112 Indent = args.Operation.Level,
113 Message = entry.ToString(),
113 Message = entry.ToString(),
114 Thread = args.ThreadId,
114 Thread = args.ThreadId,
115 Channel = args.Channel.ToString(),
115 Channel = args.Channel.ToString(),
116 Timestamp = Environment.TickCount
116 Timestamp = Environment.TickCount,
117 TimeDelta = args.OperationTimeOffset
117 };
118 };
118
119
119 Enqueue(item);
120 Enqueue(item);
120 }
121 }
121 }
122 }
122 }
123 }
@@ -1,134 +1,149
1 namespace Implab.Diagnostics.Interactive {
1 namespace Implab.Diagnostics.Interactive {
2 partial class TraceForm {
2 partial class TraceForm {
3 /// <summary>
3 /// <summary>
4 /// Required designer variable.
4 /// Required designer variable.
5 /// </summary>
5 /// </summary>
6 private System.ComponentModel.IContainer components = null;
6 private System.ComponentModel.IContainer components = null;
7
7
8 /// <summary>
8 /// <summary>
9 /// Clean up any resources being used.
9 /// Clean up any resources being used.
10 /// </summary>
10 /// </summary>
11 /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
11 /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
12 protected override void Dispose(bool disposing) {
12 protected override void Dispose(bool disposing) {
13 if (disposing && (components != null)) {
13 if (disposing && (components != null)) {
14 components.Dispose();
14 components.Dispose();
15 }
15 }
16 base.Dispose(disposing);
16 base.Dispose(disposing);
17 }
17 }
18
18
19 #region Windows Form Designer generated code
19 #region Windows Form Designer generated code
20
20
21 /// <summary>
21 /// <summary>
22 /// Required method for Designer support - do not modify
22 /// Required method for Designer support - do not modify
23 /// the contents of this method with the code editor.
23 /// the contents of this method with the code editor.
24 /// </summary>
24 /// </summary>
25 private void InitializeComponent() {
25 private void InitializeComponent() {
26 this.components = new System.ComponentModel.Container();
27 System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
26 System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
28 System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
27 System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
29 System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
28 System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
29 System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
30 this.eventsDataGrid = new System.Windows.Forms.DataGridView();
30 this.eventsDataGrid = new System.Windows.Forms.DataGridView();
31 this.traceViewItemBindingSource = new System.Windows.Forms.BindingSource(this.components);
31 this.traceViewItemBindingSource = new System.Windows.Forms.BindingSource();
32 this.threadDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
32 this.threadDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
33 this.TimeDelta = new System.Windows.Forms.DataGridViewTextBoxColumn();
33 this.Channel = new System.Windows.Forms.DataGridViewTextBoxColumn();
34 this.Channel = new System.Windows.Forms.DataGridViewTextBoxColumn();
34 this.messageDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
35 this.messageDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
35 ((System.ComponentModel.ISupportInitialize)(this.eventsDataGrid)).BeginInit();
36 ((System.ComponentModel.ISupportInitialize)(this.eventsDataGrid)).BeginInit();
36 ((System.ComponentModel.ISupportInitialize)(this.traceViewItemBindingSource)).BeginInit();
37 ((System.ComponentModel.ISupportInitialize)(this.traceViewItemBindingSource)).BeginInit();
37 this.SuspendLayout();
38 this.SuspendLayout();
38 //
39 //
39 // eventsDataGrid
40 // eventsDataGrid
40 //
41 //
41 this.eventsDataGrid.AllowUserToAddRows = false;
42 this.eventsDataGrid.AllowUserToAddRows = false;
42 this.eventsDataGrid.AllowUserToDeleteRows = false;
43 this.eventsDataGrid.AllowUserToDeleteRows = false;
43 this.eventsDataGrid.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
44 this.eventsDataGrid.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
44 | System.Windows.Forms.AnchorStyles.Left)
45 | System.Windows.Forms.AnchorStyles.Left)
45 | System.Windows.Forms.AnchorStyles.Right)));
46 | System.Windows.Forms.AnchorStyles.Right)));
46 this.eventsDataGrid.AutoGenerateColumns = false;
47 this.eventsDataGrid.AutoGenerateColumns = false;
47 this.eventsDataGrid.BackgroundColor = System.Drawing.SystemColors.Window;
48 this.eventsDataGrid.BackgroundColor = System.Drawing.SystemColors.Window;
48 dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
49 dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
49 dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
50 dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
50 dataGridViewCellStyle1.Font = new System.Drawing.Font("Lucida Console", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
51 dataGridViewCellStyle1.Font = new System.Drawing.Font("Lucida Console", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
51 dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;
52 dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;
52 dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
53 dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
53 dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
54 dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
54 dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
55 dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
55 this.eventsDataGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
56 this.eventsDataGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
56 this.eventsDataGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
57 this.eventsDataGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
57 this.eventsDataGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
58 this.eventsDataGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
58 this.threadDataGridViewTextBoxColumn,
59 this.threadDataGridViewTextBoxColumn,
60 this.TimeDelta,
59 this.Channel,
61 this.Channel,
60 this.messageDataGridViewTextBoxColumn});
62 this.messageDataGridViewTextBoxColumn});
61 this.eventsDataGrid.DataSource = this.traceViewItemBindingSource;
63 this.eventsDataGrid.DataSource = this.traceViewItemBindingSource;
62 dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
64 dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
63 dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Window;
65 dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Window;
64 dataGridViewCellStyle3.Font = new System.Drawing.Font("Lucida Console", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
66 dataGridViewCellStyle4.Font = new System.Drawing.Font("Lucida Console", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
65 dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.ControlText;
67 dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.ControlText;
66 dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight;
68 dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight;
67 dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
69 dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
68 dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
70 dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
69 this.eventsDataGrid.DefaultCellStyle = dataGridViewCellStyle3;
71 this.eventsDataGrid.DefaultCellStyle = dataGridViewCellStyle4;
70 this.eventsDataGrid.Location = new System.Drawing.Point(12, 12);
72 this.eventsDataGrid.Location = new System.Drawing.Point(12, 12);
71 this.eventsDataGrid.Name = "eventsDataGrid";
73 this.eventsDataGrid.Name = "eventsDataGrid";
72 this.eventsDataGrid.ReadOnly = true;
74 this.eventsDataGrid.ReadOnly = true;
75 this.eventsDataGrid.RowHeadersVisible = false;
73 this.eventsDataGrid.RowHeadersWidth = 17;
76 this.eventsDataGrid.RowHeadersWidth = 17;
74 this.eventsDataGrid.RowTemplate.Resizable = System.Windows.Forms.DataGridViewTriState.False;
77 this.eventsDataGrid.RowTemplate.Resizable = System.Windows.Forms.DataGridViewTriState.False;
75 this.eventsDataGrid.Size = new System.Drawing.Size(939, 480);
78 this.eventsDataGrid.Size = new System.Drawing.Size(939, 480);
76 this.eventsDataGrid.TabIndex = 1;
79 this.eventsDataGrid.TabIndex = 1;
77 this.eventsDataGrid.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.eventsDataGrid_CellFormatting);
80 this.eventsDataGrid.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.eventsDataGrid_CellFormatting);
78 //
81 //
79 // traceViewItemBindingSource
82 // traceViewItemBindingSource
80 //
83 //
81 this.traceViewItemBindingSource.DataSource = typeof(Implab.Diagnostics.Interactive.TraceViewItem);
84 this.traceViewItemBindingSource.DataSource = typeof(Implab.Diagnostics.Interactive.TraceViewItem);
82 //
85 //
83 // threadDataGridViewTextBoxColumn
86 // threadDataGridViewTextBoxColumn
84 //
87 //
85 this.threadDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
88 this.threadDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells;
86 this.threadDataGridViewTextBoxColumn.DataPropertyName = "Thread";
89 this.threadDataGridViewTextBoxColumn.DataPropertyName = "Thread";
87 this.threadDataGridViewTextBoxColumn.HeaderText = "TID";
90 this.threadDataGridViewTextBoxColumn.HeaderText = "TID";
88 this.threadDataGridViewTextBoxColumn.Name = "threadDataGridViewTextBoxColumn";
91 this.threadDataGridViewTextBoxColumn.Name = "threadDataGridViewTextBoxColumn";
89 this.threadDataGridViewTextBoxColumn.ReadOnly = true;
92 this.threadDataGridViewTextBoxColumn.ReadOnly = true;
90 this.threadDataGridViewTextBoxColumn.Width = 5;
93 this.threadDataGridViewTextBoxColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
94 this.threadDataGridViewTextBoxColumn.Width = 32;
95 //
96 // TimeDelta
97 //
98 this.TimeDelta.DataPropertyName = "TimeDelta";
99 dataGridViewCellStyle2.Format = "\'+\' 0 \'ms\'";
100 dataGridViewCellStyle2.NullValue = null;
101 this.TimeDelta.DefaultCellStyle = dataGridViewCellStyle2;
102 this.TimeDelta.HeaderText = "TimeDelta";
103 this.TimeDelta.Name = "TimeDelta";
104 this.TimeDelta.ReadOnly = true;
105 this.TimeDelta.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
91 //
106 //
92 // Channel
107 // Channel
93 //
108 //
94 this.Channel.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
95 this.Channel.DataPropertyName = "Channel";
109 this.Channel.DataPropertyName = "Channel";
96 this.Channel.HeaderText = "Channel";
110 this.Channel.HeaderText = "Channel";
97 this.Channel.Name = "Channel";
111 this.Channel.Name = "Channel";
98 this.Channel.ReadOnly = true;
112 this.Channel.ReadOnly = true;
99 this.Channel.Width = 79;
113 this.Channel.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
100 //
114 //
101 // messageDataGridViewTextBoxColumn
115 // messageDataGridViewTextBoxColumn
102 //
116 //
103 this.messageDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
117 this.messageDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
104 this.messageDataGridViewTextBoxColumn.DataPropertyName = "FormattedMessage";
118 this.messageDataGridViewTextBoxColumn.DataPropertyName = "FormattedMessage";
105 dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
119 dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
106 this.messageDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle2;
120 this.messageDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle3;
107 this.messageDataGridViewTextBoxColumn.HeaderText = "Message";
121 this.messageDataGridViewTextBoxColumn.HeaderText = "Message";
108 this.messageDataGridViewTextBoxColumn.Name = "messageDataGridViewTextBoxColumn";
122 this.messageDataGridViewTextBoxColumn.Name = "messageDataGridViewTextBoxColumn";
109 this.messageDataGridViewTextBoxColumn.ReadOnly = true;
123 this.messageDataGridViewTextBoxColumn.ReadOnly = true;
124 this.messageDataGridViewTextBoxColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
110 //
125 //
111 // TraceForm
126 // TraceForm
112 //
127 //
113 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
128 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
114 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
129 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
115 this.ClientSize = new System.Drawing.Size(963, 504);
130 this.ClientSize = new System.Drawing.Size(963, 504);
116 this.Controls.Add(this.eventsDataGrid);
131 this.Controls.Add(this.eventsDataGrid);
117 this.Name = "TraceForm";
132 this.Name = "TraceForm";
118 this.Text = "TraceForm";
133 this.Text = "TraceForm";
119 ((System.ComponentModel.ISupportInitialize)(this.eventsDataGrid)).EndInit();
134 ((System.ComponentModel.ISupportInitialize)(this.eventsDataGrid)).EndInit();
120 ((System.ComponentModel.ISupportInitialize)(this.traceViewItemBindingSource)).EndInit();
135 ((System.ComponentModel.ISupportInitialize)(this.traceViewItemBindingSource)).EndInit();
121 this.ResumeLayout(false);
136 this.ResumeLayout(false);
122
137
123 }
138 }
124
139
125 #endregion
140 #endregion
126
141
127 private System.Windows.Forms.DataGridView eventsDataGrid;
142 private System.Windows.Forms.DataGridView eventsDataGrid;
128 private System.Windows.Forms.BindingSource traceViewItemBindingSource;
143 private System.Windows.Forms.BindingSource traceViewItemBindingSource;
129 private System.Windows.Forms.DataGridViewTextBoxColumn threadDataGridViewTextBoxColumn;
144 private System.Windows.Forms.DataGridViewTextBoxColumn threadDataGridViewTextBoxColumn;
145 private System.Windows.Forms.DataGridViewTextBoxColumn TimeDelta;
130 private System.Windows.Forms.DataGridViewTextBoxColumn Channel;
146 private System.Windows.Forms.DataGridViewTextBoxColumn Channel;
131 private System.Windows.Forms.DataGridViewTextBoxColumn messageDataGridViewTextBoxColumn;
147 private System.Windows.Forms.DataGridViewTextBoxColumn messageDataGridViewTextBoxColumn;
132
133 }
148 }
134 } No newline at end of file
149 }
@@ -1,126 +1,129
1 ο»Ώ<?xml version="1.0" encoding="utf-8"?>
1 ο»Ώ<?xml version="1.0" encoding="utf-8"?>
2 <root>
2 <root>
3 <!--
3 <!--
4 Microsoft ResX Schema
4 Microsoft ResX Schema
5
5
6 Version 2.0
6 Version 2.0
7
7
8 The primary goals of this format is to allow a simple XML format
8 The primary goals of this format is to allow a simple XML format
9 that is mostly human readable. The generation and parsing of the
9 that is mostly human readable. The generation and parsing of the
10 various data types are done through the TypeConverter classes
10 various data types are done through the TypeConverter classes
11 associated with the data types.
11 associated with the data types.
12
12
13 Example:
13 Example:
14
14
15 ... ado.net/XML headers & schema ...
15 ... ado.net/XML headers & schema ...
16 <resheader name="resmimetype">text/microsoft-resx</resheader>
16 <resheader name="resmimetype">text/microsoft-resx</resheader>
17 <resheader name="version">2.0</resheader>
17 <resheader name="version">2.0</resheader>
18 <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
18 <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19 <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
19 <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20 <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
20 <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21 <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
21 <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22 <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
22 <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23 <value>[base64 mime encoded serialized .NET Framework object]</value>
23 <value>[base64 mime encoded serialized .NET Framework object]</value>
24 </data>
24 </data>
25 <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
25 <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26 <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
26 <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27 <comment>This is a comment</comment>
27 <comment>This is a comment</comment>
28 </data>
28 </data>
29
29
30 There are any number of "resheader" rows that contain simple
30 There are any number of "resheader" rows that contain simple
31 name/value pairs.
31 name/value pairs.
32
32
33 Each data row contains a name, and value. The row also contains a
33 Each data row contains a name, and value. The row also contains a
34 type or mimetype. Type corresponds to a .NET class that support
34 type or mimetype. Type corresponds to a .NET class that support
35 text/value conversion through the TypeConverter architecture.
35 text/value conversion through the TypeConverter architecture.
36 Classes that don't support this are serialized and stored with the
36 Classes that don't support this are serialized and stored with the
37 mimetype set.
37 mimetype set.
38
38
39 The mimetype is used for serialized objects, and tells the
39 The mimetype is used for serialized objects, and tells the
40 ResXResourceReader how to depersist the object. This is currently not
40 ResXResourceReader how to depersist the object. This is currently not
41 extensible. For a given mimetype the value must be set accordingly:
41 extensible. For a given mimetype the value must be set accordingly:
42
42
43 Note - application/x-microsoft.net.object.binary.base64 is the format
43 Note - application/x-microsoft.net.object.binary.base64 is the format
44 that the ResXResourceWriter will generate, however the reader can
44 that the ResXResourceWriter will generate, however the reader can
45 read any of the formats listed below.
45 read any of the formats listed below.
46
46
47 mimetype: application/x-microsoft.net.object.binary.base64
47 mimetype: application/x-microsoft.net.object.binary.base64
48 value : The object must be serialized with
48 value : The object must be serialized with
49 : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
49 : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
50 : and then encoded with base64 encoding.
50 : and then encoded with base64 encoding.
51
51
52 mimetype: application/x-microsoft.net.object.soap.base64
52 mimetype: application/x-microsoft.net.object.soap.base64
53 value : The object must be serialized with
53 value : The object must be serialized with
54 : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
54 : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55 : and then encoded with base64 encoding.
55 : and then encoded with base64 encoding.
56
56
57 mimetype: application/x-microsoft.net.object.bytearray.base64
57 mimetype: application/x-microsoft.net.object.bytearray.base64
58 value : The object must be serialized into a byte array
58 value : The object must be serialized into a byte array
59 : using a System.ComponentModel.TypeConverter
59 : using a System.ComponentModel.TypeConverter
60 : and then encoded with base64 encoding.
60 : and then encoded with base64 encoding.
61 -->
61 -->
62 <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
62 <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63 <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
63 <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
64 <xsd:element name="root" msdata:IsDataSet="true">
64 <xsd:element name="root" msdata:IsDataSet="true">
65 <xsd:complexType>
65 <xsd:complexType>
66 <xsd:choice maxOccurs="unbounded">
66 <xsd:choice maxOccurs="unbounded">
67 <xsd:element name="metadata">
67 <xsd:element name="metadata">
68 <xsd:complexType>
68 <xsd:complexType>
69 <xsd:sequence>
69 <xsd:sequence>
70 <xsd:element name="value" type="xsd:string" minOccurs="0" />
70 <xsd:element name="value" type="xsd:string" minOccurs="0" />
71 </xsd:sequence>
71 </xsd:sequence>
72 <xsd:attribute name="name" use="required" type="xsd:string" />
72 <xsd:attribute name="name" use="required" type="xsd:string" />
73 <xsd:attribute name="type" type="xsd:string" />
73 <xsd:attribute name="type" type="xsd:string" />
74 <xsd:attribute name="mimetype" type="xsd:string" />
74 <xsd:attribute name="mimetype" type="xsd:string" />
75 <xsd:attribute ref="xml:space" />
75 <xsd:attribute ref="xml:space" />
76 </xsd:complexType>
76 </xsd:complexType>
77 </xsd:element>
77 </xsd:element>
78 <xsd:element name="assembly">
78 <xsd:element name="assembly">
79 <xsd:complexType>
79 <xsd:complexType>
80 <xsd:attribute name="alias" type="xsd:string" />
80 <xsd:attribute name="alias" type="xsd:string" />
81 <xsd:attribute name="name" type="xsd:string" />
81 <xsd:attribute name="name" type="xsd:string" />
82 </xsd:complexType>
82 </xsd:complexType>
83 </xsd:element>
83 </xsd:element>
84 <xsd:element name="data">
84 <xsd:element name="data">
85 <xsd:complexType>
85 <xsd:complexType>
86 <xsd:sequence>
86 <xsd:sequence>
87 <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
87 <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
88 <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
88 <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
89 </xsd:sequence>
89 </xsd:sequence>
90 <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
90 <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
91 <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
91 <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
92 <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
92 <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
93 <xsd:attribute ref="xml:space" />
93 <xsd:attribute ref="xml:space" />
94 </xsd:complexType>
94 </xsd:complexType>
95 </xsd:element>
95 </xsd:element>
96 <xsd:element name="resheader">
96 <xsd:element name="resheader">
97 <xsd:complexType>
97 <xsd:complexType>
98 <xsd:sequence>
98 <xsd:sequence>
99 <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
99 <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
100 </xsd:sequence>
100 </xsd:sequence>
101 <xsd:attribute name="name" type="xsd:string" use="required" />
101 <xsd:attribute name="name" type="xsd:string" use="required" />
102 </xsd:complexType>
102 </xsd:complexType>
103 </xsd:element>
103 </xsd:element>
104 </xsd:choice>
104 </xsd:choice>
105 </xsd:complexType>
105 </xsd:complexType>
106 </xsd:element>
106 </xsd:element>
107 </xsd:schema>
107 </xsd:schema>
108 <resheader name="resmimetype">
108 <resheader name="resmimetype">
109 <value>text/microsoft-resx</value>
109 <value>text/microsoft-resx</value>
110 </resheader>
110 </resheader>
111 <resheader name="version">
111 <resheader name="version">
112 <value>2.0</value>
112 <value>2.0</value>
113 </resheader>
113 </resheader>
114 <resheader name="reader">
114 <resheader name="reader">
115 <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
115 <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116 </resheader>
116 </resheader>
117 <resheader name="writer">
117 <resheader name="writer">
118 <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
118 <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119 </resheader>
119 </resheader>
120 <metadata name="TimeDelta.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
121 <value>True</value>
122 </metadata>
120 <metadata name="Channel.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
123 <metadata name="Channel.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
121 <value>True</value>
124 <value>True</value>
122 </metadata>
125 </metadata>
123 <metadata name="traceViewItemBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
126 <metadata name="traceViewItemBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
124 <value>17, 17</value>
127 <value>17, 17</value>
125 </metadata>
128 </metadata>
126 </root> No newline at end of file
129 </root>
@@ -1,26 +1,27
1 using System;
1 using System;
2 using System.Collections.Generic;
2 using System.Collections.Generic;
3 using System.Linq;
3 using System.Linq;
4 using System.Text;
4 using System.Text;
5 using System.Threading.Tasks;
5 using System.Threading.Tasks;
6
6
7 namespace Implab.Diagnostics.Interactive {
7 namespace Implab.Diagnostics.Interactive {
8 public class TraceViewItem {
8 public class TraceViewItem {
9 string m_formattedValue;
9 string m_formattedValue;
10
10
11 public string Message { get; set; }
11 public string Message { get; set; }
12 public int TimeDelta { get; set; }
12 public int Timestamp { get; set; }
13 public int Timestamp { get; set; }
13 public int Indent { get; set; }
14 public int Indent { get; set; }
14 public int Thread { get; set; }
15 public int Thread { get; set; }
15 public string Channel { get; set; }
16 public string Channel { get; set; }
16
17
17 public string FormattedMessage {
18 public string FormattedMessage {
18 get {
19 get {
19 if (m_formattedValue == null) {
20 if (m_formattedValue == null) {
20 m_formattedValue = Message.Replace("\r",String.Empty).Replace("\n", " | ");
21 m_formattedValue = Message.Replace("\r",String.Empty).Replace("\n", " | ");
21 }
22 }
22 return m_formattedValue;
23 return m_formattedValue;
23 }
24 }
24 }
25 }
25 }
26 }
26 }
27 }
General Comments 3
Under Review
author

Auto status change to "Under Review"

Approved
author

ok, latest stable version should be in default

You need to be logged in to leave comments. Login now