public Filter(ColumnizerCallback callback) { _callback = callback; FilterResultLines = new List <int>(); LastFilterLinesList = new List <int>(); FilterHitList = new List <int>(); }
private Filter DoWork(FilterParams filterParams, int startLine, int maxCount, ProgressCallback progressCallback) { _logger.Info("Started Filter worker [{0}] for line {1}", Thread.CurrentThread.ManagedThreadId, startLine); // Give every thread own copies of ColumnizerCallback and FilterParams, because the state of the objects changes while filtering FilterParams threadFilterParams = filterParams.CreateCopy2(); ColumnizerCallback threadColumnizerCallback = _callback.CreateCopy(); Filter filter = new Filter(threadColumnizerCallback); lock (_filterWorkerList) { _filterWorkerList.Add(filter); } if (_shouldStop) { return(filter); } int realCount = filter.DoFilter(threadFilterParams, startLine, maxCount, progressCallback); _logger.Info("Filter worker [{0}] for line {1} has completed.", Thread.CurrentThread.ManagedThreadId, startLine); lock (_filterReadyList) { _filterReadyList.Add(filter); } return(filter); }
public TimeSpreadCalculator(LogWindow logWindow) { _logWindow = logWindow; _callback = new ColumnizerCallback(_logWindow); _calcThread = new Thread(WorkerFx); _calcThread.IsBackground = true; _calcThread.Start(); }
private string GetMsgForLine(int i, ILogWindowSearch logWindow) { string line = logWindow.GetLogLine(i); ILogLineColumnizer columnizer = logWindow.CurrentColumnizer; ColumnizerCallback callback = new ColumnizerCallback(logWindow.CurrentLogWindows); string[] cols = columnizer.SplitLine(callback, line); return(cols[columnizer.GetColumnCount() - 1]); }
public FilterStarter(ColumnizerCallback callback, int minThreads) { _callback = callback; FilterResultLines = new List <int>(); LastFilterLinesList = new List <int>(); FilterHitList = new List <int>(); _filterReadyList = new List <Filter>(); _filterWorkerList = new List <Filter>(); _filterHitDict = new SortedDictionary <int, int>(); _filterResultDict = new SortedDictionary <int, int>(); _lastFilterLinesDict = new SortedDictionary <int, int>(); ThreadCount = Environment.ProcessorCount * 4; ThreadCount = minThreads; ThreadPool.GetMinThreads(out var worker, out var completion); ThreadPool.SetMinThreads(minThreads, completion); ThreadPool.GetMaxThreads(out worker, out completion); }
public RangeFinder(FilterParams filterParams, ColumnizerCallback callback) { _filterParams = filterParams.CreateCopy2(); _callback = callback; }
internal IColumnizedLogLine GetColumnsForLine(LogfileReader logFileReader, int lineNumber, ILogLineColumnizer columnizer, ColumnizerCallback columnizerCallback) { if (_lastColumnizer != columnizer || _lastLineNumber != lineNumber && _cachedColumns != null || columnizerCallback.LineNum != lineNumber) { _lastColumnizer = columnizer; _lastLineNumber = lineNumber; ILogLine line = logFileReader.GetLogLineWithWait(lineNumber); if (line != null) { columnizerCallback.LineNum = lineNumber; _cachedColumns = columnizer.SplitLine(columnizerCallback, line); } else { _cachedColumns = null; } } return(_cachedColumns); }
private string GetMsgForLine(int i, ILogWindowSearch logWindow) { string line = logWindow.GetLogLine(i); ILogLineColumnizer columnizer = logWindow.CurrentColumnizer; ColumnizerCallback callback = new ColumnizerCallback(logWindow.CurrentLogWindows); string[] cols = columnizer.SplitLine(callback, line); return cols[columnizer.GetColumnCount() - 1]; }
public LogWindow(LogTabWindow.LogTabWindow parent, string fileName, bool isTempFile, bool forcePersistenceLoading) { SuspendLayout(); InitializeComponent(); columnNamesLabel.Text = ""; // no filtering on columns by default _parentLogTabWin = parent; IsTempFile = isTempFile; //Thread.CurrentThread.Name = "LogWindowThread"; ColumnizerCallbackObject = new ColumnizerCallback(this); FileName = fileName; ForcePersistenceLoading = forcePersistenceLoading; dataGridView.CellValueNeeded += OnDataGridViewCellValueNeeded; dataGridView.CellPainting += dataGridView_CellPainting; filterGridView.CellValueNeeded += OnFilterGridViewCellValueNeeded; filterGridView.CellPainting += OnFilterGridViewCellPainting; Closing += OnLogWindowClosing; Disposed += OnLogWindowDisposed; Load += OnLogWindowLoad; _timeSpreadCalc = new TimeSpreadCalculator(this); timeSpreadingControl.TimeSpreadCalc = _timeSpreadCalc; timeSpreadingControl.LineSelected += OnTimeSpreadingControlLineSelected; tableLayoutPanel1.ColumnStyles[1].SizeType = SizeType.Absolute; tableLayoutPanel1.ColumnStyles[1].Width = 20; tableLayoutPanel1.ColumnStyles[0].SizeType = SizeType.Percent; tableLayoutPanel1.ColumnStyles[0].Width = 100; _parentLogTabWin.HighlightSettingsChanged += OnParentHighlightSettingsChanged; SetColumnizer(PluginRegistry.GetInstance().RegisteredColumnizers[0]); _patternArgs.maxMisses = 5; _patternArgs.minWeight = 1; _patternArgs.maxDiffInBlock = 5; _patternArgs.fuzzy = 5; //InitPatternWindow(); //this.toolwinTabControl.TabPages.Add(this.patternWindow); //this.toolwinTabControl.TabPages.Add(this.bookmarkWindow); _filterParams = new FilterParams(); foreach (string item in ConfigManager.Settings.filterHistoryList) { filterComboBox.Items.Add(item); } filterComboBox.DropDownHeight = filterComboBox.ItemHeight * ConfigManager.Settings.preferences.maximumFilterEntriesDisplayed; AutoResizeFilterBox(); filterRegexCheckBox.Checked = _filterParams.isRegex; filterCaseSensitiveCheckBox.Checked = _filterParams.isCaseSensitive; filterTailCheckBox.Checked = _filterParams.isFilterTail; splitContainerLogWindow.Panel2Collapsed = true; advancedFilterSplitContainer.SplitterDistance = FILTER_ADVANCED_SPLITTER_DISTANCE; _timeShiftSyncThread = new Thread(SyncTimestampDisplayWorker); _timeShiftSyncThread.IsBackground = true; _timeShiftSyncThread.Start(); _logEventHandlerThread = new Thread(LogEventWorker); _logEventHandlerThread.IsBackground = true; _logEventHandlerThread.Start(); //this.filterUpdateThread = new Thread(new ThreadStart(this.FilterUpdateWorker)); //this.filterUpdateThread.Start(); _advancedButtonImage = advancedButton.Image; _searchButtonImage = filterSearchButton.Image; filterSearchButton.Image = null; dataGridView.EditModeMenuStrip = editModeContextMenuStrip; markEditModeToolStripMenuItem.Enabled = true; _panelOpenButtonImage = Properties.Resources.PanelOpen; _panelCloseButtonImage = Properties.Resources.PanelClose; Settings settings = ConfigManager.Settings; if (settings.appBounds != null && settings.appBounds.Right > 0) { Bounds = settings.appBounds; } _waitingForClose = false; dataGridView.Enabled = false; dataGridView.ColumnDividerDoubleClick += OnDataGridViewColumnDividerDoubleClick; ShowAdvancedFilterPanel(false); filterKnobBackSpread.MinValue = 0; filterKnobBackSpread.MaxValue = SPREAD_MAX; filterKnobBackSpread.ValueChanged += OnFilterKnobControlValueChanged; filterKnobForeSpread.MinValue = 0; filterKnobForeSpread.MaxValue = SPREAD_MAX; filterKnobForeSpread.ValueChanged += OnFilterKnobControlValueChanged; fuzzyKnobControl.MinValue = 0; fuzzyKnobControl.MaxValue = 10; //PreferencesChanged(settings.preferences, true); AdjustHighlightSplitterWidth(); ToggleHighlightPanel(false); // hidden _bookmarkProvider.BookmarkAdded += OnBookmarkProviderBookmarkAdded; _bookmarkProvider.BookmarkRemoved += OnBookmarkProviderBookmarkRemoved; _bookmarkProvider.AllBookmarksRemoved += OnBookmarkProviderAllBookmarksRemoved; ResumeLayout(); _statusLineTrigger.Signal += OnStatusLineTriggerSignal; _selectionChangedTrigger.Signal += OnSelectionChangedTriggerSignal; }