コード例 #1
0
        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
            });
        }
コード例 #2
0
ファイル: binding-caches.cs プロジェクト: sofiaker/Oris4Sync
        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
            });
        }
コード例 #3
0
        /// <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());
        }
コード例 #4
0
ファイル: binding-caches.cs プロジェクト: sofiaker/Oris4Sync
        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
            });
        }
コード例 #5
0
        /// <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
            });
        }
コード例 #6
0
 /// <summary>
 /// Start record by creating recordSession
 /// </summary>
 ///
 public void StartRecord()
 {
     RecordMode    = true;
     RecordSession = new BindingSession();
 }
コード例 #7
0
ファイル: RecordReplayManager.cs プロジェクト: reshadi2/mcjs
        /// <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());

        }
コード例 #8
0
ファイル: RecordReplayManager.cs プロジェクト: reshadi2/mcjs
 /// <summary>
 /// Start record by creating recordSession
 /// </summary>
 /// 
 public void StartRecord()
 {
     RecordMode = true;
     RecordSession = new BindingSession();
 }