Exemplo n.º 1
0
 public RecordStresser(PagedFile pagedFile, Condition condition, int maxRecords, RecordFormat format, int threadId, TinyLockManager locks)
 {
     this._pagedFile  = pagedFile;
     this._condition  = condition;
     this._maxRecords = maxRecords;
     this._format     = format;
     this._threadId   = threadId;
     this._locks      = locks;
 }
Exemplo n.º 2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void verifyResults(RecordFormat format, org.neo4j.io.pagecache.PagedFile pagedFile, java.util.List<RecordStresser> recordStressers) throws java.io.IOException
        private void VerifyResults(RecordFormat format, PagedFile pagedFile, IList <RecordStresser> recordStressers)
        {
            foreach (RecordStresser stresser in recordStressers)
            {
                stresser.VerifyCounts();
            }
            using (PageCursor cursor = pagedFile.Io(0, Org.Neo4j.Io.pagecache.PagedFile_Fields.PF_SHARED_READ_LOCK))
            {
                while (cursor.Next())
                {
                    format.VerifyCheckSums(cursor);
                }
            }
        }
Exemplo n.º 3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void stress(org.neo4j.io.pagecache.PageCache pageCache, Condition condition) throws Exception
        public virtual void Stress(PageCache pageCache, Condition condition)
        {
            File file = Files.createTempFile(_workingDirectory.toPath(), "pagecacheundertest", ".bin").toFile();

            file.deleteOnExit();

            int          cachePageSize = pageCache.PageSize();
            RecordFormat format        = new RecordFormat(_numberOfThreads, cachePageSize);
            int          filePageSize  = format.FilePageSize;

            using (PagedFile pagedFile = pageCache.Map(file, filePageSize))
            {
                IList <RecordStresser> recordStressers = Prepare(condition, pagedFile, format);
                VerifyResults(format, pagedFile, recordStressers);
                Execute(recordStressers);
                VerifyResults(format, pagedFile, recordStressers);
            }
        }
Exemplo n.º 4
0
        private IList <RecordStresser> Prepare(Condition condition, PagedFile pagedFile, RecordFormat format)
        {
            int             maxRecords = Math.multiplyExact(_maxPages, format.RecordsPerPage);
            TinyLockManager locks      = new TinyLockManager();

            IList <RecordStresser> recordStressers = new LinkedList <RecordStresser>();

            for (int threadId = 0; threadId < _numberOfThreads; threadId++)
            {
                recordStressers.Add(new RecordStresser(pagedFile, condition, maxRecords, format, threadId, locks));
            }
            return(recordStressers);
        }