Ejemplo n.º 1
0
        /// <summary>
        /// Creates a new instance of <see cref="SpellerCOMActionTraceLogger"/> and instantiates
        /// and associates tracking metadata (represented by <see cref="InstanceInfo"/>.
        ///
        /// This constructer should usually be called within a using block
        /// </summary>
        /// <param name="caller"/>
        /// <param name="action"/>
        public SpellerCOMActionTraceLogger(WinRTSpellerInterop caller, Actions action)
        {
            _action = action;

            InstanceInfo instanceInfo = null;

            lock (_lockObject)
            {
                if (!_instanceInfos.TryGetValue(caller, out instanceInfo))
                {
                    instanceInfo = new InstanceInfo
                    {
                        Id = Guid.NewGuid(),
                        CumulativeCallTime100Ns = new Dictionary <Actions, long>(),
                        NumCallsMeasured        = new Dictionary <Actions, long>()
                    };

                    foreach (Actions a in Enum.GetValues(typeof(Actions)))
                    {
                        instanceInfo.CumulativeCallTime100Ns.Add(a, 0);
                        instanceInfo.NumCallsMeasured.Add(a, 0);
                    }

                    _instanceInfos.Add(caller, instanceInfo);
                }
            }

            _instanceInfo = instanceInfo;
            _beginTicks   = DateTime.Now.Ticks;
        }
Ejemplo n.º 2
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;
        }