void doStats(ulong retired) { if (Simulator.Warming) { Simulator.stats.warming_insns_persrc[m_ID].Add(retired); return; } if (!m_stats_active) { return; } Simulator.stats.mshrs.Add(mshrs_free); Simulator.stats.mshrs_persrc[m_ID].Add(mshrs_free); m_active_ret += retired; if (alone_t == ulong.MaxValue) { alone_t = m_ins.oldestT; } ulong alone_cyc = m_ins.oldestT - alone_t; alone_t = m_ins.oldestT; Simulator.stats.insns_persrc[m_ID].Add(retired); Simulator.stats.insns_persrc_period[m_ID].Add(retired); Simulator.stats.active_cycles[m_ID].Add(); Simulator.stats.active_cycles_alone[m_ID].Add(alone_cyc); Simulator.network._cycle_insns += retired; if (Simulator.CurrentRound % (ulong)100000 == 0)// && Simulator.CurrentRound != 0) { Console.WriteLine("Processor {0}: {1} ({2} outstanding)", m_ID, m_ins.totalInstructionsRetired, m_ins.outstandingReqs); #if DEBUG Console.WriteLine("-- outstanding:"); foreach (MSHR m in m_mshrs) { if (m.block != null) { Console.Write(" {0:X}", m.block.Block); } } Console.WriteLine(); #endif } bool windowFull = m_ins.isFull(); bool nextIsMem = (m_trace.type == Trace.Type.Rd || m_trace.type == Trace.Type.Wr); bool noFreeMSHRs = true; for (int i = 0; i < m_mshrs.Length; i++) { if (!m_mshrs[i].valid) { noFreeMSHRs = false; } } // any stall: either (i) window is full, or (ii) window is not full // but next insn (LD / ST) can't be issued bool stall = windowFull || (nextIsMem && noFreeMSHRs); // MSHR stall: window not full, next insn is memory, but we have no free MSHRs bool stallMem = !windowFull && (nextIsMem && noFreeMSHRs); /* * // promise stall: MSHR stall, and there is a pending eviction (waiting for promise) holding * // an mshr * bool stallPromise = stallMem && pendingEvict; */ if (stall) { Simulator.stats.cpu_stall[m_ID].Add(); } if (stallMem) { Simulator.stats.cpu_stall_mem[m_ID].Add(); } /* * if (stallPromise) * Simulator.stats.promise_wait[m_ID].Add(); */ }