Exemplo n.º 1
0
        // This returns the total download mbps usage for the ENTIRE subgraph
        public MbpsUsage GetTotalDownloadMbpsUsage()
        {
            if (connectionState == ConnectionState.DISCONNECTED)
            {
                return(new MbpsUsage(GetDownloadMbpsUsage(), 0.0));
            }
            else if (connectionState == ConnectionState.CONNECTED_WIFI)
            {
                MbpsUsage usage = GetAssociatedRouter().GetTotalDownloadMbpsUsage();
                usage.currentUsage += GetDownloadMbpsUsage();
                return(usage);
            }

            double     totalMbps = 0.0;
            List <int> trace     = GetGraphTrace();

            foreach (int objectId in trace)
            {
                NetworkObject obj = Settings.GetSingleton().GetObject(objectId);

                if (obj != null)
                {
                    totalMbps += obj.GetDownloadMbpsUsage();
                }
            }

            double maxMbps = Settings.GetSingleton().GetObject(trace[trace.Count - 1]).GetTrueDownloadMbps();

            return(new MbpsUsage(totalMbps, maxMbps));
        }
Exemplo n.º 2
0
        private void SimulationForm_Load(object sender, EventArgs e)
        {
            label14.Text = networkObject.GetConnectionStateString();
            label15.Text = networkObject.GetTrueUploadMbps() + " mbps";
            label16.Text = networkObject.GetTrueDownloadMbps() + " mbps";
            label17.Text = networkObject.GetFinalPingRate() + " ms";
            label18.Text = networkObject.GetFinalPacketLossChance() + "%";
            label19.Text = networkObject.GetUploadMbpsUsage() + " mbps";
            label20.Text = networkObject.GetDownloadMbpsUsage() + " mbps";
            MbpsUsage uploadUsage   = networkObject.GetTotalUploadMbpsUsage();
            MbpsUsage downloadUsage = networkObject.GetTotalDownloadMbpsUsage();

            label21.Text = uploadUsage.currentUsage + " mbps";
            label22.Text = downloadUsage.currentUsage + " mbps";
            label23.Text = uploadUsage.maxUsage + " mbps";
            label24.Text = downloadUsage.maxUsage + " mbps";

            if (uploadUsage.IsOverloaded())
            {
                label25.Text      = "UPLOAD OVERLOADED";
                label25.ForeColor = Color.DarkRed;
            }
            else if (downloadUsage.IsOverloaded())
            {
                label25.Text      = "DOWNLOAD OVERLOADED";
                label25.ForeColor = Color.DarkRed;
            }
            else if (networkObject.GetUploadMbpsUsage() > networkObject.GetTrueUploadMbps())
            {
                label25.Text      = "UPLOAD NIC BOTTLENECK";
                label25.ForeColor = Color.DarkRed;
            }
            else if (networkObject.GetDownloadMbpsUsage() > networkObject.GetTrueDownloadMbps())
            {
                label25.Text      = "DOWNLOAD NIC BOTTLENECK";
                label25.ForeColor = Color.DarkRed;
            }
            else
            {
                label25.Text      = "ALL OPTIMAL";
                label25.ForeColor = Color.Green;
            }
        }