1 //------------------------------------------------------------------------------
2 // <copyright file="etwprovider.cs" company="Microsoft">
3 // Copyright (c) Microsoft Corporation. All rights reserved.
5 // <OWNER>Microsoft</OWNER>
6 //------------------------------------------------------------------------------
8 using System
.Runtime
.InteropServices
;
10 #if ES_BUILD_STANDALONE
11 using Environment
= Microsoft
.Diagnostics
.Tracing
.Internal
.Environment
;
14 #if !ES_BUILD_AGAINST_DOTNET_V35
15 using Contract
= System
.Diagnostics
.Contracts
.Contract
;
17 using Contract
= Microsoft
.Diagnostics
.Contracts
.Internal
.Contract
;
20 #if ES_BUILD_STANDALONE
21 namespace Microsoft
.Diagnostics
.Tracing
23 namespace System
.Diagnostics
.Tracing
26 [StructLayout(LayoutKind
.Explicit
, Size
= 16)]
27 [System
.Security
.Permissions
.HostProtection(MayLeakOnAbort
= true)]
28 internal struct EventDescriptor
32 private int m_traceloggingId
;
36 private byte m_version
;
38 private byte m_channel
;
42 private byte m_opcode
;
44 private ushort m_task
;
46 private long m_keywords
;
49 public EventDescriptor(
59 this.m_traceloggingId
= traceloggingId
;
61 this.m_opcode
= opcode
;
63 this.m_keywords
= keywords
;
66 public EventDescriptor(
78 throw new ArgumentOutOfRangeException("id", Environment
.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
81 if (id
> ushort.MaxValue
)
83 throw new ArgumentOutOfRangeException("id", Environment
.GetResourceString("ArgumentOutOfRange_NeedValidId", 1, ushort.MaxValue
));
92 m_keywords
= keywords
;
96 throw new ArgumentOutOfRangeException("task", Environment
.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
99 if (task
> ushort.MaxValue
)
101 throw new ArgumentOutOfRangeException("task", Environment
.GetResourceString("ArgumentOutOfRange_NeedValidId", 1, ushort.MaxValue
));
104 m_task
= (ushort)task
;
155 public override bool Equals(object obj
)
157 if (!(obj
is EventDescriptor
))
160 return Equals((EventDescriptor
) obj
);
163 public override int GetHashCode()
165 return m_id ^ m_version ^ m_channel ^ m_level ^ m_opcode ^ m_task ^
(int)m_keywords
;
168 public bool Equals(EventDescriptor other
)
170 if ((m_id
!= other
.m_id
) ||
171 (m_version
!= other
.m_version
) ||
172 (m_channel
!= other
.m_channel
) ||
173 (m_level
!= other
.m_level
) ||
174 (m_opcode
!= other
.m_opcode
) ||
175 (m_task
!= other
.m_task
) ||
176 (m_keywords
!= other
.m_keywords
))
183 public static bool operator ==(EventDescriptor event1
, EventDescriptor event2
)
185 return event1
.Equals(event2
);
188 public static bool operator !=(EventDescriptor event1
, EventDescriptor event2
)
190 return !event1
.Equals(event2
);