static EventDescriptor GetEventDescriptor(int eventId, TraceChannel channel, TraceEventLevel traceEventLevel)
 {
     unchecked
     {
         //map channel to keywords
         long keyword = (long)0x0;
         if (channel == TraceChannel.Admin)
         {
             keyword = keyword | (long)0x8000000000000000;
         }
         else if (channel == TraceChannel.Operational)
         {
             keyword = keyword | 0x4000000000000000;
         }
         else if (channel == TraceChannel.Analytic)
         {
             keyword = keyword | 0x2000000000000000;
         }
         else if (channel == TraceChannel.Debug)
         {
             keyword = keyword | 0x100000000000000;
         }
         else if (channel == TraceChannel.Perf)
         {
             keyword = keyword | 0x0800000000000000;
         }
         return(new EventDescriptor(eventId, 0x0, (byte)channel, (byte)traceEventLevel, 0x0, 0x0, (long)keyword));
     }
 }
 public void Event(int eventId, TraceEventLevel traceEventLevel, TraceChannel channel, string description)
 {
     if (this.TracingEnabled)
     {
         EventDescriptor eventDescriptor = EtwDiagnosticTrace.GetEventDescriptor(eventId, channel, traceEventLevel);
         this.Event(ref eventDescriptor, description);
     }
 }
Example #3
0
        private static string LookupChannel(TraceChannel traceChannel)
        {
            string       str;
            TraceChannel traceChannel1 = traceChannel;

            if (traceChannel1 == TraceChannel.Application)
            {
                str = "Application";
            }
            else
            {
                switch (traceChannel1)
                {
                case TraceChannel.Admin:
                {
                    str = "Admin";
                    break;
                }

                case TraceChannel.Operational:
                {
                    str = "Operational";
                    break;
                }

                case TraceChannel.Analytic:
                {
                    str = "Analytic";
                    break;
                }

                case TraceChannel.Debug:
                {
                    str = "Debug";
                    break;
                }

                case TraceChannel.Perf:
                {
                    str = "Perf";
                    break;
                }

                default:
                {
                    str = traceChannel.ToString();
                    break;
                }
                }
            }
            return(str);
        }
Example #4
0
		public TraceOperationImpl(TraceChannel channel, string operationKey)
		{
			_id = CombGuid.Generate();
			_startTime = SystemUtil.UtcNow;
			_stopwatch = Stopwatch.StartNew();
			_channel = channel;
			_operationKey = operationKey;

			_channel.Send<TraceOperationStarted>(new TraceOperationStartedImpl
				{
					Id = _id,
					StartTime = _startTime,
				});
		}
Example #5
0
        public TraceOperationImpl(TraceChannel channel, string operationKey)
        {
            _id           = CombGuid.Generate();
            _startTime    = SystemUtil.UtcNow;
            _stopwatch    = Stopwatch.StartNew();
            _channel      = channel;
            _operationKey = operationKey;

            _channel.Send <TraceOperationStarted>(new TraceOperationStartedImpl
            {
                Id        = _id,
                StartTime = _startTime,
            });
        }
Example #6
0
        private static EventDescriptor GetEventDescriptor(int eventId, TraceChannel channel, TraceEventLevel traceEventLevel)
        {
            long num = (long)0;

            if (channel != TraceChannel.Admin)
            {
                if (channel != TraceChannel.Operational)
                {
                    if (channel != TraceChannel.Analytic)
                    {
                        if (channel != TraceChannel.Debug)
                        {
                            if (channel == TraceChannel.Perf)
                            {
                                num = num | 0x800000000000000L;
                            }
                        }
                        else
                        {
                            num = num | 0x100000000000000L;
                        }
                    }
                    else
                    {
                        num = num | 0x2000000000000000L;
                    }
                }
                else
                {
                    num = num | 0x4000000000000000L;
                }
            }
            else
            {
                num = num | -9223372036854775808L;
            }
            return(new EventDescriptor(eventId, 0, (byte)channel, (byte)traceEventLevel, 0, 0, num));
        }
Example #7
0
        private static string LookupChannel(TraceChannel traceChannel)
        {
            string channelName;

            switch (traceChannel)
            {
            case TraceChannel.Admin:
                channelName = "Admin";
                break;

            case TraceChannel.Analytic:
                channelName = "Analytic";
                break;

            case TraceChannel.Application:
                channelName = "Application";
                break;

            case TraceChannel.Debug:
                channelName = "Debug";
                break;

            case TraceChannel.Operational:
                channelName = "Operational";
                break;

            case TraceChannel.Perf:
                channelName = "Perf";
                break;

            default:
                channelName = traceChannel.ToString();
                break;
            }

            return(channelName);
        }
Example #8
0
        private static string LookupChannel(TraceChannel traceChannel)
        {
            switch (traceChannel)
            {
            case TraceChannel.Admin:
                return("Admin");

            case TraceChannel.Operational:
                return("Operational");

            case TraceChannel.Analytic:
                return("Analytic");

            case TraceChannel.Debug:
                return("Debug");

            case TraceChannel.Perf:
                return("Perf");

            case TraceChannel.Application:
                return("Application");
            }
            return(traceChannel.ToString());
        }
 private static System.Diagnostics.Eventing.EventDescriptor GetEventDescriptor(int eventId, TraceChannel channel, TraceEventLevel traceEventLevel)
 {
     long keywords = 0L;
     if (channel == TraceChannel.Admin)
     {
         keywords |= -9223372036854775808L;
     }
     else if (channel == TraceChannel.Operational)
     {
         keywords |= 0x4000000000000000L;
     }
     else if (channel == TraceChannel.Analytic)
     {
         keywords |= 0x2000000000000000L;
     }
     else if (channel == TraceChannel.Debug)
     {
         keywords |= 0x100000000000000L;
     }
     else if (channel == TraceChannel.Perf)
     {
         keywords |= 0x800000000000000L;
     }
     return new System.Diagnostics.Eventing.EventDescriptor(eventId, 0, (byte) channel, (byte) traceEventLevel, 0, 0, keywords);
 }
Example #10
0
		private static string LookupChannel(TraceChannel traceChannel)
		{
			string str;
			TraceChannel traceChannel1 = traceChannel;
			if (traceChannel1 == TraceChannel.Application)
			{
				str = "Application";
			}
			else
			{
				switch (traceChannel1)
				{
					case TraceChannel.Admin:
					{
						str = "Admin";
						break;
					}
					case TraceChannel.Operational:
					{
						str = "Operational";
						break;
					}
					case TraceChannel.Analytic:
					{
						str = "Analytic";
						break;
					}
					case TraceChannel.Debug:
					{
						str = "Debug";
						break;
					}
					case TraceChannel.Perf:
					{
						str = "Perf";
						break;
					}
					default:
					{
						str = traceChannel.ToString();
						break;
					}
				}
			}
			return str;
		}
Example #11
0
 /// <summary>
 /// Trace a message
 /// </summary>
 /// <param name="channel">channel to send message to</param>
 /// <param name="line">message to trace</param>
 public static void Trace(TraceChannel channel, string line)
 {
     try
     {
         bool isActive = sm_ActiveChannels.Contains(channel);
         if (isActive)
         {
             switch (sm_Destination)
             {
                 case TraceDestination.Memory:
                     Append(line);
                     break;
                 case TraceDestination.Console:
                     Console.WriteLine(line);
                     break;
                 case TraceDestination.Debug:
                     Debug.WriteLine(line);
                     break;
                 case TraceDestination.Browser:
                     Append(line + "<br>");
                     break;
             }
         }
     }
     catch (ArgumentOutOfRangeException)
     {
         // Exceeded maximum memory trace capacity
         ResetMemory();
     }
 }
Example #12
0
 /// <summary>
 /// Format a message and trace
 /// </summary>
 /// <param name="channel">channel to send to</param>
 /// <param name="format">format string</param>
 /// <param name="list">format string parameters</param>
 public static void Trace(TraceChannel channel, string format, params object[] list)
 {
     string line = String.Format(CultureInfo.InvariantCulture, format, list);
     Trace(channel, line);
 }
Example #13
0
 /// <summary>
 /// Activates the given channel
 /// </summary>
 /// <param name="channel">channel to activate</param>
 private static void ActivateChannel(TraceChannel channel)
 {
     sm_ActiveChannels.Add(channel);
 }
Example #14
0
        private static System.Diagnostics.Eventing.EventDescriptor GetEventDescriptor(int eventId, TraceChannel channel, TraceEventLevel traceEventLevel)
        {
            long keywords = 0L;

            if (channel == TraceChannel.Admin)
            {
                keywords |= -9223372036854775808L;
            }
            else if (channel == TraceChannel.Operational)
            {
                keywords |= 0x4000000000000000L;
            }
            else if (channel == TraceChannel.Analytic)
            {
                keywords |= 0x2000000000000000L;
            }
            else if (channel == TraceChannel.Debug)
            {
                keywords |= 0x100000000000000L;
            }
            else if (channel == TraceChannel.Perf)
            {
                keywords |= 0x800000000000000L;
            }
            return(new System.Diagnostics.Eventing.EventDescriptor(eventId, 0, (byte)channel, (byte)traceEventLevel, 0, 0, keywords));
        }
Example #15
0
		private static EventDescriptor GetEventDescriptor(int eventId, TraceChannel channel, TraceEventLevel traceEventLevel)
		{
			long num = (long)0;
			if (channel != TraceChannel.Admin)
			{
				if (channel != TraceChannel.Operational)
				{
					if (channel != TraceChannel.Analytic)
					{
						if (channel != TraceChannel.Debug)
						{
							if (channel == TraceChannel.Perf)
							{
								num = num | 0x800000000000000L;
							}
						}
						else
						{
							num = num | 0x100000000000000L;
						}
					}
					else
					{
						num = num | 0x2000000000000000L;
					}
				}
				else
				{
					num = num | 0x4000000000000000L;
				}
			}
			else
			{
				num = num | -9223372036854775808L;
			}
			return new EventDescriptor(eventId, 0, (byte)channel, (byte)traceEventLevel, 0, 0, num);
		}
 static EventDescriptor GetEventDescriptor(int eventId, TraceChannel channel, TraceEventLevel traceEventLevel)
 {
     unchecked
     {
         //map channel to keywords
         long keyword = (long)0x0;
         if (channel == TraceChannel.Admin)
         {
             keyword = keyword | (long)0x8000000000000000;
         }
         else if (channel == TraceChannel.Operational)
         {
             keyword = keyword | 0x4000000000000000;
         }
         else if (channel == TraceChannel.Analytic)
         {
             keyword = keyword | 0x2000000000000000;
         }
         else if (channel == TraceChannel.Debug)
         {
             keyword = keyword | 0x100000000000000;
         }
         else if (channel == TraceChannel.Perf)
         {
             keyword = keyword | 0x0800000000000000;
         }
         return new EventDescriptor(eventId, 0x0, (byte)channel, (byte)traceEventLevel, 0x0, 0x0, (long)keyword);
     }
 }
 public void Event(int eventId, TraceEventLevel traceEventLevel, TraceChannel channel, string description)
 {
     if (this.TracingEnabled)
     {
         EventDescriptor eventDescriptor = EtwDiagnosticTrace.GetEventDescriptor(eventId, channel, traceEventLevel);
         this.Event(ref eventDescriptor, description);
     }
 }
        static string LookupChannel(TraceChannel traceChannel)
        {
            string channelName;
            switch (traceChannel)
            {
                case TraceChannel.Admin:
                    channelName = "Admin";
                    break;
                case TraceChannel.Analytic:
                    channelName = "Analytic";
                    break;
                case TraceChannel.Application:
                    channelName = "Application";
                    break;
                case TraceChannel.Debug:
                    channelName = "Debug";
                    break;
                case TraceChannel.Operational:
                    channelName = "Operational";
                    break;
                case TraceChannel.Perf:
                    channelName = "Perf";
                    break;
                default:
                    channelName = traceChannel.ToString();
                    break;
            }

            return channelName;
        }
        private static string LookupChannel(TraceChannel traceChannel)
        {
            switch (traceChannel)
            {
                case TraceChannel.Admin:
                    return "Admin";

                case TraceChannel.Operational:
                    return "Operational";

                case TraceChannel.Analytic:
                    return "Analytic";

                case TraceChannel.Debug:
                    return "Debug";

                case TraceChannel.Perf:
                    return "Perf";

                case TraceChannel.Application:
                    return "Application";
            }
            return traceChannel.ToString();
        }
Example #20
0
        private static System.Diagnostics.Eventing.EventDescriptor GetEventDescriptor(int eventId, TraceChannel channel, TraceEventLevel traceEventLevel)
        {
            long num = (long)0;

            if (channel == TraceChannel.Admin)
            {
                num = num | -9223372036854775808L;
            }
            else if (channel == TraceChannel.Operational)
            {
                num = num | 4611686018427387904L;
            }
            else if (channel == TraceChannel.Analytic)
            {
                num = num | 2305843009213693952L;
            }
            else if (channel == TraceChannel.Debug)
            {
                num = num | 72057594037927936L;
            }
            else if (channel == TraceChannel.Perf)
            {
                num = num | 576460752303423488L;
            }
            return(new System.Diagnostics.Eventing.EventDescriptor(eventId, 0, (byte)channel, (byte)traceEventLevel, 0, 0, num));
        }
Example #21
0
 public static TraceOperation BeginOperation(this TraceChannel channel, string operationKey)
 {
     return(new TraceOperationImpl(channel, operationKey));
 }