/// <summary> /// Initialize the keys for different key types. /// </summary> public int InitKeys(UInt32 typeId, int numKeys, int maxSize) { Util.Log("InitKeys typeId " + typeId + " numKeys= " + numKeys + "maxSize=" + maxSize); Assert.Greater(numKeys, 0, "Number of keys should be greater than zero."); Type type = CacheableWrapperFactory.GetTypeForId(typeId); CacheableKeyWrapper instance = CacheableWrapperFactory.CreateKeyInstance(typeId); Assert.IsNotNull(instance, "InitKeys: Type '{0}' could not be instantiated.", type.Name); int maxKeys = instance.MaxKeys; if (numKeys > maxKeys) { numKeys = maxKeys; } m_cKeys = new CacheableKeyWrapper[numKeys]; m_cKeyCksums = new uint[numKeys]; for (int keyIndex = 0; keyIndex < numKeys; keyIndex++) { instance = CacheableWrapperFactory.CreateKeyInstance(typeId); instance.InitKey(keyIndex, maxSize); m_cKeyCksums[keyIndex] = instance.GetChecksum(); m_cKeys[keyIndex] = instance; } Util.Log("InitKeys final m_cKeyCksums " + m_cKeyCksums.Length + " m_cKeys:" + m_cKeys.Length + "numKeys: " + numKeys); return(numKeys); }
public void TestAllKeys(ClientBase client1, ClientBase client2, string regionName, long dtTime) { ICollection <UInt32> registeredKeyTypeIds = CacheableWrapperFactory.GetRegisteredKeyTypeIds(); ICollection <UInt32> registeredValueTypeIds = CacheableWrapperFactory.GetRegisteredValueTypeIds(); client1.Call(CacheableHelper.RegisterBuiltinsJavaHashCode, dtTime); client2.Call(CacheableHelper.RegisterBuiltinsJavaHashCode, dtTime); foreach (UInt32 keyTypeId in registeredKeyTypeIds) { int numKeys; client1.Call(InitKeys, out numKeys, keyTypeId, NumKeys, KeySize); client2.Call(InitKeys, out numKeys, keyTypeId, NumKeys, KeySize); Type keyType = CacheableWrapperFactory.GetTypeForId(keyTypeId); StartTimer(); Util.Log("Running warmup task which verifies the puts."); DoHashCodePuts(client1, client2, regionName); } }
public void TestAllKeyValuePairs(ClientBase client1, ClientBase client2, string regionName, bool runQuery, long dtTicks) { ICollection <UInt32> registeredKeyTypeIds = CacheableWrapperFactory.GetRegisteredKeyTypeIds(); ICollection <UInt32> registeredValueTypeIds = CacheableWrapperFactory.GetRegisteredValueTypeIds(); client1.Call(CacheableHelper.RegisterBuiltins, dtTicks); client2.Call(CacheableHelper.RegisterBuiltins, dtTicks); foreach (UInt32 keyTypeId in registeredKeyTypeIds) { int numKeys; client1.Call(InitKeys, out numKeys, keyTypeId, NumKeys, KeySize); client2.Call(InitKeys, out numKeys, keyTypeId, NumKeys, KeySize); Type keyType = CacheableWrapperFactory.GetTypeForId(keyTypeId); foreach (UInt32 valueTypeId in registeredValueTypeIds) { client1.Call(InitValues, valueTypeId, numKeys, ValueSize); client2.Call(InitValues, valueTypeId, numKeys, ValueSize); Type valueType = CacheableWrapperFactory.GetTypeForId(valueTypeId); Util.Log("Starting gets/puts with keyType '{0}' and valueType '{1}'", keyType.Name, valueType.Name); StartTimer(); Util.Log("Running warmup task which verifies the puts."); PutGetSteps(client1, client2, regionName, true, runQuery); Util.Log("End warmup task."); LogTaskTiming(client1, string.Format("IRegion<object, object>:{0},Key:{1},Value:{2},KeySize:{3},ValueSize:{4},NumOps:{5}", regionName, keyType.Name, valueType.Name, KeySize, ValueSize, 4 * numKeys), 4 * numKeys); InvalidateRegion(regionName, client1, client2); } } }
/// <summary> /// Initialize the values to random values for different value types. /// </summary> public void InitValues(UInt32 typeId, int numValues, int maxSize) { Util.Log("InitValues typeId " + typeId + " numKeys= " + numValues + "maxSize=" + maxSize); Assert.Greater(numValues, 0, "Number of values should be greater than zero."); Type type = CacheableWrapperFactory.GetTypeForId(typeId); m_cValues = new CacheableWrapper[numValues]; m_cValCksums = new uint[numValues]; CacheableWrapper instance; for (int valIndex = 0; valIndex < numValues; valIndex++) { instance = CacheableWrapperFactory.CreateInstance(typeId); Util.Log(" in initvalue type " + instance.GetType().ToString()); Assert.IsNotNull(instance, "InitValues: Type '{0}' could not be instantiated.", type.Name); instance.InitRandomValue(maxSize); m_cValCksums[valIndex] = instance.GetChecksum(); m_cValues[valIndex] = instance; } Util.Log("InitValues final m_cValCksums " + m_cValCksums.Length + " m_cValues:" + m_cValues.Length); }