Exemple #1
0
        void doStats()
        {
            int used_links = 0;

            int[] usedLinksCount      = new int[Config.N];
            int[] usedLinksCountbyReq = new int[Config.N];

            foreach (Link l in links)
            {
                if (l.Out != null)
                {
                    used_links++;
                    usedLinksCount[l.Out.packet.src.ID]++;
                    usedLinksCountbyReq[l.Out.packet.requesterID]++;
                    Simulator.stats.link_traversal_bysrc[l.Out.packet.src.ID].Add();
                    l.doStat();
                }
            }

            for (int i = 0; i < Config.N; i++)
            {
                Simulator.stats.netutil_bysrc[i].Add((double)usedLinksCount[i] / links.Count);
                Simulator.stats.netutil_byreqID[i].Add((double)usedLinksCountbyReq[i] / links.Count);
            }

            this._cycle_netutil = (double)used_links / links.Count;

            Simulator.stats.netutil.Add(this._cycle_netutil);
            Simulator.stats.mshrThrottle_netutil.Add(this._cycle_netutil);
            Simulator.stats.mshrThrottle_smallEpoch_netutil.Add(this._cycle_netutil);

            this._cycle_insns     = 0; // CPUs increment this each cycle -- we want a per-cycle sum
            this._cycle_L1_misses = 0; // CPUs increment this each cycle -- we want a per-cycle sum

            if (Config.router.algorithm == RouterAlgorithm.DR_AFC)
            {
                int cap   = 0;
                int count = 0;
                foreach (Router r in routers)
                {
                    Router_AFC rAFC = (Router_AFC)r;
                    // Don't count in buffers when in bless mode
                    if (rAFC.isBuffered)
                    {
                        cap   += rAFC.totalBufCap();
                        count += rAFC.totalBufCount();
                    }
                }

                if (cap != 0)
                {
                    this._afc_buffer_util = (double)count / cap;
                }
                else
                {
                    this._afc_buffer_util = 0;
                }

                this._afc_total_netutil = (double)(used_links + count) / (cap + links.Count);
                Simulator.stats.afc_buf_util.Add(this._afc_buffer_util);
                Simulator.stats.afc_total_util.Add(this._afc_total_netutil);
                Simulator.stats.mshrThrottle_afc_total_util.Add(this._afc_total_netutil);
#if debug
                if (this._afc_buffer_util != 0)
                {
                    Console.WriteLine("buffer util {0}", this._afc_buffer_util);
                    Console.WriteLine("total util {0}", this._afc_total_netutil);
                }
#endif

                // Record packet eject count over the last period
                _ejectPacketCount     = 0;
                _fullBufferPercentage = 0.0;
                int fullCount = 0;
                foreach (Router r in routers)
                {
                    Router_AFC rAFC = (Router_AFC)r;
                    fullCount         += rAFC.fullBuffer();
                    _ejectPacketCount += r.ejectPacketCount;
                    // reset since we only want to know the count during the last period
                    r.ejectPacketCount = 0;
                }
                int totalBufCount = (int)Config.N * Router.TOTAL_PORTS * Config.afc_vnets;
                _fullBufferPercentage = (double)fullCount / totalBufCount;
                //Console.WriteLine("percentage {0}", _fullBufferPercentage);
            }
        }