当前位置: 首页>>代码示例>>C#>>正文


C# Diagnostics.EventTraceActivity类代码示例

本文整理汇总了C#中System.Runtime.Diagnostics.EventTraceActivity的典型用法代码示例。如果您正苦于以下问题:C# EventTraceActivity类的具体用法?C# EventTraceActivity怎么用?C# EventTraceActivity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


EventTraceActivity类属于System.Runtime.Diagnostics命名空间,在下文中一共展示了EventTraceActivity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TrackingRecord

 protected TrackingRecord(Guid instanceId)
 {
     this.InstanceId = instanceId;
     this.EventTime = DateTime.UtcNow;
     this.Level = TraceLevel.Info;
     this.eventTraceActivity = new EventTraceActivity(instanceId);
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:7,代码来源:TrackingRecord.cs

示例2: WriteEvent

        internal unsafe bool WriteEvent(ref EventDescriptor eventDescriptor, EventTraceActivity eventTraceActivity, Guid value1, string value2, string value3)
        {
            const int argumentCount = 3;
            bool status = true;

            //check all strings for null            
            value2 = (value2 ?? string.Empty);
            value3 = (value3 ?? string.Empty);

            fixed (char* string1Bytes = value2, string2Bytes = value3)
            {
                byte* eventData = stackalloc byte[sizeof(UnsafeNativeMethods.EventData) * argumentCount];
                UnsafeNativeMethods.EventData* eventDataPtr = (UnsafeNativeMethods.EventData*)eventData;

                eventDataPtr[0].DataPointer = (ulong)(&value1);
                eventDataPtr[0].Size = (uint)(sizeof(Guid));

                eventDataPtr[1].DataPointer = (ulong)string1Bytes;
                eventDataPtr[1].Size = (uint)(value2.Length + 1) * sizeof(char);
            
                eventDataPtr[2].DataPointer = (ulong)string2Bytes;
                eventDataPtr[2].Size = (uint)(value3.Length + 1) * sizeof(char);                

                status = WriteEvent(ref eventDescriptor, eventTraceActivity, argumentCount, (IntPtr)(eventData));
            }

            return status;
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:28,代码来源:EtwProvider.cs

示例3: ActionItemScheduled

		internal static void ActionItemScheduled(EtwDiagnosticTrace trace, EventTraceActivity eventTraceActivity)
		{
			TracePayload serializedPayload = trace.GetSerializedPayload(null, null, null);
			if (TraceCore.IsEtwEventEnabled(trace, 13))
			{
				TraceCore.WriteEtwEvent(trace, 13, eventTraceActivity, serializedPayload.AppDomainFriendlyName);
			}
		}
开发者ID:nickchal,项目名称:pash,代码行数:8,代码来源:TraceCore.Designer.cs

示例4: SqlCommandAsyncResult

 public SqlCommandAsyncResult(SqlCommand sqlCommand, string connectionString, EventTraceActivity eventTraceActivity, DependentTransaction dependentTransaction,
     TimeSpan timeout, int retryCount, int maximumRetries, AsyncCallback callback, object state)
     : base(callback, state)
 {
     long openTimeout = Math.Min(timeout.Ticks, SqlCommandAsyncResult.MaximumOpenTimeout.Ticks);
     this.sqlCommand = sqlCommand;
     this.connectionString = connectionString;
     this.eventTraceActivity = eventTraceActivity;
     this.dependentTransaction = dependentTransaction;
     this.timeoutHelper = new TimeoutHelper(TimeSpan.FromTicks(openTimeout));
     this.retryCount = retryCount;
     this.maximumRetries = maximumRetries;
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:13,代码来源:SqlCommandAsyncResult.cs

示例5: TryAttachActivity

        public static bool TryAttachActivity(Message message, EventTraceActivity activity)
        {
            if (FxTrace.Trace.IsEnd2EndActivityTracingEnabled && (message != null) && (activity != null))
            {
                if (!message.Properties.ContainsKey(EventTraceActivity.Name))
                {
                    message.Properties.Add(EventTraceActivity.Name, activity);
                    return true;
                }
            }

            return false;
        }
开发者ID:weshaggard,项目名称:wcf,代码行数:13,代码来源:EventTraceActivityHelper.cs

示例6: InstanceHandle

        internal InstanceHandle(InstanceStore store, InstanceOwner owner, Guid instanceId)
        {
            Fx.Assert(store != null, "Shouldn't be possible here either.");
            Fx.Assert(instanceId != Guid.Empty, "Should be validating this.");

            Version = -1;
            Store = store;
            Owner = owner;
            Id = instanceId;
            View = new InstanceView(owner, instanceId);
            IsValid = true;
            if (Fx.Trace.IsEtwProviderEnabled)
            {
                eventTraceActivity = new EventTraceActivity(instanceId);
            }
        }
开发者ID:uQr,项目名称:referencesource,代码行数:16,代码来源:InstanceHandle.cs

示例7: InstancePersistenceContext

        internal InstancePersistenceContext(InstanceHandle handle, Transaction transaction)
            : this(handle)
        {
            Fx.Assert(transaction != null, "Null Transaction passed to InstancePersistenceContext.");

            // Let's take our own clone of the transaction. We need to do this because we might need to
            // create a TransactionScope using the transaction and in cases where we are dealing with a
            // transaction that is flowed into the workflow on a message, the DependentTransaction that the
            // dispatcher creates and sets to Transaction.Current may already be Completed by the time a
            // Save operation is done. And since TransactionScope creates a DependentTransaction, it won't
            // be able to.
            // We don't create another DependentClone because we are going to do a EnlistVolatile on the
            // transaction ourselves.
            this.transaction = transaction.Clone();
            IsHostTransaction = true;
            this.eventTraceActivity = handle.EventTraceActivity;
        }
开发者ID:uQr,项目名称:referencesource,代码行数:17,代码来源:InstancePersistenceContext.cs

示例8: TryExtractActivity

        public static EventTraceActivity TryExtractActivity(Message message, bool createIfNotExist)
        {
            EventTraceActivity eventTraceActivity = null;

            if (message != null && message.State != MessageState.Closed)
            {
                object property;
                if (message.Properties.TryGetValue(EventTraceActivity.Name, out property))
                {
                    eventTraceActivity = property as EventTraceActivity;
                }

                if (eventTraceActivity == null)
                {
                    Guid activityId;
                    if (GetMessageId(message, out activityId))
                    {
                        eventTraceActivity = new EventTraceActivity(activityId);
                    }
                    else
                    {
                        UniqueId uid = message.Headers.RelatesTo;
                        if (uid != null)
                        {
                            if (uid.TryGetGuid(out activityId))
                            {
                                eventTraceActivity = new EventTraceActivity(activityId);
                            }
                        }
                    }

                    if (eventTraceActivity == null && createIfNotExist)
                    {
                        eventTraceActivity = new EventTraceActivity();
                    }

                    if (eventTraceActivity != null)
                    {
                        // Attach the trace activity to the message
                        message.Properties[EventTraceActivity.Name] = eventTraceActivity;
                    }
                }
            }

            return eventTraceActivity;
        }
开发者ID:weshaggard,项目名称:wcf,代码行数:46,代码来源:EventTraceActivityHelper.cs

示例9: WriteEvent

		internal unsafe bool WriteEvent(ref EventDescriptor eventDescriptor, EventTraceActivity eventTraceActivity, Guid value1, string value2, string value3)
		{
			string str = value2;
			string empty = str;
			if (str == null)
			{
				empty = string.Empty;
			}
			value2 = empty;
			string str1 = value3;
			string empty1 = str1;
			if (str1 == null)
			{
				empty1 = string.Empty;
			}
			value3 = empty1;
			fixed (string str2 = value2)
			{
				string* strPointers = &str2;
				char* offsetToStringData = (char*)(&str2);
				if (&str2 != null)
				{
					offsetToStringData = (char*)(strPointers + RuntimeHelpers.OffsetToStringData);
				}
				char* chrPointer = offsetToStringData;
				fixed (string str3 = value3)
				{
					string* strPointers1 = &str3;
					char* offsetToStringData1 = (char*)(&str3);
					if (&str3 != null)
					{
						offsetToStringData1 = (char*)(strPointers1 + RuntimeHelpers.OffsetToStringData);
					}
					byte* length = (byte*)sizeof(UnsafeNativeMethods.EventData) * 3;
					(*((UnsafeNativeMethods.EventData*)length)).DataPointer = (ulong)(&value1);
					(*((UnsafeNativeMethods.EventData*)length)).Size = sizeof(Guid);
					((UnsafeNativeMethods.EventData*)length + sizeof(UnsafeNativeMethods.EventData)).DataPointer = (ulong)chrPointer;
					((UnsafeNativeMethods.EventData*)length + sizeof(UnsafeNativeMethods.EventData)).Size = (value2.Length + 1) * 2;
					((UnsafeNativeMethods.EventData*)length + 2 * sizeof(UnsafeNativeMethods.EventData)).DataPointer = (ulong)offsetToStringData1;
					((UnsafeNativeMethods.EventData*)length + 2 * sizeof(UnsafeNativeMethods.EventData)).Size = (value3.Length + 1) * 2;
					bool flag = base.WriteEvent(ref eventDescriptor, eventTraceActivity, 3, (IntPtr)length);
					return flag;
				}
			}
		}
开发者ID:nickchal,项目名称:pash,代码行数:45,代码来源:EtwProvider.cs

示例10: TransportOutputChannel

        protected TransportOutputChannel(ChannelManagerBase channelManager, EndpointAddress to, Uri via, bool manualAddressing, MessageVersion messageVersion)
            : base(channelManager)
        {
            _manualAddressing = manualAddressing;
            _messageVersion = messageVersion;
            _to = to;
            _via = via;

            if (!manualAddressing && to != null)
            {
                Uri toUri;
                if (to.IsAnonymous)
                {
                    toUri = _messageVersion.Addressing.AnonymousUri;
                }
                else if (to.IsNone)
                {
                    toUri = _messageVersion.Addressing.NoneUri;
                }
                else
                {
                    toUri = to.Uri;
                }

                if (toUri != null)
                {
                    XmlDictionaryString dictionaryTo = new ToDictionary(toUri.AbsoluteUri).To;
                    _toHeader = ToHeader.Create(toUri, dictionaryTo, messageVersion.Addressing);
                }

                _anyHeadersToAdd = to.Headers.Count > 0;
            }

            if (FxTrace.Trace.IsEnd2EndActivityTracingEnabled)
            {
                _channelEventTraceActivity = EventTraceActivity.GetFromThreadOrCreate();
            }
        }
开发者ID:weshaggard,项目名称:wcf,代码行数:38,代码来源:TransportOutputChannel.cs

示例11: WriteMessageEvent

 public bool WriteMessageEvent(EventTraceActivity eventTraceActivity, string eventMessage)
 {
     return WriteMessageEvent(eventTraceActivity, eventMessage, 0, 0);
 }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:4,代码来源:DiagnosticEventProvider.cs

示例12: SetOnThread

 internal static void SetOnThread(EventTraceActivity eventTraceActivity)
 {
     if (eventTraceActivity != null)
     {
     }
 }
开发者ID:weshaggard,项目名称:wcf,代码行数:6,代码来源:EventTraceActivityHelper.cs

示例13: WriteEvent

        internal protected bool WriteEvent(ref EventDescriptor eventDescriptor, EventTraceActivity eventTraceActivity, int dataCount, IntPtr data)
        {
            uint status = 0;

            if (eventTraceActivity != null)
            {
                SetActivityId(ref eventTraceActivity.ActivityId);
            }

            unsafe
            {
                status = UnsafeNativeMethods.EventWrite(this.traceRegistrationHandle, ref eventDescriptor, (uint)dataCount, (UnsafeNativeMethods.EventData*)data);
            }
            if (status != 0)
            {
                SetLastError((int)status);
                return false;
            }
            return true;
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:20,代码来源:DiagnosticEventProvider.cs

示例14: CreateContext

 internal static HttpRequestContext CreateContext(HttpChannelListener listener, HttpListenerContext listenerContext, EventTraceActivity eventTraceActivity)
 {
     return new ListenerHttpContext(listener, listenerContext, eventTraceActivity);
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:4,代码来源:HttpRequestContext.cs

示例15: TraceHttpMessageReceived

        void TraceHttpMessageReceived(Message message)
        {
            if (FxTrace.Trace.IsEnd2EndActivityTracingEnabled)
            {
                bool attached = false;
                Guid relatedId = this.eventTraceActivity != null ? this.eventTraceActivity.ActivityId : Guid.Empty;
                HttpRequestMessageProperty httpProperty;

                // Encoder will always add an activity. We need to remove this and read it
                // from the web headers for http since correlation might be propogated.
                if (message.Headers.MessageId == null &&
                    message.Properties.TryGetValue<HttpRequestMessageProperty>(HttpRequestMessageProperty.Name, out httpProperty))
                {
                    try
                    {
                        string e2eId = httpProperty.Headers[EventTraceActivity.Name];
                        if (!String.IsNullOrEmpty(e2eId))
                        {
                            byte[] data = Convert.FromBase64String(e2eId);
                            if (data != null && data.Length == 16)
                            {
                                Guid id = new Guid(data);
                                this.eventTraceActivity = new EventTraceActivity(id, true);
                                message.Properties[EventTraceActivity.Name] = this.eventTraceActivity;
                                attached = true;
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        if (Fx.IsFatal(ex))
                        {
                            throw;
                        }
                    }
                }

                if (!attached)
                {
                    this.eventTraceActivity = EventTraceActivityHelper.TryExtractActivity(message, true);
                }

                if (TD.MessageReceivedByTransportIsEnabled())
                {
                    TD.MessageReceivedByTransport(
                        this.eventTraceActivity,
                        this.listener != null && this.listener.Uri != null ? this.listener.Uri.AbsoluteUri : string.Empty,
                        relatedId);
                }
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:51,代码来源:HttpRequestContext.cs


注:本文中的System.Runtime.Diagnostics.EventTraceActivity类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。