/* * EnumStat<StallSources>[] newEnumSampledStatArray(int binSize) * { * EnumStat<StallSources>[] ret = new EnumStat<StallSources>[N]; * for (int i = 0; i < N; i++) * { * ret[i] = new EnumStat<StallSources>(); * } * return ret; * } */ SampledStat[,] newSampledStatArray2D() { SampledStat[,] ret = new SampledStat[N, N]; for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { ret[i, j] = new SampledStat(); // no bins for arrays } } return(ret); }
SampledStat[] newSampledStatArray(bool bins) { SampledStat[] ret = new SampledStat[N]; for (int i = 0; i < N; i++) { if (!bins) { ret[i] = new SampledStat(); } else { ret[i] = new SampledStat(NumBins, 0, NumBins); } } return(ret); }
public void Init(int nrNodes) { N = nrNodes; m_subobjects = new List <StatsObject>(); //First, do the non standard constructors //front_stalls_persrc = newEnumSampledStatArray(Enum.GetValues(typeof(StallSources)).Length); //back_stalls_persrc = newEnumSampledStatArray(Enum.GetValues(typeof(StallSources)).Length); //mem_back_stalls_persrc = newEnumSampledStatArray(Enum.GetValues(typeof(StallSources)).Length); //nonmem_back_stalls_persrc = newEnumSampledStatArray(Enum.GetValues(typeof(StallSources)).Length); //bank_access_persrc = new AccumStat[Config.memory.bank_max_per_mem * Config.memory.mem_max, N]; //bank_rowhits_persrc = new AccumStat[Config.memory.bank_max_per_mem * Config.memory.mem_max, N]; //Console.WriteLine(Config.memory.bank_max_per_mem.ToString() + '\t' + Config.memory.mem_max.ToString()); //bank_queuedepth_persrc = new SampledStat[Config.memory.bank_max_per_mem * Config.memory.mem_max, N]; bank_queuedepth = new SampledStat[Config.memory.bank_max_per_mem * Config.memory.mem_max]; for (int i = 0; i < Config.memory.bank_max_per_mem * Config.memory.mem_max; i++) { bank_queuedepth[i] = new SampledStat(); for (int j = 0; j < N; j++) { //bank_access_persrc[i, j] = new AccumStat(); //bank_rowhits_persrc[i, j] = new AccumStat(); //bank_queuedepth_persrc[i, j] = new SampledStat(); } } //Fill each other field with the default constructor foreach (FieldInfo fi in GetType().GetFields()) { if (fi.GetValue(this) != null) { continue; } Type t = fi.FieldType; if (t == typeof(DictSampledStat[])) { fi.SetValue(this, newDictSampledStatArray()); } else if (t == typeof(PeriodicAccumStat[])) { fi.SetValue(this, newPeriodicAccumStatArray()); } else if (t == typeof(AccumStat)) { fi.SetValue(this, newAccumStat()); } else if (t == typeof(AccumStat[])) { fi.SetValue(this, newAccumStatArray()); } else if (t == typeof(AccumStat[, ])) { fi.SetValue(this, newAccumStatArray2D()); } else if (t == typeof(ConstAccumStat[])) { fi.SetValue(this, newConstAccumStatArray()); } else if (t == typeof(SampledStat)) { fi.SetValue(this, newSampledStat()); } else if (t == typeof(SampledStat[])) { fi.SetValue(this, newSampledStatArray()); } else if (t == typeof(SampledStat[, ])) { fi.SetValue(this, newSampledStatArray2D()); } } }
const int NumBins = 2500; // arbitrary SampledStat newSampledStat() { SampledStat ret = new SampledStat(NumBins, 0, NumBins); return(ret); }