Ejemplo n.º 1
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");
            }
        }
Ejemplo n.º 2
0
        protected void debugHttpStat(IWrite iWrite, string cmdName, object[] cmdArguments)
        {
            IResourceStatistics resStat = JQuantHttp.Http.GetIResourceStatistics();

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

            int columnSize = 8;

            CommandLineInterface.printTableHeader(iWrite, names, columnSize);
            CommandLineInterface.printValues(iWrite, values, columnSize);
        }
Ejemplo n.º 3
0
        protected void algoStat(IWrite iWrite, string cmdName, object[] cmdArguments)
        {
            if (algoMachine == null)
            {
                iWrite.WriteLine("No algo started");
                return;
            }

            IResourceStatistics resStat = algoMachine;

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

            int columnSize = 8;

            CommandLineInterface.printTableHeader(iWrite, names, columnSize);
            CommandLineInterface.printValues(iWrite, values, columnSize);
        }
Ejemplo n.º 4
0
        private void httpReqGetHttpStat(string request, System.Net.Sockets.NetworkStream networkStream, out bool stream)
        {
            // this is not a stream - let HTTP server close the connection when I am done
            stream = false;

            // i ignore the request itself - no arguments

            // get traffic countres from the HTTP server (I assume that there is only one server)
            IResourceStatistics resStat = JQuantHttp.Http.GetIResourceStatistics();

            // i have to create a packet containing JSON formated data
            string s = JQuant.OutputUtils.GetJSON(resStat);

            System.DateTime dtNow = System.DateTime.Now;
            byte[]          data  = System.Text.Encoding.ASCII.GetBytes(s);
            JQuantHttp.Http.SendHeader(networkStream, dtNow, false, data.Length, JQuantHttp.Http.GetMimeType(".html"));
            JQuantHttp.Http.SendOctets(networkStream, data);

            return;
        }