Esempio n. 1
0
        internal bool TryFinishPProfBuildSessionInternal(PProfBuildSession session)
        {
            // This method should only be invoked from PProfBuildSession.Dispose().
            if (session == null || _buildState.Session != session)
            {
                return(false);
            }

            _buildState.ResetSession();
            Monitor.Exit(_buildState.SessionLock);
            return(true);
        }
Esempio n. 2
0
        internal bool TryGetOrResolveCreatePProfLocationInfo(
            LocationDescriptor locationDescriptor,
            PProfBuildSession pprofBuildSession,
            TryResolveLocationSymbolsDelegate tryResolveLocationSymbolsDelegate,
            out PProfInfo.Location locationInfo)
        {
            if (_cache.TryGetLocationInfo(locationDescriptor, out locationInfo))
            {
                return(true);
            }

            if (
                tryResolveLocationSymbolsDelegate == null ||
                !tryResolveLocationSymbolsDelegate(
                    pprofBuildSession,
                    locationDescriptor,
                    out string functionName,
                    out string classTypeName,
                    out string binaryContainerName,
                    out string binaryContainerVersion))
            {
                locationInfo = null;
                return(false);
            }

            BuildMonikers(
                ref functionName,
                ref classTypeName,
                ref binaryContainerName,
                ref binaryContainerVersion,
                out string functionMoniker,
                out string binaryContainerMoniker);

            // system name is not used so pass null (i.e. empty string)
            PProfInfo.Function functionInfo = _cache.GetOrCreateFunctionInfo(functionMoniker, functionMoniker, null);
            PProfInfo.Mapping  mappingInfo  = _cache.GetOrCreateMappingInfo(binaryContainerMoniker, binaryContainerName, binaryContainerVersion);
            locationInfo = _cache.GetOrCreateLocationInfo(locationDescriptor, mappingInfo, functionInfo);

            return(true);
        }
Esempio n. 3
0
        public void ResetSession()
        {
            // Clear Locations:
            {
                var list      = _locations;
                int itemCount = list.Count;
                for (int i = 0; i < itemCount; i++)
                {
                    PProfInfo.Location pprofInfo = list[i];
                    pprofInfo.IsIncludedInSession = false;
                }

                list.Clear();
            }

            // Clear Mappings:
            {
                var list      = _mappings;
                int itemCount = list.Count;
                for (int i = 0; i < itemCount; i++)
                {
                    PProfInfo.Mapping pprofInfo = list[i];
                    pprofInfo.IsIncludedInSession = false;
                    pprofInfo.Item.Filename       = ProtoConstants.StringTableIndex.GetUnresolvedIfSet(pprofInfo.Item.Filename);
                    pprofInfo.Item.BuildId        = ProtoConstants.StringTableIndex.GetUnresolvedIfSet(pprofInfo.Item.BuildId);
                }

                list.Clear();
            }

            // Clear Functions:
            {
                var list      = _functions;
                int itemCount = list.Count;
                for (int i = 0; i < itemCount; i++)
                {
                    PProfInfo.Function pprofInfo = list[i];
                    pprofInfo.IsIncludedInSession = false;
                    pprofInfo.Item.Name           = ProtoConstants.StringTableIndex.GetUnresolvedIfSet(pprofInfo.Item.Name);
                    pprofInfo.Item.SystemName     = ProtoConstants.StringTableIndex.GetUnresolvedIfSet(pprofInfo.Item.SystemName);
                    pprofInfo.Item.Filename       = ProtoConstants.StringTableIndex.GetUnresolvedIfSet(pprofInfo.Item.Filename);
                }

                list.Clear();
            }

            // Clear the String Table:
            {
                var list      = _stringTable;
                int itemCount = list.Count;
                for (int i = 0; i < itemCount; i++)
                {
                    list[i].ResetOffsetInStringTable();
                }

                list.Clear();
            }

            // Finally, clear the Session:
            _currentSession = null;
        }