本文整理汇总了C#中System.Diagnostics.Tracing.EventSource.WriteEventWithRelatedActivityId方法的典型用法代码示例。如果您正苦于以下问题:C# EventSource.WriteEventWithRelatedActivityId方法的具体用法?C# EventSource.WriteEventWithRelatedActivityId怎么用?C# EventSource.WriteEventWithRelatedActivityId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Diagnostics.Tracing.EventSource
的用法示例。
在下文中一共展示了EventSource.WriteEventWithRelatedActivityId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RequestStart
[EventSource(Name = "Litware-ProductName-ComponentName")]
public sealed class LitwareComponentNameEventSource : EventSource
{
[Event(1, Task = Tasks.Request, Opcode = EventOpcode.Send)]
public void RequestStart(Guid relatedActivityId, int reqId, string url)
{
WriteEventWithRelatedActivityId(1, relatedActivityId, reqId, url);
}
}
开发者ID:.NET开发者,项目名称:System.Diagnostics.Tracing,代码行数:9,代码来源:EventSource.WriteEventWithRelatedActivityId
示例2: RequestStart
[EventSource(Name = "Contoso-ProductName-ComponentName")]
public sealed class CustomizedForPerfEventSource : EventSource
{
[Event(1, Task = Tasks.Request, Opcode = EventOpcode.Send)]
public void RequestStart(Guid relatedActivityId, int reqId, string url)
{
if (IsEnabled())
WriteEventWithRelatedActivityId(1, relatedActivityId, reqId, url);
}
[NonEvent]
unsafe protected void WriteEventWithRelatedActivityId(int eventId, Guid relatedActivityId,
int arg1, string arg2)
{
if (IsEnabled())
{
if (arg2 == null) arg2 = string.Empty;
fixed (char* stringBytes = arg2)
{
EventData* descrs = stackalloc EventData[2];
descrs[0].DataPointer = (IntPtr)(&arg1);
descrs[0].Size = 4;
descrs[1].DataPointer = (IntPtr)stringBytes;
descrs[1].Size = ((arg2.Length + 1) * 2);
WriteEventWithRelatedActivityIdCore(eventId,
&relatedActivityId, 2, descrs);
}
}
}
开发者ID:.NET开发者,项目名称:System.Diagnostics.Tracing,代码行数:29,代码来源:EventSource.WriteEventWithRelatedActivityId