FilterToRegex() публичный статический Метод

public static FilterToRegex ( string rawFilter, bool compiled = false ) : Regex
rawFilter string
compiled bool
Результат System.Text.RegularExpressions.Regex
Пример #1
0
        private void TracebackFilter_FilterChanged(object sender, EventArgs e)
        {
            var filter = MainWindow.FilterToRegex(TracebackFilter.Filter);

            DeltaHistogram.FunctionFilter = DeltaList.FunctionFilter = FunctionFilter = filter;
            Start(RefreshDeltas());
        }
Пример #2
0
        private void TracebackFilter_FilterChanging(object sender, FilterChangingEventArgs e)
        {
            if (e.Filter.Trim().Length == 0)
            {
                return;
            }

            Regex regex;

            try {
                regex = MainWindow.FilterToRegex(e.Filter);
            } catch {
                e.SetValid(false);
                return;
            }

            foreach (var name in FunctionNames)
            {
                if (regex.IsMatch(name))
                {
                    e.SetValid(true);
                    return;
                }
            }

            e.SetValid(false);
        }
Пример #3
0
        private void TracebackFilter_FilterChanged(object sender, EventArgs e)
        {
            var filter = MainWindow.FilterToRegex(TracebackFilter.Filter);

            GraphHistogram.FunctionFilter = DeltaHistogram.FunctionFilter = DeltaList.FunctionFilter = FunctionFilter = filter;

            if (PendingRefresh != null)
            {
                PendingRefresh.Dispose();
            }

            PendingRefresh = Start(RefreshDeltas());
        }
Пример #4
0
        public CompiledStackFilter Compile()
        {
            Regex module   = null;
            Regex function = null;

            if (ModuleGlob != null)
            {
                module = MainWindow.FilterToRegex(ModuleGlob, true);
            }

            if (FunctionGlob != null)
            {
                function = MainWindow.FilterToRegex(FunctionGlob, true);
            }

            return(new CompiledStackFilter(module, function));
        }
Пример #5
0
        protected IEnumerator <object> FilterHeapData(HeapRecording instance, string filter)
        {
            var result = new Dictionary <HeapSnapshotInfo, FilteredHeapSnapshotInfo>();

            var regex         = MainWindow.FilterToRegex(filter);
            var functionNames = (from functionName in KnownFunctionNames
                                 where regex.IsMatch(functionName)
                                 select functionName).Distinct();

            using (var activity = Activities.AddItem("Filtering heap")) {
                var fFrameIDs = instance.Database.SymbolsByFunction.Find(functionNames);
                using (fFrameIDs)
                    yield return(fFrameIDs);

                var frameIDs = new HashSet <UInt32>(
                    from key in fFrameIDs.Result select BitConverter.ToUInt32(key.Data.Array, key.Data.Offset)
                    );

                var matchingTracebacks = new HashSet <UInt32>();

                for (int i = 0, c = instance.Snapshots.Count; i < c; i++)
                {
                    activity.Maximum  = c;
                    activity.Progress = i;

                    var info = instance.Snapshots[i];

                    var fSnapshot = instance.GetSnapshot(info);
                    using (fSnapshot)
                        yield return(fSnapshot);

                    var snapshot = fSnapshot.Result;
                    Func <HeapSnapshot.Traceback, bool> tracebackMatches = (traceback) => {
                        if (matchingTracebacks.Contains(traceback.ID))
                        {
                            return(false);
                        }

                        var _f = traceback.Frames.Array;
                        for (int _i = 0, _c = traceback.Frames.Count, _o = traceback.Frames.Offset; _i < _c; _i++)
                        {
                            if (frameIDs.Contains(_f[_i + _o]))
                            {
                                return(true);
                            }
                        }

                        return(false);
                    };

                    var fNewMatchingTracebacks = Future.RunInThread(() => new HashSet <UInt32>(
                                                                        from traceback in snapshot.Tracebacks.AsParallel() where tracebackMatches(traceback) select traceback.ID
                                                                        ));
                    yield return(fNewMatchingTracebacks);

                    matchingTracebacks.UnionWith(fNewMatchingTracebacks.Result);

                    var fInfo = Future.RunInThread(() => new FilteredHeapSnapshotInfo(
                                                       (from heap in snapshot.Heaps.AsParallel() select(from alloc in heap.Allocations.AsParallel() where matchingTracebacks.Contains(alloc.TracebackID) select(long) alloc.Size).Sum()).Sum(),
                                                       (from heap in snapshot.Heaps.AsParallel() select(from alloc in heap.Allocations.AsParallel() where matchingTracebacks.Contains(alloc.TracebackID) select(long) alloc.Overhead).Sum()).Sum(),
                                                       (from heap in snapshot.Heaps.AsParallel() select(from alloc in heap.Allocations.AsParallel() where matchingTracebacks.Contains(alloc.TracebackID) select(long)(alloc.Size + alloc.Overhead)).Sum()).Sum(),
                                                       (from heap in snapshot.Heaps.AsParallel() select(from alloc in heap.Allocations.AsParallel() where matchingTracebacks.Contains(alloc.TracebackID) select alloc).Count()).Sum()
                                                       ));

                    yield return(fInfo);

                    result[info] = fInfo.Result;

                    info.ReleaseStrongReference();
                }
            }

            CurrentFilterData   = result;
            CurrentFilter       = filter;
            PendingFilter       = null;
            PendingFilterFuture = null;

            SnapshotTimeline.Invalidate();
        }