Ejemplo n.º 1
0
        /// <summary>
        /// This method is the callback used by GetSessions() when it calls into GetSessionInfo().
        /// It updates a List<SessionInfo> based on the etwSessionId and matchAllKeywords that
        /// GetSessionInfo() passes in.
        /// </summary>
        private static void GetSessionInfoCallback(int etwSessionId, long matchAllKeywords,
                                                   ref List <SessionInfo> sessionList)
        {
            uint sessionIdBitMask = (uint)SessionMask.FromEventKeywords((ulong)matchAllKeywords);

            // an ETW controller that specifies more than the mandated bit for our EventSource
            // will be ignored...
            if (bitcount(sessionIdBitMask) > 1)
            {
                return;
            }

            if (sessionList == null)
            {
                sessionList = new List <SessionInfo>(8);
            }

            if (bitcount(sessionIdBitMask) == 1)
            {
                // activity-tracing-aware etw session
                sessionList.Add(new SessionInfo(bitindex(sessionIdBitMask) + 1, etwSessionId));
            }
            else
            {
                // legacy etw session
                sessionList.Add(new SessionInfo(bitcount((uint)SessionMask.All) + 1, etwSessionId));
            }
        }
        // Token: 0x06003343 RID: 13123 RVA: 0x000C2DE0 File Offset: 0x000C0FE0
        private static void GetSessionInfoCallback(int etwSessionId, long matchAllKeywords, ref List <EventProvider.SessionInfo> sessionList)
        {
            uint n = (uint)SessionMask.FromEventKeywords((ulong)matchAllKeywords);

            if (EventProvider.bitcount(n) > 1)
            {
                return;
            }
            if (sessionList == null)
            {
                sessionList = new List <EventProvider.SessionInfo>(8);
            }
            if (EventProvider.bitcount(n) == 1)
            {
                sessionList.Add(new EventProvider.SessionInfo(EventProvider.bitindex(n) + 1, etwSessionId));
                return;
            }
            sessionList.Add(new EventProvider.SessionInfo(EventProvider.bitcount((uint)SessionMask.All) + 1, etwSessionId));
        }