Example #1
0
        private Filter DoWork(FilterParams filterParams, int startLine, int maxCount, ProgressCallback progressCallback)
        {
            Logger.logInfo("Started Filter worker [" + Thread.CurrentThread.ManagedThreadId + "] for line " +
                           startLine);

            // Give every thread own copies of ColumnizerCallback and FilterParams, because the state of the objects changes while filtering
            FilterParams threadFilterParams = filterParams.CreateCopy2();

            LogExpert.LogWindow.ColumnizerCallback threadColumnizerCallback = this.callback.createCopy();

            Filter filter = new Filter(threadColumnizerCallback);

            lock (this.filterWorkerList)
            {
                this.filterWorkerList.Add(filter);
            }
            if (this.shouldStop)
            {
                return(filter);
            }
            int realCount = filter.DoFilter(threadFilterParams, startLine, maxCount, progressCallback);

            Logger.logInfo("Filter worker [" + Thread.CurrentThread.ManagedThreadId + "] for line " + startLine +
                           " has completed.");
            lock (this.filterReadyList)
            {
                this.filterReadyList.Add(filter);
            }
            return(filter);
        }
Example #2
0
 public Filter(LogExpert.LogWindow.ColumnizerCallback callback)
 {
     this.callback            = callback;
     this.filterResultLines   = new List <int>();
     this.lastFilterLinesList = new List <int>();
     this.filterHitList       = new List <int>();
 }
Example #3
0
        public FilterStarter(LogExpert.LogWindow.ColumnizerCallback callback, int minThreads)
        {
            this.callback            = callback;
            this.FilterResultLines   = new List <int>();
            this.LastFilterLinesList = new List <int>();
            this.FilterHitList       = new List <int>();
            this.filterReadyList     = new List <Filter>();
            this.filterWorkerList    = new List <Filter>();
            this.filterHitDict       = new SortedDictionary <int, int>();
            this.filterResultDict    = new SortedDictionary <int, int>();
            this.lastFilterLinesDict = new SortedDictionary <int, int>();
            this.ThreadCount         = Environment.ProcessorCount * 4;
            this.ThreadCount         = minThreads;
            int worker, completion;

            ThreadPool.GetMinThreads(out worker, out completion);
            ThreadPool.SetMinThreads(minThreads, completion);
            ThreadPool.GetMaxThreads(out worker, out completion);
        }
Example #4
0
        internal string[] GetColumnsForLine(
            LogfileReader logFileReader, int line,
            ILogLineColumnizer columnizer,
            LogExpert.LogWindow.ColumnizerCallback callback)
        {
            if (this.last_columnizer == columnizer && this.last_line == line &&
                this.cached_columns != null)
            {
                return(this.cached_columns);
            }

            string line_data = logFileReader.GetLogLineWithWait(line);

            if (line_data != null)
            {
                callback.LineNum     = line;
                this.cached_columns  = columnizer.SplitLine(callback, line_data);
                this.last_columnizer = columnizer;
                this.last_line       = line;
            }

            return(this.cached_columns);
        }
Example #5
0
 public HighlightThread(LogExpert.LogWindow.ColumnizerCallback callback)
 {
   this.callback = callback;
 }
Example #6
0
 internal string[] GetColumnsForLine(LogfileReader logFileReader, int lineNumber, ILogLineColumnizer columnizer, LogExpert.LogWindow.ColumnizerCallback columnizerCallback)
 {
     if (this.lastColumnizer != columnizer || this.lastLineNumber != lineNumber && this.cachedColumns != null || columnizerCallback.LineNum != lineNumber)
     {
         this.lastColumnizer = columnizer;
         this.lastLineNumber = lineNumber;
         string line = logFileReader.GetLogLineWithWait(lineNumber);
         if (line != null)
         {
             columnizerCallback.LineNum = lineNumber;
             this.cachedColumns         = columnizer.SplitLine(columnizerCallback, line);
         }
         else
         {
             this.cachedColumns = null;
         }
     }
     return(this.cachedColumns);
 }
Example #7
0
 public RangeFinder(FilterParams filterParams, LogExpert.LogWindow.ColumnizerCallback callback)
 {
     this.filterParams = filterParams.CreateCopy2();
     this.callback     = callback;
 }
Example #8
0
 public HighlightThread(LogExpert.LogWindow.ColumnizerCallback callback)
 {
     this.callback = callback;
 }