Ejemplo n.º 1
0
        private void OnEtwListenerRealtimeEvent(object sender, RealtimeEventArgs e)
        {
            if (Status != ServiceControllerStatus.Running)
            {
                return;
            }

            EventRealtimeListener listener = (EventRealtimeListener)sender;

            EtwRecord record = new EtwRecord();

            record.ProcessId   = e.ProcessId;
            record.ProcessName = GetProcessName(e.ProcessId);
            record.Text        = e.Message;

            if (!_watch.IsRunning)
            {
                _watch.Start();
                // small hack; we ensure the first record has 0 ticks
                record.Ticks = 0;
            }
            else
            {
                record.Ticks = _watch.ElapsedTicks;
            }

            long index = Buffer.AddAndGetIndex(record);

            record.Index = index;

            if (listener.ConsoleOutput)
            {
                Host.Log(this, listener.Description + "|#" + record.Index + "|" + record.Ticks + "|" + record.ProcessId + "|" + record.ProcessName + "|" + record.Text);
            }
        }
Ejemplo n.º 2
0
        private void OnEtwListenerRealtimeEvent(object sender, RealtimeEventArgs e)
        {
            if (Status != ServiceControllerStatus.Running)
                return;

            EventRealtimeListener listener = (EventRealtimeListener)sender;

            EtwRecord record = new EtwRecord();
            record.ProcessId = e.ProcessId;
            record.ProcessName = GetProcessName(e.ProcessId);
            record.Text = e.Message;

            if (!_watch.IsRunning)
            {
                _watch.Start();
                // small hack; we ensure the first record has 0 ticks
                record.Ticks = 0;
            }
            else
            {
                record.Ticks = _watch.ElapsedTicks;
            }

            long index = Buffer.AddAndGetIndex(record);
            record.Index = index;

            if (listener.ConsoleOutput)
            {
                Host.Log(this, listener.Description + "|#" + record.Index + "|" + record.Ticks + "|" + record.ProcessId + "|" + record.ProcessName + "|" + record.Text);
            }
        }