Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
EventPipeEventDispatcher.cs
Go to the documentation of this file.
6
8
9internal sealed class EventPipeEventDispatcher
10{
11 internal sealed class EventListenerSubscription
12 {
13 internal EventKeywords MatchAnyKeywords { get; private set; }
14
15 internal EventLevel Level { get; private set; }
16
22 }
23
25
26 private readonly IntPtr m_RuntimeProviderID;
27
28 private ulong m_sessionID;
29
31
32 private long m_syncTimeQPC;
33
34 private long m_timeQPCFrequency;
35
36 private bool m_stopDispatchTask;
37
39
41
42 private readonly object m_dispatchControlLock = new object();
43
45
47 {
48 m_RuntimeProviderID = EventPipeInternal.GetProvider("Microsoft-Windows-DotNETRuntime");
49 m_dispatchTaskWaitHandle.SafeWaitHandle = new SafeWaitHandle(IntPtr.Zero, ownsHandle: false);
50 }
51
53 {
54 if (command == EventCommand.Update && enable)
55 {
57 {
60 return;
61 }
62 }
63 if (command == EventCommand.Update && !enable)
64 {
66 }
67 }
68
69 internal void RemoveEventListener(EventListener listener)
70 {
72 {
73 if (m_subscriptions.ContainsKey(listener))
74 {
75 m_subscriptions.Remove(listener);
76 }
78 }
79 }
80
108
109 private void StartDispatchTask()
110 {
111 if (m_dispatchTask == null)
112 {
113 m_stopDispatchTask = false;
114 m_dispatchTaskWaitHandle.SafeWaitHandle = new SafeWaitHandle(EventPipeInternal.GetWaitHandle(m_sessionID), ownsHandle: false);
116 }
117 }
118
119 private void StopDispatchTask()
120 {
121 if (m_dispatchTask != null)
122 {
123 m_stopDispatchTask = true;
126 m_dispatchTask = null;
127 }
128 }
129
156
158 {
159 if (timeStamp == long.MaxValue)
160 {
161 return DateTime.MaxValue;
162 }
163 long num = (long)((double)(timeStamp - m_syncTimeQPC) * 10000000.0 / (double)m_timeQPCFrequency) + m_syncTimeUtc.Ticks;
164 if (num < 0 || 3155378975999999999L < num)
165 {
166 num = 3155378975999999999L;
167 }
168 return new DateTime(num, DateTimeKind.Utc);
169 }
170}
bool ICollection< KeyValuePair< TKey, TValue > >. Remove(KeyValuePair< TKey, TValue > keyValuePair)
readonly Dictionary< EventListener, EventListenerSubscription > m_subscriptions
static readonly EventPipeEventDispatcher Instance
void SendCommand(EventListener eventListener, EventCommand command, bool enable, EventLevel level, EventKeywords matchAnyKeywords)
static IntPtr GetWaitHandle(ulong sessionID)
static unsafe bool GetSessionInfo(ulong sessionID, EventPipeSessionInfo *pSessionInfo)
static IntPtr GetProvider(string providerName)
static unsafe ulong Enable(char *outputFile, EventPipeSerializationFormat format, uint circularBufferSizeInMB, EventPipeProviderConfigurationNative *providers, uint numProviders)
static void Disable(ulong sessionID)
static unsafe bool GetNextEvent(ulong sessionID, EventPipeEventInstanceData *pInstance)
static new TaskFactory< TResult > Factory
Definition Task.cs:56
static void Sleep(int millisecondsTimeout)
Definition Thread.cs:658
SafeWaitHandle SafeWaitHandle
Definition WaitHandle.cs:54
virtual bool WaitOne(int millisecondsTimeout)
static readonly DateTime MaxValue
Definition DateTime.cs:37
static DateTime FromFileTimeUtc(long fileTime)
Definition DateTime.cs:718
static readonly IntPtr Zero
Definition IntPtr.cs:18