コード例 #1
0
        public override void doThrottling()
        {
            //Unthrottle all nodes b/c could have nodes being throttled
            //in last sample period, but not supposed to be throttle in
            //this period.
            for (int i = 0; i < Config.N; i++)
            {
                setThrottleRate(i, false);
                m_nodeStates[i] = NodeState.Low;
            }

            //Throttle all the high nodes
            int [] high_nodes = cluster_pool.allNodes();
            foreach (int node in high_nodes)
            {
                setThrottleRate(node, true);
                m_nodeStates[node] = NodeState.HighOther;
            }

#if DEBUG_CLUSTER2
            Console.Write("\nLow nodes *NOT* throttled: ");
            for (int i = 0; i < Config.N; i++)
            {
                if (!m_isThrottled[i])
                {
                    Console.Write("{0} ", i);
                }
            }
#endif

            //Unthrottle all the nodes in the cluster
            int [] nodes = cluster_pool.nodesInNextCluster();
#if DEBUG_CLUSTER2
            Console.Write("\nUnthrottling cluster nodes: ");
#endif
            if (nodes.Length > 0)
            {
                foreach (int node in nodes)
                {
                    setThrottleRate(node, false);
                    m_nodeStates[node] = NodeState.HighGolden;
                    Simulator.stats.throttle_time_bysrc[node].Add();
#if DEBUG_CLUSTER2
                    Console.Write("{0} ", node);
#endif
                }
            }

#if DEBUG_CLUSTER2
            Console.Write("\nThrottled nodes: ");
            for (int i = 0; i < Config.N; i++)
            {
                if (m_isThrottled[i])
                {
                    Console.Write("{0} ", i);
                }
            }
            Console.Write("\n*NOT* Throttled nodes: ");
            for (int i = 0; i < Config.N; i++)
            {
                if (!m_isThrottled[i])
                {
                    Console.Write("{0} ", i);
                }
            }
            Console.Write("\n");
#endif
        }
コード例 #2
0
ファイル: Controller_ACT.cs プロジェクト: hirous/test
        public override void doThrottling()
        {
            //All nodes in the low intensity can alway freely inject.
            int [] low_nodes = low_intensity_cluster.allNodes();

            if (low_nodes.Length > 0)
            {
#if DEBUG_CLUSTER2
                Console.WriteLine("\n:: cycle {0} ::", Simulator.CurrentRound);
                Console.Write("\nLow nodes *NOT* throttled: ");
#endif
                foreach (int node in low_nodes)
                {
#if DEBUG_CLUSTER2
                    writeNode(node);
#endif
                    setThrottleRate(node, false);
                    m_nodeStates[node] = NodeState.Low;
                }
            }

            //Throttle all the high other nodes
            int [] high_nodes = cluster_pool.allNodes();
#if DEBUG_CLUSTER2
            Console.Write("\nAll high other nodes: ");
#endif
            foreach (int node in high_nodes)
            {
#if DEBUG_CLUSTER2
                writeNode(node);
#endif
                setThrottleRate(node, true);
                m_nodeStates[node] = NodeState.HighOther;
            }

            //Unthrottle all the nodes in the free-injecting cluster
            int [] nodes = cluster_pool.nodesInNextCluster();
#if DEBUG_CLUSTER2
            Console.Write("\nUnthrottling cluster nodes: ");
#endif
            if (nodes.Length > 0)
            {
                foreach (int node in nodes)
                {
                    setThrottleRate(node, false);
                    m_nodeStates[node] = NodeState.HighGolden;
                    Simulator.stats.throttle_time_bysrc[node].Add();
#if DEBUG_CLUSTER2
                    writeNode(node);
#endif
                }
            }

            /* Throttle nodes in always throttled mode. */
            int [] throttled_nodes = throttled_cluster.allNodes();

            if (throttled_nodes.Length > 0)
            {
#if DEBUG_CLUSTER2
                Console.Write("\nAlways Throttled nodes with rate {0}: ", Config.RR_throttle_rate);
#endif
                foreach (int node in throttled_nodes)
                {
                    setThrottleRate(node, true);
                    //TODO: need another state for throttled throttled_nodes
                    m_nodeStates[node] = NodeState.AlwaysThrottled;
                    Simulator.stats.always_throttle_time_bysrc[node].Add();
#if DEBUG_CLUSTER2
                    writeNode(node);
#endif
                }
            }

#if DEBUG_CLUSTER2
            Console.Write("\n*NOT* Throttled nodes: ");
            for (int i = 0; i < Config.N; i++)
            {
                if (!m_isThrottled[i])
                {
                    writeNode(i);
                }
            }
            Console.Write("\n");
#endif
        }