public void dumpToBB() { Int32 localcnt = m_cnt; Int32 size = m_maps.Count; Int32 count = 0; Int32 i = 0; while (i < size) { count += m_maps[i].Count; foreach (KeyValuePair <TKey, TVal> item in m_maps[i]) { TKey key = (TKey)(object)item.Key; DeltaTestImpl value = item.Value as DeltaTestImpl; Util.BBSet("ToDeltaBB", key.ToString(), value.GetToDeltaCounter()); } i++; } Util.BBSet("MapCount", "size", count); Int32 createCnt = (Int32)Util.BBGet("DeltaBB", "CREATECOUNT"); Util.BBSet("DeltaBB", "CREATECOUNT", createCnt + m_create); Util.BBSet("DeltaBB", "UPDATECOUNT", m_update); Util.BBSet("DeltaBB", "DESTROYCOUNT", m_destroy); }
public override void DoTask(int iters, object data) { FwkTest <TKey, TVal> .CurrentTest.FwkInfo("PutTask::DoTask:"); Int32 localcnt = m_cnt; Interlocked.Increment(ref m_cnt); int offset = Util.Rand(m_MaxKeys); int count = offset; while (Running && (iters-- != 0)) { int idx = count % m_MaxKeys; TKey key = default(TKey); try { key = (TKey)(object)("AAAAAA" + localcnt + idx.ToString("D10")); DeltaTestImpl oldVal = (m_maps[localcnt])[key] as DeltaTestImpl; if (oldVal == null) { Util.Log(Util.LogLevel.Error, "oldDelta Cannot be null"); } DeltaTestImpl obj = new DeltaTestImpl(oldVal); obj.SetIntVar(oldVal.GetIntVar() + 1); m_region[key] = (TVal)(object)obj; Interlocked.Increment(ref m_update); Util.BBSet("ToDeltaBB", key.ToString(), oldVal.GetToDeltaCounter()); bool removeKey = (m_maps[localcnt]).Remove(key); if (removeKey) { (m_maps[localcnt]).Add(key, (TVal)(object)obj); } } catch (Exception ex) { Util.Log(Util.LogLevel.Error, "Exception while putting key[{0}] for region {1} in iteration " + "{2}: {3}", key, m_region.Name, (count - offset), ex); throw; } count++; //if ((count % 1000) == 0) //{ // Util.Log("PutsTask::DoTask: Intermediate: Ran for 1000 iterations."); //} } //Util.Log("PutsTask::DoTask: Ran for {0} iterations.", count); Interlocked.Add(ref m_iters, count - offset); }