Ejemplo n.º 1
0
        public void CalculatorButtonClicked(object keyData)
        {
            CalculatorKeyData calculatorKeyData = (CalculatorKeyData)keyData;
            var value = calculatorKeyData.KeyName;

            if (operationStringArr.Any(x => ResultString.EndsWith(x) && ResultString.EndsWith(value)))
            {
                return;
            }
            if (value == "C")
            {
                ResultString = "0";
                return;
            }
            if (ResultString == "0" || ResultString == "E")
            {
                ResultString = "";
            }
            //restricts the calculator input to max of 15 character length
            if (ResultString.Length >= 15 && !operationStringArr.Any(x => ResultString.Contains(x)))
            {
                return;
            }
            else if (ResultString.Length >= 15 && value != "=")
            {
                return;
            }
            ResultString += Convert.ToString(value);
            if (value == "=")
            {
                try{
                    ResultString = new DataTable().Compute(ResultString.TrimEnd('='), null).ToString();
                }
                catch (Exception ex) {
                    //returns error to user if any operation in the screen results in and error during parsing and computation
                    ResultString = "E";
                }
            }
        }
Ejemplo n.º 2
0
        public string[,] CollectSimulationResults()
        {
            string ResultsSectionHeader = "Конфигурация сети на кристалле:";

            int PacketsGenerationPeriodAvgLine  = 40;
            int PacketsGenerationPeriodAvgIndex = 0;

            int ModellingTimeLine  = 83;
            int ModellingTimeIndex = 1;

            int PacketsSentLine  = 91;
            int PacketsSentIndex = 2;

            int PacketsReceivedLine  = 97;
            int PacketsReceivedIndex = 3;

            int PacketGenerationErrorsLine  = 103;
            int PacketGenerationErrorsIndex = 4;

            int PacketGenerationSpeedLine  = 111;
            int PacketGenerationSpeedIndex = 5;

            int FlitsGenerationSpeedLine  = 117;
            int FlitsGenerationSpeedIndex = 6;

            int FlitsSendingSpeedLine  = 123;
            int FlitsSendingSpeedIndex = 7;

            int PacketsDeliveryTimeLine  = 129;
            int PacketsDeliveryTimeIndex = 8;

            int PacketsHopsLine  = 135;
            int PacketsHopsIndex = 9;

            int NetworkThroughoutLine  = 143;
            int NetworkThroughoutIndex = 10;

            int RouterThroughoutLine  = 149;
            int RouterThroughoutIndex = 11;

            int CoreReceivingBuffersLoadLine  = 157;
            int CoreReceivingBuffersLoadIndex = 12;

            int CoreSendingBuffersLoadLine  = 163;
            int CoreSendingBuffersLoadIndex = 13;

            int RouterReceivingBuffersLoadLine  = 171;
            int RouterReceivingBuffersLoadIndex = 14;

            int RouterSendingBuffersLoadLine  = 177;
            int RouterSendingBuffersLoadIndex = 15;

            int BuffersLoadLine  = 185;
            int BuffersLoadIndex = 16;

            int PhysicChannelsLoadLine  = 191;
            int PhysicChannelsLoadIndex = 17;

            int CharacteristicsAmount = 18;


            int SectionsAmount = 0;

            string[] ResultSections = File.ReadAllLines(ResultsDirectoryPath + "\\" + DefaultResultFileName);
            foreach (string ResultString in ResultSections)
            {
                if (ResultString.Contains(ResultsSectionHeader))
                {
                    SectionsAmount++;
                }
            }
            string[,] Result = new string[SectionsAmount, CharacteristicsAmount];

            int SectionIndex     = -1;
            int SectionLineIndex = 0;

            foreach (string ResultString in ResultSections)
            {
                if (ResultString.Contains(ResultsSectionHeader))
                {
                    SectionIndex++;
                    SectionLineIndex = 0;
                }
                else if (SectionLineIndex == PacketsGenerationPeriodAvgLine)
                {
                    Result[SectionIndex, PacketsGenerationPeriodAvgIndex] = Common.ExtractValue(ResultString);
                }
                else if (SectionLineIndex == ModellingTimeLine)
                {
                    Result[SectionIndex, ModellingTimeIndex] = Common.ExtractValue(ResultString);
                }
                else if (SectionLineIndex == PacketsSentLine)
                {
                    Result[SectionIndex, PacketsSentIndex] = Common.ExtractValue(ResultString);
                }
                else if (SectionLineIndex == PacketsReceivedLine)
                {
                    Result[SectionIndex, PacketsReceivedIndex] = Common.ExtractValue(ResultString);
                }
                else if (SectionLineIndex == PacketGenerationErrorsLine)
                {
                    Result[SectionIndex, PacketGenerationErrorsIndex] = Common.ExtractValue(ResultString);
                }
                else if (SectionLineIndex == PacketGenerationSpeedLine)
                {
                    Result[SectionIndex, PacketGenerationSpeedIndex] = Common.ExtractValue(ResultString);
                }
                else if (SectionLineIndex == FlitsGenerationSpeedLine)
                {
                    Result[SectionIndex, FlitsGenerationSpeedIndex] = Common.ExtractValue(ResultString);
                }
                else if (SectionLineIndex == FlitsSendingSpeedLine)
                {
                    Result[SectionIndex, FlitsSendingSpeedIndex] = Common.ExtractValue(ResultString);
                }
                else if (SectionLineIndex == PacketsDeliveryTimeLine)
                {
                    Result[SectionIndex, PacketsDeliveryTimeIndex] = Common.ExtractValue(ResultString);
                }
                else if (SectionLineIndex == PacketsHopsLine)
                {
                    Result[SectionIndex, PacketsHopsIndex] = Common.ExtractValue(ResultString);
                }
                else if (SectionLineIndex == NetworkThroughoutLine)
                {
                    Result[SectionIndex, NetworkThroughoutIndex] = Common.ExtractValue(ResultString);
                }
                else if (SectionLineIndex == RouterThroughoutLine)
                {
                    Result[SectionIndex, RouterThroughoutIndex] = Common.ExtractValue(ResultString);
                }
                else if (SectionLineIndex == CoreReceivingBuffersLoadLine)
                {
                    Result[SectionIndex, CoreReceivingBuffersLoadIndex] = Common.ExtractValue(ResultString);
                }
                else if (SectionLineIndex == CoreSendingBuffersLoadLine)
                {
                    Result[SectionIndex, CoreSendingBuffersLoadIndex] = Common.ExtractValue(ResultString);
                }
                else if (SectionLineIndex == RouterReceivingBuffersLoadLine)
                {
                    Result[SectionIndex, RouterReceivingBuffersLoadIndex] = Common.ExtractValue(ResultString);
                }
                else if (SectionLineIndex == RouterSendingBuffersLoadLine)
                {
                    Result[SectionIndex, RouterSendingBuffersLoadIndex] = Common.ExtractValue(ResultString);
                }
                else if (SectionLineIndex == BuffersLoadLine)
                {
                    Result[SectionIndex, BuffersLoadIndex] = Common.ExtractValue(ResultString);
                }
                else if (SectionLineIndex == PhysicChannelsLoadLine)
                {
                    Result[SectionIndex, PhysicChannelsLoadIndex] = Common.ExtractValue(ResultString);
                }

                SectionLineIndex++;
            }

            return(Result);
        }
Ejemplo n.º 3
0
        public string[,] CollectSimulationResults()
        {
            int CharacteristicsAmount = 15;

            int TotalProducedFlitsLine  = 2;
            int TotalProducedFlitsIndex = 0;

            int TotalAcceptedFlitsLine  = 3;
            int TotalAcceptedFlitsIndex = 1;

            int TotalReceivedFlitsLine  = 4;
            int TotalReceivedFlitsIndex = 2;

            int NetworkProductionLine  = 5;
            int NetworkProductionIndex = 3;

            int NetworkAcceptanceLine  = 6;
            int NetworkAcceptanceIndex = 4;

            int NetworkThroughputLine  = 7;
            int NetworkThroughputIndex = 5;

            int IpThroughputLine  = 8;
            int IpThroughputIndex = 6;

            int LastTimeFlitReceivedLine  = 9;
            int LastTimeFlitReceivedIndex = 7;

            int MaxBufferStuckDelayLine  = 10;
            int MaxBufferStuckDelayIndex = 8;

            int MaxTimeFlitInNetworkLine  = 11;
            int MaxTimeFlitInNetworkIndex = 9;

            int TotalReceivedPacketsLine  = 12;
            int TotalReceivedPacketsIndex = 10;

            int TotalFlitsLostLine  = 13;
            int TotalFlitsLostIndex = 11;

            int GlobalAverageDelayLine  = 14;
            int GlobalAverageDelayIndex = 12;

            int MaxDelayLine  = 15;
            int MaxDelayIndex = 13;

            int AverageBufferUtilizationLine  = 16;
            int AverageBufferUtilizationIndex = 14;

            int SectionsAmount = 0;

            string[] ResultSections = File.ReadAllLines(ResultsDirectoryPath + "\\" + DefaultResultFileName);
            foreach (string ResultString in ResultSections)
            {
                if (ResultString.Contains(ResultSectionHeader))
                {
                    SectionsAmount++;
                }
            }
            string[,] Result = new string[SectionsAmount, CharacteristicsAmount];

            int  SectionIndex     = -1;
            int  SectionLineIndex = 0;
            bool InSection        = false;

            foreach (string ResultString in ResultSections)
            {
                if (ResultString.Contains(ResultSectionHeader))
                {
                    SectionIndex++;
                    SectionLineIndex = 0;
                    InSection        = true;
                }
                else if (SectionLineIndex == TotalProducedFlitsLine && InSection)
                {
                    Result[SectionIndex, TotalProducedFlitsIndex] = ExtractValue(ResultString);
                }
                else if (SectionLineIndex == TotalAcceptedFlitsLine && InSection)
                {
                    Result[SectionIndex, TotalAcceptedFlitsIndex] = ExtractValue(ResultString);
                }
                else if (SectionLineIndex == TotalReceivedFlitsLine && InSection)
                {
                    Result[SectionIndex, TotalReceivedFlitsIndex] = ExtractValue(ResultString);
                }
                else if (SectionLineIndex == NetworkProductionLine && InSection)
                {
                    Result[SectionIndex, NetworkProductionIndex] = ExtractValue(ResultString);
                }
                else if (SectionLineIndex == NetworkAcceptanceLine && InSection)
                {
                    Result[SectionIndex, NetworkAcceptanceIndex] = ExtractValue(ResultString);
                }
                else if (SectionLineIndex == NetworkThroughputLine && InSection)
                {
                    Result[SectionIndex, NetworkThroughputIndex] = ExtractValue(ResultString);
                }
                else if (SectionLineIndex == IpThroughputLine && InSection)
                {
                    Result[SectionIndex, IpThroughputIndex] = ExtractValue(ResultString);
                }
                else if (SectionLineIndex == LastTimeFlitReceivedLine && InSection)
                {
                    Result[SectionIndex, LastTimeFlitReceivedIndex] = ExtractValue(ResultString);
                }
                else if (SectionLineIndex == MaxBufferStuckDelayLine && InSection)
                {
                    Result[SectionIndex, MaxBufferStuckDelayIndex] = ExtractValue(ResultString);
                }
                else if (SectionLineIndex == MaxTimeFlitInNetworkLine && InSection)
                {
                    Result[SectionIndex, MaxTimeFlitInNetworkIndex] = ExtractValue(ResultString);
                }
                else if (SectionLineIndex == TotalReceivedPacketsLine && InSection)
                {
                    Result[SectionIndex, TotalReceivedPacketsIndex] = ExtractValue(ResultString);
                }
                else if (SectionLineIndex == TotalFlitsLostLine && InSection)
                {
                    Result[SectionIndex, TotalFlitsLostIndex] = ExtractValue(ResultString);
                }
                else if (SectionLineIndex == GlobalAverageDelayLine && InSection)
                {
                    Result[SectionIndex, GlobalAverageDelayIndex] = ExtractValue(ResultString);
                }
                else if (SectionLineIndex == MaxDelayLine && InSection)
                {
                    Result[SectionIndex, MaxDelayIndex] = ExtractValue(ResultString);
                }
                else if (SectionLineIndex == AverageBufferUtilizationLine && InSection)
                {
                    Result[SectionIndex, AverageBufferUtilizationIndex] = ExtractValue(ResultString);
                    InSection = false;
                }

                SectionLineIndex++;
            }

            return(Result);
        }
Ejemplo n.º 4
0
        public string[,] CollectSimulationResults()
        {
            int CharacteristicsAmount = 11;

            int PacketLatencyAverageLine  = 2;
            int PacketLatencyAveraveIndex = 0;

            int NetworkLatencyAverageLine  = 5;
            int NetworkLatencyAverageIndex = 1;

            int FlitLatencyAverageLine  = 8;
            int FlitLatencyAverageIndex = 2;

            int FragmentationAverageLine  = 11;
            int FragmentationAverageIndex = 3;

            int InjectedPacketRateAverageLine  = 14;
            int InjectedPacketRateAverageIndex = 4;

            int AcceptedPacketRateAverageLine  = 17;
            int AcceptedPacketRateAverageIndex = 5;

            int InjectedFlitRateAverageLine  = 20;
            int InjectedFlitRateAverageIndex = 6;

            int AcceptedFlitRateAverageLine  = 23;
            int AcceptedFlitRateAverageIndex = 7;

            int InjectedPacketSizeAverageLine  = 26;
            int InjectedPacketSizeAverageIndex = 8;

            int AcceptedPacketSizeAverageLine  = 27;
            int AcceptedPacketSizeAverageIndex = 9;

            int HopsAverageLine  = 28;
            int HopsAverageIndex = 10;

            int SectionsAmount = 0;

            string[] ResultSections = File.ReadAllLines(ResultsDirectoryPath + "\\" + DefaultResultFileName);
            foreach (string ResultString in ResultSections)
            {
                if (ResultString.Contains(SectionHeader))
                {
                    SectionsAmount++;
                }
            }
            string[,] Result = new string[SectionsAmount, CharacteristicsAmount];

            int  SectionIndex     = -1;
            int  SectionLineIndex = 0;
            bool InSection        = false;

            foreach (string ResultString in ResultSections)
            {
                if (ResultString.Contains(SectionHeader))
                {
                    SectionIndex++;
                    SectionLineIndex = 0;
                    InSection        = true;
                }
                else if (SectionLineIndex == PacketLatencyAverageLine && InSection)
                {
                    Result[SectionIndex, PacketLatencyAveraveIndex] = ExtractValue(ResultString);
                }
                else if (SectionLineIndex == NetworkLatencyAverageLine && InSection)
                {
                    Result[SectionIndex, NetworkLatencyAverageIndex] = ExtractValue(ResultString);
                }
                else if (SectionLineIndex == FlitLatencyAverageLine && InSection)
                {
                    Result[SectionIndex, FlitLatencyAverageIndex] = ExtractValue(ResultString);
                }
                else if (SectionLineIndex == FragmentationAverageLine && InSection)
                {
                    Result[SectionIndex, FragmentationAverageIndex] = ExtractValue(ResultString);
                }
                else if (SectionLineIndex == InjectedPacketRateAverageLine && InSection)
                {
                    Result[SectionIndex, InjectedPacketRateAverageIndex] = ExtractValue(ResultString);
                }
                else if (SectionLineIndex == AcceptedPacketRateAverageLine && InSection)
                {
                    Result[SectionIndex, AcceptedPacketRateAverageIndex] = ExtractValue(ResultString);
                }
                else if (SectionLineIndex == InjectedFlitRateAverageLine && InSection)
                {
                    Result[SectionIndex, InjectedFlitRateAverageIndex] = ExtractValue(ResultString);
                }
                else if (SectionLineIndex == AcceptedFlitRateAverageLine && InSection)
                {
                    Result[SectionIndex, AcceptedFlitRateAverageIndex] = ExtractValue(ResultString);
                }
                else if (SectionLineIndex == InjectedPacketSizeAverageLine && InSection)
                {
                    Result[SectionIndex, InjectedPacketSizeAverageIndex] = ExtractValue(ResultString);
                }
                else if (SectionLineIndex == AcceptedPacketSizeAverageLine && InSection)
                {
                    Result[SectionIndex, AcceptedPacketSizeAverageIndex] = ExtractValue(ResultString);
                }
                else if (SectionLineIndex == HopsAverageLine && InSection)
                {
                    Result[SectionIndex, HopsAverageIndex] = ExtractValue(ResultString);
                    InSection = false;
                }

                SectionLineIndex++;
            }

            return(Result);
        }