예제 #1
0
        protected void debugProducerShowCallback(IWrite iWrite, string cmdName, object[] cmdArguments)
        {
            System.Collections.ArrayList names;
            System.Collections.ArrayList values;
            int entry      = 0;
            int columnSize = 12;

            bool isEmpty = true;

            iWrite.WriteLine();

            foreach (IResourceProducer producer in Resources.Producers)
            {
                producer.GetEventCounters(out names, out values);
                isEmpty = false;

                if (entry == 0)
                {
                    names.Insert(0, "Name");
                    CommandLineInterface.printTableHeader((JQuant.IWrite) this, names, columnSize);
                }
                values.Insert(0, OutputUtils.FormatField(producer.Name, columnSize));
                CommandLineInterface.printValues((JQuant.IWrite) this, values, columnSize);

                entry++;
            }
            if (isEmpty)
            {
                iWrite.WriteLine("No producers");
            }
        }
예제 #2
0
        protected static string OrderPair2String(MarketSimulation.OrderPair op, int columnSize)
        {
            string res = "" + op.price + ":" + op.size + " ";

            res = OutputUtils.FormatField(res, columnSize);
            return(res);
        }
예제 #3
0
        protected void debugLoggerShowCallback(IWrite iWrite, string cmdName, object[] cmdArguments)
        {
            iWrite.WriteLine(
                OutputUtils.FormatField("Name", 10) +
                OutputUtils.FormatField("Triggered", 10) +
                OutputUtils.FormatField("Logged", 10) +
                OutputUtils.FormatField("Dropped", 10) +
                OutputUtils.FormatField("Log type", 10) +
                OutputUtils.FormatField("Latest", 24) +
                OutputUtils.FormatField("Oldest", 24) +
                OutputUtils.FormatField("Stamped", 10)
                );
            iWrite.WriteLine("-----------------------------------------------------------------------------------------------------------------------");
            bool isEmpty = true;

            foreach (ILogger logger in Resources.Loggers)
            {
                isEmpty = false;
                iWrite.WriteLine(
                    OutputUtils.FormatField(logger.GetName(), 10) +
                    OutputUtils.FormatField(logger.GetCountTrigger(), 10) +
                    OutputUtils.FormatField(logger.GetCountLog(), 10) +
                    OutputUtils.FormatField(logger.GetCountDropped(), 10) +
                    OutputUtils.FormatField(logger.GetLogType().ToString(), 10) +
                    OutputUtils.FormatField(logger.GetLatest().ToString(), 24) +
                    OutputUtils.FormatField(logger.GetOldest().ToString(), 24) +
                    OutputUtils.FormatField(logger.TimeStamped().ToString(), 10)
                    );
            }
            if (isEmpty)
            {
                iWrite.WriteLine("No loggers");
            }
        }
예제 #4
0
        protected void debugPrintResourcesNameAndStats(IWrite iWrite, System.Collections.ArrayList list)
        {
            int entry      = 0;
            int columnSize = 8;

            bool isEmpty = true;

            iWrite.WriteLine();

            foreach (INamedResource resNamed in list)
            {
                isEmpty = false;

                IResourceStatistics resStat = (IResourceStatistics)resNamed;

                System.Collections.ArrayList names;
                System.Collections.ArrayList values;
                resStat.GetEventCounters(out names, out values);

                if (entry == 0)
                {
                    names.Insert(0, "Name");
                    CommandLineInterface.printTableHeader(iWrite, names, columnSize);
                }
                values.Insert(0, OutputUtils.FormatField(resNamed.Name, columnSize));
                CommandLineInterface.printValues(iWrite, values, columnSize);

                entry++;
            }
            if (isEmpty)
            {
                System.Console.WriteLine("Table is empty - no resources registered");
            }
        }
예제 #5
0
        protected void debugThreadShowCallback(IWrite iWrite, string cmdName, object[] cmdArguments)
        {
            iWrite.WriteLine();
            iWrite.WriteLine(
                OutputUtils.FormatField("Name", 10) +
                OutputUtils.FormatField("State", 14) +
                OutputUtils.FormatField("Ticks", 10)
                );
            iWrite.WriteLine("-------------------------------------------");
            bool isEmpty = true;

            foreach (IThread iThread in Resources.Threads)
            {
                isEmpty = false;
                iWrite.WriteLine(
                    OutputUtils.FormatField(iThread.Name, 10) +
                    OutputUtils.FormatField(EnumUtils.GetDescription(iThread.GetState()), 14) +
                    OutputUtils.FormatField(iThread.GetLongestJob(), 10)
                    );
            }
            if (isEmpty)
            {
                iWrite.WriteLine("No threads");
            }
            int workerThreads;
            int completionPortThreads;

            System.Threading.ThreadPool.GetAvailableThreads(out workerThreads, out completionPortThreads);
            iWrite.WriteLine("workerThreads=" + workerThreads + ",completionPortThreads=" + completionPortThreads);
        }
예제 #6
0
 protected void printIntStatistics(IWrite iWrite, IntStatistics statistics)
 {
     iWrite.WriteLine(OutputUtils.FormatField(statistics.Name, 8) +
                      OutputUtils.FormatField(statistics.Mean, 8) +
                      OutputUtils.FormatField(statistics.Full().ToString(), 8) +
                      OutputUtils.FormatField(statistics.Size, 8) +
                      OutputUtils.FormatField(statistics.Count, 8)
                      );
 }
예제 #7
0
 protected void printIntMaxMin(IWrite iWrite, IntMaxMin maxMin)
 {
     iWrite.WriteLine(OutputUtils.FormatField(maxMin.Name, 8) +
                      OutputUtils.FormatField(maxMin.Max, 8) +
                      OutputUtils.FormatField(maxMin.Min, 8) +
                      OutputUtils.FormatField(maxMin.Full().ToString(), 8) +
                      OutputUtils.FormatField(maxMin.Size, 8) +
                      OutputUtils.FormatField(maxMin.Count, 8)
                      );
 }
예제 #8
0
 protected void printIntStatisticsHeader(IWrite iWrite)
 {
     iWrite.WriteLine(OutputUtils.FormatField("Name", 8) +
                      OutputUtils.FormatField("Mean", 8) +
                      OutputUtils.FormatField("Ready", 8) +
                      OutputUtils.FormatField("Size", 8) +
                      OutputUtils.FormatField("Count", 8)
                      );
     iWrite.WriteLine("----------------------------------------------------------------");
 }
예제 #9
0
 protected void printIntMaxMinHeader(IWrite iWrite)
 {
     iWrite.WriteLine(OutputUtils.FormatField("Name", 8) +
                      OutputUtils.FormatField("Max", 8) +
                      OutputUtils.FormatField("Min", 8) +
                      OutputUtils.FormatField("Ready", 8) +
                      OutputUtils.FormatField("Size", 8) +
                      OutputUtils.FormatField("Count", 8)
                      );
     iWrite.WriteLine("----------------------------------------------------------------");
 }
예제 #10
0
        public static void printValues(IWrite iWrite, System.Collections.ArrayList values, int[] columns)
        {
            string outputS = "";

            for (int i = 0; i < values.Count; i++)
            {
                string s          = "";
                int    columnSize = columns[i];

                // add blank up to columnSize
                s        = OutputUtils.FormatField(values[i].ToString(), columnSize);
                outputS += s;
            }
            iWrite.WriteLine(outputS);
        }
예제 #11
0
        public static void printTableHeader(IWrite iWrite, System.Collections.ArrayList names, int[] columns)
        {
            int  line             = 0;
            bool printed          = true;
            int  maxOutputSLength = 0;

            while (printed)
            {
                printed = false;
                string outputS = "";

                for (int i = 0; i < names.Count; i++)
                {
                    int    columnSize    = columns[i];
                    int    charsInColumn = columnSize - 1;
                    string s             = "";
                    string name          = names[i].ToString();

                    // get (columnSize-1) chars from the name[i]
                    if (name.Length > line * charsInColumn)
                    {
                        int temp = System.Math.Min(name.Length - line * charsInColumn, charsInColumn);
                        s       = name.Substring(line * charsInColumn, temp);
                        printed = true;
                    }

                    // add blank up to columnSize
                    s        = OutputUtils.FormatField(s, columnSize);
                    outputS += s;
                }

                if (printed)
                {
                    iWrite.WriteLine(outputS);
                    if (maxOutputSLength < outputS.Length)
                    {
                        maxOutputSLength = outputS.Length;
                    }
                }

                line++;
            }

            printSeparator(iWrite, maxOutputSLength);
        }