Exemplo n.º 1
0
        /// <summary>
        /// конструктор
        /// </summary>
        public Manager(string[] _args)
        {
            args = _args;
            thr  = new Thread(this.parse);
            //threadscount = Environment.ProcessorCount;
            int mgbt = Int32.Parse(args[2]);

            if (mgbt < 5)
            {
                mgbt = 5;
            }
            int avmem     = Convert.ToInt32(mgbt * 0.65);           // Mb
            int thr1      = Convert.ToInt32((avmem * 1024) / 2300); // Mb for 1 thread
            int linecount = Convert.ToInt32(avmem * 2500 / 2300);   // тыс строк на один поток

            threadscount = 1;
            FileInfo fi  = new FileInfo(args[0]);
            int      szm = Convert.ToInt32(fi.Length / (1024 * 1024)); // Mb
            int      kf  = (szm / thr1);

            kf++;
            if (kf > Environment.ProcessorCount)
            {
                kf = Environment.ProcessorCount;
            }
            threadscount = threadscount * kf;
            linecount    = linecount * 1000 / kf;
            threads      = new IBigSortThread[threadscount];
            QManager     = Factories.CreateQueueManager(threadscount, linecount);
        }
Exemplo n.º 2
0
 public BigSortThread(IBigSortManagerQueue _queue)
 {
     cthr      = new Thread(this.run);
     bsqueue   = _queue;
     cthr.Name = "compressorthread";
     outdata   = new SortedSet <bsdata>();
 }
Exemplo n.º 3
0
 /// <summary>
 /// конструктор
 /// </summary>
 public BigSortReader(string _filename_in, IBigSortManagerQueue _Queue)
 {
     cthr        = new Thread(this.DoRead);
     filename_in = _filename_in;
     sortQueue   = _Queue;
 }
Exemplo n.º 4
0
 // читающий поток
 public static IBigSortThread CreateBigSortReader(IBigSortManagerQueue _queue, string _filename)
 {
     return(new BigSortReader(_filename, _queue));
 }
Exemplo n.º 5
0
 // рабочие потоки
 public static IBigSortThread CreateBigSortThread(IBigSortManagerQueue _queue)
 {
     return(new BigSortThread(_queue));
 }
Exemplo n.º 6
0
 // пишущий поток
 public static IBigSortThread CreateBigSortWriter(IBigSortManagerQueue ComMan)
 {
     return(new Writer(ComMan));
 }
Exemplo n.º 7
0
 public Writer(IBigSortManagerQueue _writer)
 {
     writerthread      = new Thread(this.run);
     bigsortwriter     = _writer;
     writerthread.Name = "Writer";
 }