예제 #1
0
        private void GetDevicesReport()
        {
            bool haveMultiChannelDevice = m_model.GetDevices().Count(x => x is MultiChannelDevice) > 0;

            m_writer.WriteLine(
                $"   <table>\r\n" +
                $"    <caption>{GlobalizationEngine.GetString("Information about devices")}</caption>\r\n" +
                $"    <tr>\r\n" +
                $"     <th>{GlobalizationEngine.GetString("Name of device")}</th>\r\n" +
                $"     <th>{GlobalizationEngine.GetString("Average processing time")}</th>\r\n" +
                $"     <th>{GlobalizationEngine.GetString("Load percentage")}</th>\r\n" +
                $"     <th>{GlobalizationEngine.GetString("Transact count")}</th>\r\n" +
                (haveMultiChannelDevice ? $"     <th>{GlobalizationEngine.GetString("Channel count")}</th>\r\n" : "") +
                $"    </tr>");

            foreach (Device device in m_model.GetDevices())
            {
                string avgProcessingTime = (device.TimeUsedSum * 1.0f / device.TransactCount).ToString("0.##");
                string loadPercentage    = (device.TimeUsedSum * 1.0f / m_model.ModelTime * 100).ToString("0.##");
                m_writer.WriteLine($"<tr><td>{device.Name}</td><td>{avgProcessingTime}</td><td>{loadPercentage}%</td><td>{device.TransactCount}</td>");
                if (device is MultiChannelDevice)
                {
                    MultiChannelDevice multichannelDevice = device as MultiChannelDevice;
                    m_writer.WriteLine($"<td>{multichannelDevice.StorageSize}</td>");
                }
                m_writer.WriteLine("</tr>");
            }

            m_writer.WriteLine("   </table>");
        }
예제 #2
0
 public void GetCurrentState(int maxPossibleLines = 100)
 {
     Console.WriteLine($"{GlobalizationEngine.GetString("Current model time")}: {m_model.ModelTime}");
     GetEventsState(maxPossibleLines);
     GetDevicesState(maxPossibleLines);
     GetQueuesState(maxPossibleLines);
 }
예제 #3
0
        private void GetDevicesReport(int maxPossibleLines)
        {
            Console.WriteLine($"  {GlobalizationEngine.GetString("Information about devices")}:");
            int outputLength = 0;

            foreach (Device device in m_model.GetDevices())
            {
                double avgProcessingTime = device.TimeUsedSum * 1.0f / device.TransactCount;
                Console.WriteLine($"    {GlobalizationEngine.GetString("Name of device")}: {device.Name}");
                Console.WriteLine($"    {GlobalizationEngine.GetString("Average processing time")}: {avgProcessingTime.ToString("0.##")}");
                Console.WriteLine($"    {GlobalizationEngine.GetString("Load percentage")}: {(device.TimeUsedSum * 1.0f / m_model.ModelTime * 100).ToString("0.##")}%");
                Console.WriteLine($"    {GlobalizationEngine.GetString("Transact count")}: {device.TransactCount}");

                if (device is MultiChannelDevice)
                {
                    MultiChannelDevice multichannelDevice = device as MultiChannelDevice;
                    Console.WriteLine($"    {GlobalizationEngine.GetString("Channel count")}: {multichannelDevice.StorageSize}");
                }

                if (maxPossibleLines != -1 && outputLength++ > maxPossibleLines)
                {
                    Console.WriteLine(GlobalizationEngine.GetString("There are too many items to be displayed. Truncating output. If you want to avoid it, set maxPossibleLines to -1"));
                    return;
                }
            }
        }
예제 #4
0
 private void WriteBody()
 {
     m_writer.WriteLine(" <body>\r\n");
     m_writer.WriteLine($"   <h1>{GlobalizationEngine.GetString("Report was generated")} {DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss")}</h1>");
     GetDevicesReport();
     GetQueuesReport();
     m_writer.WriteLine(" </body>");
 }
예제 #5
0
        public void GetReport(string filename = null)
        {
            m_writer           = new StreamWriter(filename);
            m_writer.AutoFlush = true;

            m_writer.WriteLine($"# {GlobalizationEngine.GetString("Model report")}. {GlobalizationEngine.GetString("Report was generated")} {DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss")}");
            m_writer.WriteLine("");
            GetDevicesReport();
            m_writer.WriteLine("");
            GetQueuesReport();
        }
예제 #6
0
        public void GetReport(string filename = null)
        {
            if (filename != null && filename.Length > 0)
            {
                LogDuplicator.Init(filename);
            }

            Console.WriteLine($"{GlobalizationEngine.GetString("Model report")}. {GlobalizationEngine.GetString("Report was generated")} {DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss")}");
            GetCurrentState(m_maxPossibleLines);
            Console.WriteLine(" ");
            Console.WriteLine(" ");
            GetModelResult();
        }
예제 #7
0
 private void GetQueuesReport()
 {
     m_writer.WriteLine($"## {GlobalizationEngine.GetString("Information about queues")}");
     m_writer.WriteLine("");
     m_writer.WriteLine($"| {GlobalizationEngine.GetString("Name of queue")} | {GlobalizationEngine.GetString("Max observed length")} | " +
                        $"{GlobalizationEngine.GetString("Average wait time")} | {GlobalizationEngine.GetString("Average length")} |");
     m_writer.WriteLine($"|-------------|--------------------|-------------------|----------------|");
     foreach (SMQueue queue in m_model.GetQueues())
     {
         double avgWaitTime = queue.WaitTimeSum * 1.0f / queue.MaxObservedLength;
         string avgLength   = (queue.TimeQueueSum * 1.0f / m_model.ModelTime).ToString("0.##");
         m_writer.WriteLine($"| {queue.Name} | {queue.MaxObservedLength} | {avgWaitTime.ToString("0.##")} | {avgLength} |");
     }
 }
예제 #8
0
        private void GetQueuesState(int maxPossibleLines)
        {
            Console.WriteLine($"  {GlobalizationEngine.GetString("State of queues")}:");
            int outputLength = 0;

            foreach (SMQueue queue in m_model.GetQueues())
            {
                Console.WriteLine($"    {GlobalizationEngine.GetString("Name of queue")}: {queue.Name}");
                Console.WriteLine($"    {GlobalizationEngine.GetString("Max observed length")}: {queue.MaxObservedLength}");
                Console.WriteLine($"    {GlobalizationEngine.GetString("Number of current items")}: {queue.Count}");

                if (maxPossibleLines != -1 && outputLength++ > maxPossibleLines)
                {
                    Console.WriteLine(GlobalizationEngine.GetString("There are too many items to be displayed. Truncating output. If you want to avoid it, set maxPossibleLines to -1"));
                    return;
                }
            }
        }
예제 #9
0
        private void GetEventsState(int maxPossibleLines)
        {
            Console.WriteLine($"  {GlobalizationEngine.GetString("State of unprocessed events")}:");
            int outputLength = 0;

            foreach (Event @event in m_model.GetEvents())
            {
                Console.WriteLine($"    {GlobalizationEngine.GetString("Time of event")}: {@event.Time}");
                Console.WriteLine($"    {GlobalizationEngine.GetString("Number of event")}: {@event.EventId.ToString()}");
                Console.WriteLine($"    {GlobalizationEngine.GetString("Number of transact")}: {@event.TransactId}");

                if (maxPossibleLines != -1 && outputLength++ > maxPossibleLines)
                {
                    Console.WriteLine(GlobalizationEngine.GetString("There are too many items to be displayed. Truncating output. If you want to avoid it, set maxPossibleLines to -1"));
                    return;
                }
            }
        }
예제 #10
0
        private void GetDevicesState(int maxPossibleLines)
        {
            Console.WriteLine($"  {GlobalizationEngine.GetString("State of devices")}:");
            int outputLength = 0;

            foreach (Device device in m_model.GetDevices())
            {
                Console.WriteLine($"    {GlobalizationEngine.GetString("Name of device")}: {device.Name}");
                Console.WriteLine($"    {GlobalizationEngine.GetString("Number of transact")}: {device.CurrentTransactId}");
                Console.WriteLine($"    {GlobalizationEngine.GetString("Last time used")}: {device.LastTimeUsed}");

                if (maxPossibleLines != -1 && outputLength++ > maxPossibleLines)
                {
                    Console.WriteLine(GlobalizationEngine.GetString("There are too many items to be displayed. Truncating output. If you want to avoid it, set maxPossibleLines to -1"));
                    return;
                }
            }
        }
예제 #11
0
        private void GetQueuesReport(int maxPossibleLines)
        {
            Console.WriteLine($"  {GlobalizationEngine.GetString("Information about queues")}:");
            int outputLength = 0;

            foreach (SMQueue queue in m_model.GetQueues())
            {
                double avgWaitTime = queue.WaitTimeSum * 1.0f / queue.MaxObservedLength;
                Console.WriteLine($"    {GlobalizationEngine.GetString("Name of queue")}: {queue.Name}");
                Console.WriteLine($"    {GlobalizationEngine.GetString("Max observed length")}: {queue.MaxObservedLength}");
                Console.WriteLine($"    {GlobalizationEngine.GetString("Average wait time")}: {avgWaitTime.ToString("0.##")}");
                Console.WriteLine($"    {GlobalizationEngine.GetString("Average length")}: {(queue.TimeQueueSum * 1.0f / m_model.ModelTime).ToString("0.##")}");

                if (maxPossibleLines != -1 && outputLength++ > maxPossibleLines)
                {
                    Console.WriteLine(GlobalizationEngine.GetString("There are too many items to be displayed. Truncating output. If you want to avoid it, set maxPossibleLines to -1"));
                    return;
                }
            }
        }
예제 #12
0
        private void GetQueuesReport()
        {
            m_writer.WriteLine(
                $"   <table>\r\n" +
                $"    <caption>{GlobalizationEngine.GetString("Information about queues")}</caption>\r\n" +
                $"    <tr>\r\n" +
                $"     <th>{GlobalizationEngine.GetString("Name of queue")}</th>\r\n" +
                $"     <th>{GlobalizationEngine.GetString("Max observed length")}</th>\r\n" +
                $"     <th>{GlobalizationEngine.GetString("Average wait time")}</th>\r\n" +
                $"     <th>{GlobalizationEngine.GetString("Average length")}</th>\r\n" +
                $"    </tr>");

            foreach (SMQueue queue in m_model.GetQueues())
            {
                double avgWaitTime = queue.WaitTimeSum * 1.0f / queue.MaxObservedLength;
                string avgLength   = (queue.TimeQueueSum * 1.0f / m_model.ModelTime).ToString("0.##");
                m_writer.WriteLine($"<tr><td>{queue.Name}</td><td>{queue.MaxObservedLength}</td><td>{avgWaitTime.ToString("0.##")}</td><td>{avgLength}</td></tr>");
            }

            m_writer.WriteLine("   </table>");
        }
예제 #13
0
        private void GetDevicesReport()
        {
            bool haveMultiChannelDevice = m_model.GetDevices().Count(x => x is MultiChannelDevice) > 0;

            m_writer.WriteLine($"## {GlobalizationEngine.GetString("Information about devices")}");
            m_writer.WriteLine("");
            m_writer.WriteLine($"| {GlobalizationEngine.GetString("Name of device")} | {GlobalizationEngine.GetString("Average processing time")} | " +
                               $" {GlobalizationEngine.GetString("Average processing time")} | {GlobalizationEngine.GetString("Transact count")} | {(haveMultiChannelDevice? GlobalizationEngine.GetString("Channel count") + " |":"")}");
            m_writer.WriteLine($"|-------------|---------------------|-----------------|----------------|{(haveMultiChannelDevice ?"----------------|":"")}");
            foreach (Device device in m_model.GetDevices())
            {
                string avgProcessingTime = (device.TimeUsedSum * 1.0f / device.TransactCount).ToString("0.##");
                string loadPercentage    = (device.TimeUsedSum * 1.0f / m_model.ModelTime * 100).ToString("0.##");
                string line = $"| {device.Name} | {avgProcessingTime} | {loadPercentage}% | {device.TransactCount} |";

                if (device is MultiChannelDevice)
                {
                    MultiChannelDevice multichannelDevice = device as MultiChannelDevice;
                    line += $" {multichannelDevice.StorageSize} |";
                }

                m_writer.WriteLine(line);
            }
        }
예제 #14
0
 public void GetModelResult(int maxPossibleLines = 100)
 {
     Console.WriteLine(GlobalizationEngine.GetString("Total model results") + ":");
     GetDevicesReport(maxPossibleLines);
     GetQueuesReport(maxPossibleLines);
 }