示例#1
0
 public Filter(ColumnizerCallback callback)
 {
     _callback           = callback;
     FilterResultLines   = new List <int>();
     LastFilterLinesList = new List <int>();
     FilterHitList       = new List <int>();
 }
示例#2
0
        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);
        }
示例#3
0
 public TimeSpreadCalculator(LogWindow logWindow)
 {
     _logWindow  = logWindow;
     _callback   = new ColumnizerCallback(_logWindow);
     _calcThread = new Thread(WorkerFx);
     _calcThread.IsBackground = true;
     _calcThread.Start();
 }
示例#4
0
        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]);
        }
示例#5
0
 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);
 }
示例#6
0
 public RangeFinder(FilterParams filterParams, ColumnizerCallback callback)
 {
     _filterParams = filterParams.CreateCopy2();
     _callback     = callback;
 }
示例#7
0
 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);
 }
示例#8
0
		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];
		}
示例#9
0
        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;
        }