예제 #1
0
        // Token: 0x06003F7F RID: 16255 RVA: 0x00124CE0 File Offset: 0x00122EE0
        public SpellerCOMActionTraceLogger(WinRTSpellerInterop caller, SpellerCOMActionTraceLogger.Actions action)
        {
            this._action = action;
            SpellerCOMActionTraceLogger.InstanceInfo instanceInfo = null;
            object lockObject = SpellerCOMActionTraceLogger._lockObject;

            lock (lockObject)
            {
                if (!SpellerCOMActionTraceLogger._instanceInfos.TryGetValue(caller, out instanceInfo))
                {
                    instanceInfo = new SpellerCOMActionTraceLogger.InstanceInfo
                    {
                        Id = Guid.NewGuid(),
                        CumulativeCallTime100Ns = new Dictionary <SpellerCOMActionTraceLogger.Actions, long>(),
                        NumCallsMeasured        = new Dictionary <SpellerCOMActionTraceLogger.Actions, long>()
                    };
                    foreach (object obj in Enum.GetValues(typeof(SpellerCOMActionTraceLogger.Actions)))
                    {
                        SpellerCOMActionTraceLogger.Actions key = (SpellerCOMActionTraceLogger.Actions)obj;
                        instanceInfo.CumulativeCallTime100Ns.Add(key, 0L);
                        instanceInfo.NumCallsMeasured.Add(key, 0L);
                    }
                    SpellerCOMActionTraceLogger._instanceInfos.Add(caller, instanceInfo);
                }
            }
            this._instanceInfo = instanceInfo;
            this._beginTicks   = DateTime.Now.Ticks;
        }
예제 #2
0
 // Token: 0x06003F80 RID: 16256 RVA: 0x00124DF4 File Offset: 0x00122FF4
 private void UpdateRunningAverageAndLogDebugInfo(long endTicks)
 {
     try
     {
         long   num        = endTicks - this._beginTicks;
         object lockObject = SpellerCOMActionTraceLogger._lockObject;
         lock (lockObject)
         {
             Dictionary <SpellerCOMActionTraceLogger.Actions, long> numCallsMeasured = this._instanceInfo.NumCallsMeasured;
             SpellerCOMActionTraceLogger.Actions action = this._action;
             long num2 = numCallsMeasured[action];
             numCallsMeasured[action] = num2 + 1L;
             Dictionary <SpellerCOMActionTraceLogger.Actions, long> cumulativeCallTime100Ns = this._instanceInfo.CumulativeCallTime100Ns;
             action = this._action;
             cumulativeCallTime100Ns[action] += num;
         }
         long num3 = (long)Math.Floor(1.0 * (double)this._instanceInfo.CumulativeCallTime100Ns[this._action] / (double)this._instanceInfo.NumCallsMeasured[this._action]);
         if (this._action == SpellerCOMActionTraceLogger.Actions.RegisterUserDictionary || this._action == SpellerCOMActionTraceLogger.Actions.UnregisterUserDictionary || num > SpellerCOMActionTraceLogger._timeLimits100Ns[this._action] || num3 > 2L * SpellerCOMActionTraceLogger._timeLimits100Ns[this._action])
         {
             EventSource        provider = TraceLoggingProvider.GetProvider();
             EventSourceOptions options  = TelemetryEventSource.MeasuresOptions();
             SpellerCOMActionTraceLogger.SpellerCOMTimingData data = new SpellerCOMActionTraceLogger.SpellerCOMTimingData
             {
                 TextBoxBaseIdentifier = this._instanceInfo.Id.ToString(),
                 SpellerCOMAction      = this._action.ToString(),
                 CallTimeForCOMCallMs  = (long)Math.Floor((double)num * 1.0 / 10000.0),
                 RunningAverageCallTimeForCOMCallsMs = (long)Math.Floor((double)num3 * 1.0 / 10000.0)
             };
             if (provider != null)
             {
                 provider.Write <SpellerCOMActionTraceLogger.SpellerCOMTimingData>(SpellerCOMActionTraceLogger.SpellerCOMLatencyMeasurement, options, data);
             }
         }
     }
     catch
     {
     }
 }