Exemplo n.º 1
0
        /// <summary>
        /// Get perf nos of each block
        /// </summary>
        /// <param name="parserObj">Fasta Parser object</param>
        /// <param name="pointerObj">Seq pointer</param>
        /// <param name="seq">Isequence</param>
        private void GetBlockPerfNumber(FastaParser parserObj,
                                        SequencePointer pointerObj,
                                        ISequence seq, string seqCountToRead)
        {
            // Calculating First Block Time and CPU Utilization
            _watchObj.Reset();
            _watchObj.Start();

            ISequence firstBlock = parserObj.ParseRange(0, Int32.Parse(seqCountToRead)
                                                        , pointerObj);

            _watchObj.Stop();

            Console.WriteLine(string.Format("FirstBlock Perf Time : {0} Secs",
                                            TimeSpan.FromMilliseconds(
                                                _watchObj.ElapsedMilliseconds).TotalSeconds.ToString()));
            Console.WriteLine(string.Format("FirstBlock CPU Utilization : {0}",
                                            _cpuCounterObj.NextValue().ToString()));

            // Calculating Middle Block Time and CPU Utilization
            _watchObj.Reset();
            _watchObj.Start();

            ISequence middleBlock =
                parserObj.ParseRange((seq.Count / 2),
                                     Int32.Parse(seqCountToRead), pointerObj);

            _watchObj.Stop();
            Console.WriteLine(string.Format("MiddleBlock Perf Time : {0} Secs",
                                            TimeSpan.FromMilliseconds(
                                                _watchObj.ElapsedMilliseconds).TotalSeconds.ToString()));
            Console.WriteLine(string.Format("MiddleBlock CPU Utilization : {0}",
                                            _cpuCounterObj.NextValue().ToString()));

            // Calculating Last Block Time and CPU Utilization
            _watchObj.Reset();
            _watchObj.Start();
            ISequence lastBlock =
                parserObj.ParseRange(seq.Count - Int32.Parse(seqCountToRead),
                                     Int32.Parse(seqCountToRead), pointerObj);

            _watchObj.Stop();

            Console.WriteLine(string.Format("LastBlock Perf Time : {0} Secs",
                                            TimeSpan.FromMilliseconds(
                                                _watchObj.ElapsedMilliseconds).TotalSeconds.ToString()));
            Console.WriteLine(string.Format("LastBlock CPU Utilization : {0}",
                                            _cpuCounterObj.NextValue().ToString()));
        }