From: Marek Safar Date: Fri, 4 Jan 2019 15:06:00 +0000 (+0100) Subject: Removes AppDomain dependency from TPLETWProvider (#21709) X-Git-Tag: accepted/tizen/unified/20190422.045933~203 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=07f1fcce9999990763638d9b545b4c78eb79bd61;p=platform%2Fupstream%2Fcoreclr.git Removes AppDomain dependency from TPLETWProvider (#21709) which always returns 1, to make code sharing easier --- diff --git a/src/System.Private.CoreLib/src/System/Threading/Tasks/TPLETWProvider.cs b/src/System.Private.CoreLib/src/System/Threading/Tasks/TPLETWProvider.cs index 401ae40..6c28ba5 100644 --- a/src/System.Private.CoreLib/src/System/Threading/Tasks/TPLETWProvider.cs +++ b/src/System.Private.CoreLib/src/System/Threading/Tasks/TPLETWProvider.cs @@ -33,6 +33,8 @@ namespace System.Threading.Tasks internal bool Debug; private bool DebugActivityId; + private const int DefaultAppDomainID = 1; + /// /// Get callbacks when the ETW sends us commands` /// @@ -219,7 +221,7 @@ namespace System.Threading.Tasks Level = EventLevel.Informational, Keywords = Keywords.TaskTransfer | Keywords.Tasks)] public void TaskScheduled( int OriginatingTaskSchedulerID, int OriginatingTaskID, // PFX_COMMON_EVENT_HEADER - int TaskID, int CreatingTaskID, int TaskCreationOptions, int appDomain) + int TaskID, int CreatingTaskID, int TaskCreationOptions, int appDomain = DefaultAppDomainID) { // IsEnabled() call is an inlined quick check that makes this very fast when provider is off if (IsEnabled() && IsEnabled(EventLevel.Informational, Keywords.TaskTransfer | Keywords.Tasks)) @@ -583,9 +585,8 @@ namespace System.Threading.Tasks // using the last 8 bytes as the provider GUID for this provider. // These were generated by CreateGuid, and are reasonably random (and thus unlikley to collide uint pid = EventSource.s_currentPid; - int appDomainID = System.Threading.Thread.GetDomainID(); return new Guid(taskID, - (short)appDomainID, (short)(appDomainID >> 16), + (short)DefaultAppDomainID, (short)(DefaultAppDomainID >> 16), (byte)pid, (byte)(pid >> 8), (byte)(pid >> 16), (byte)(pid >> 24), 0xff, 0xdc, 0xd7, 0xb5); } diff --git a/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs b/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs index c3a4af3..1061c8b 100644 --- a/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs +++ b/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs @@ -890,8 +890,7 @@ namespace System.Threading.Tasks Task currentTask = Task.InternalCurrent; Task parentTask = m_contingentProperties?.m_parent; etwLog.TaskScheduled(ts.Id, currentTask == null ? 0 : currentTask.Id, - this.Id, parentTask == null ? 0 : parentTask.Id, (int)this.Options, - System.Threading.Thread.GetDomainID()); + this.Id, parentTask == null ? 0 : parentTask.Id, (int)this.Options); return true; } else