public LinkCache(BindingSession session) { int repCount = session.GetValue(SessionParameter.CacheSizeRepositories, CacheSizeRepositories); if (repCount < 1) { repCount = CacheSizeRepositories; } int typeCount = session.GetValue(SessionParameter.CacheSizeTypes, CacheSizeTypes); if (typeCount < 1) { typeCount = CacheSizeTypes; } int objCount = session.GetValue(SessionParameter.CacheSizeLinks, CacheSizeLinks); if (objCount < 1) { objCount = CacheSizeLinks; } linkCache = new Cache("Link Cache"); linkCache.Initialize(new string[] { typeof(DictionaryCacheLevel).FullName + " " + DictionaryCacheLevel.Capacity + "=" + repCount, // repository typeof(LruCacheLevel).FullName + " " + LruCacheLevel.MaxEntries + "=" + objCount, // id typeof(DictionaryCacheLevel).FullName + " " + DictionaryCacheLevel.Capacity + "=16", // rel typeof(ContentTypeCacheLevel).FullName + " " + DictionaryCacheLevel.Capacity + "=3," + DictionaryCacheLevel.SingleValue + "=true" // type }); typeLinkCache = new Cache("Type Link Cache"); typeLinkCache.Initialize(new string[] { typeof(DictionaryCacheLevel).FullName + " " + DictionaryCacheLevel.Capacity + "=" + repCount, // repository typeof(LruCacheLevel).FullName + " " + LruCacheLevel.MaxEntries + "=" + typeCount, // id typeof(DictionaryCacheLevel).FullName + " " + DictionaryCacheLevel.Capacity + "=16", // rel typeof(ContentTypeCacheLevel).FullName + " " + DictionaryCacheLevel.Capacity + "=3," + DictionaryCacheLevel.SingleValue + "=true" // type }); collectionLinkCache = new Cache("Collection Link Cache"); collectionLinkCache.Initialize(new string[] { typeof(DictionaryCacheLevel).FullName + " " + DictionaryCacheLevel.Capacity + "=" + repCount, // repository typeof(DictionaryCacheLevel).FullName + " " + DictionaryCacheLevel.Capacity + "=8" // collection }); templateCache = new Cache("URI Template Cache"); templateCache.Initialize(new string[] { typeof(DictionaryCacheLevel).FullName + " " + DictionaryCacheLevel.Capacity + "=" + repCount, // repository typeof(DictionaryCacheLevel).FullName + " " + DictionaryCacheLevel.Capacity + "=6" // type }); repositoryLinkCache = new Cache("Repository Link Cache"); repositoryLinkCache.Initialize(new string[] { typeof(DictionaryCacheLevel).FullName + " " + DictionaryCacheLevel.Capacity + "=" + repCount, // repository typeof(DictionaryCacheLevel).FullName + " " + DictionaryCacheLevel.Capacity + "=6" // rel }); }
public RepositoryInfoCache(BindingSession session) { int repCount = session.GetValue(SessionParameter.CacheSizeRepositories, CacheSizeRepositories); if (repCount < 1) { repCount = CacheSizeRepositories; } cache = new Cache("Repository Info Cache"); cache.Initialize(new string[] { typeof(DictionaryCacheLevel).FullName + " " + DictionaryCacheLevel.Capacity + "=" + repCount }); }
/// <summary> /// Start replaying by reading the input replay XML file and create the replaySession object /// </summary> public void StartReplay() { RuntimeShutDown = false; ReplayStateConsistent = true; ReplayMode = true; FileStream ReplayReader = new FileStream(ReplayFilename, FileMode.Open); XmlSerializer serializer = new XmlSerializer(typeof(BindingSession)); ReplaySession = serializer.Deserialize(ReplayReader) as BindingSession; ReplayReader.Close(); Console.WriteLine("Binding session loaded successfully with {0} binding instances", ReplaySession.Instances.Count); Console.WriteLine("\n\nBinding session stats:\n\n"); RecordReplayStats stats = new RecordReplayStats(); for (int i = 0; i < ReplaySession.Instances.Count; i++) { stats.StatInstance(ReplaySession.Instances[i]); } Console.WriteLine(stats.ToString()); }
public TypeDefinitionCache(BindingSession session) { int repCount = session.GetValue(SessionParameter.CacheSizeRepositories, CacheSizeRepositories); if (repCount < 1) { repCount = CacheSizeRepositories; } int typeCount = session.GetValue(SessionParameter.CacheSizeTypes, CacheSizeTypes); if (typeCount < 1) { typeCount = CacheSizeTypes; } cache = new Cache("Type Definition Cache"); cache.Initialize(new string[] { typeof(DictionaryCacheLevel).FullName + " " + DictionaryCacheLevel.Capacity + "=" + repCount, // repository typeof(LruCacheLevel).FullName + " " + LruCacheLevel.MaxEntries + "=" + typeCount // type }); }
/// <summary> /// Constructor. /// </summary> public LinkCache(BindingSession session) { int repCount = session.GetValue(SessionParameter.CacheSizeRepositories, SessionParameterDefaults.CacheSizeRepositories); if (repCount < 1) { repCount = SessionParameterDefaults.CacheSizeRepositories; } int typeCount = session.GetValue(SessionParameter.CacheSizeTypes, SessionParameterDefaults.CacheSizeTypes); if (typeCount < 1) { typeCount = SessionParameterDefaults.CacheSizeTypes; } int objCount = session.GetValue(SessionParameter.CacheSizeLinks, SessionParameterDefaults.CacheSizeLinks); if (objCount < 1) { objCount = SessionParameterDefaults.CacheSizeLinks; } string dictionaryLevelName = typeof(DictionaryCacheLevel).FullName; string lruLevelName = typeof(LruCacheLevel).FullName; string contentTypeLevelName = typeof(DictionaryCacheLevel).FullName; linkCache = new Cache("Link Cache"); linkCache.Initialize(new string[] { dictionaryLevelName + " " + DictionaryCacheLevel.Capacity + "=" + repCount.ToString(CultureInfo.InvariantCulture), // repository lruLevelName + " " + LruCacheLevel.MaxEntries + "=" + objCount.ToString(CultureInfo.InvariantCulture), // id dictionaryLevelName + " " + DictionaryCacheLevel.Capacity + "=16", // rel contentTypeLevelName + " " + DictionaryCacheLevel.Capacity + "=3," + DictionaryCacheLevel.SingleValue + "=true" // type }); typeLinkCache = new Cache("Type Link Cache"); typeLinkCache.Initialize(new string[] { dictionaryLevelName + " " + DictionaryCacheLevel.Capacity + "=" + repCount.ToString(CultureInfo.InvariantCulture), // repository lruLevelName + " " + LruCacheLevel.MaxEntries + "=" + typeCount.ToString(CultureInfo.InvariantCulture), // id dictionaryLevelName + " " + DictionaryCacheLevel.Capacity + "=16", // rel contentTypeLevelName + " " + DictionaryCacheLevel.Capacity + "=3," + DictionaryCacheLevel.SingleValue + "=true" // type }); collectionLinkCache = new Cache("Collection Link Cache"); collectionLinkCache.Initialize(new string[] { dictionaryLevelName + " " + DictionaryCacheLevel.Capacity + "=" + repCount.ToString(CultureInfo.InvariantCulture), // repository dictionaryLevelName + " " + DictionaryCacheLevel.Capacity + "=8" // collection }); templateCache = new Cache("URI Template Cache"); templateCache.Initialize(new string[] { dictionaryLevelName + " " + DictionaryCacheLevel.Capacity + "=" + repCount.ToString(CultureInfo.InvariantCulture), // repository dictionaryLevelName + " " + DictionaryCacheLevel.Capacity + "=6" // type }); repositoryLinkCache = new Cache("Repository Link Cache"); repositoryLinkCache.Initialize(new string[] { dictionaryLevelName + " " + DictionaryCacheLevel.Capacity + "=" + repCount.ToString(CultureInfo.InvariantCulture), // repository dictionaryLevelName + " " + DictionaryCacheLevel.Capacity + "=6" // rel }); }
/// <summary> /// Start record by creating recordSession /// </summary> /// public void StartRecord() { RecordMode = true; RecordSession = new BindingSession(); }