Ejemplo n.º 1
0
        private void AddToFunctionsList(PProfInfo.Function functionInfo)
        {
            if (functionInfo != null && !functionInfo.IsIncludedInSession)
            {
                PProfBuildSessionState buildState = ValidOwnerBuildState;
                functionInfo.IsIncludedInSession = true;
                buildState.Functions.Add(functionInfo);

                _profile.Function.Add(functionInfo.Item);
            }
        }
Ejemplo n.º 2
0
        private void AddToMappingsList(PProfInfo.Mapping mappingInfo)
        {
            if (mappingInfo != null && !mappingInfo.IsIncludedInSession)
            {
                PProfBuildSessionState buildState = ValidOwnerBuildState;
                mappingInfo.IsIncludedInSession = true;
                buildState.Mappings.Add(mappingInfo);

                _profile.Mapping.Add(mappingInfo.Item);
            }
        }
Ejemplo n.º 3
0
        private void AddToLocationsList(PProfInfo.Location locationInfo)
        {
            if (locationInfo != null && !locationInfo.IsIncludedInSession)
            {
                PProfBuildSessionState buildState = ValidOwnerBuildState;
                locationInfo.IsIncludedInSession = true;
                buildState.Locations.Add(locationInfo);

                _profile.Location.Add(locationInfo.Item);
            }
        }
Ejemplo n.º 4
0
        private void AddToStringTable(PProfInfo.String stringInfo)
        {
            if (stringInfo != null && !stringInfo.IsIncludedInSession)
            {
                PProfBuildSessionState buildState = ValidOwnerBuildState;
                stringInfo.OffsetInStringTable = buildState.StringTable.Count;
                buildState.StringTable.Add(stringInfo);

                _profile.StringTable.Add(stringInfo.Item);
            }
        }
Ejemplo n.º 5
0
        internal PProfBuildSession(PProfBuilder owner, PProfBuildSessionState ownerBuildState)
        {
            Validate.NotNull(owner, nameof(owner));
            Validate.NotNull(ownerBuildState, nameof(ownerBuildState));

            _ownerBuildState = ownerBuildState;

            this.OwnerBuilder = owner;
            _profile          = new PProfProto.Profile();
            _lastSample       = null;
            this.SamplesCount = 0;
        }
Ejemplo n.º 6
0
        public void Dispose()
        {
            PProfBuildSessionState prevOwnerBuildState = Interlocked.Exchange(ref _ownerBuildState, null);

            if (prevOwnerBuildState != null)
            {
                if (!OwnerBuilder.TryFinishPProfBuildSessionInternal(this))
                {
                    throw new InvalidOperationException($"Cannot dispose this {nameof(PProfBuildSession)}."
                                                        + $" Is this not the current session of the {nameof(OwnerBuilder)}?");
                }
            }
        }