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; }
//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); } } }
//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); } }
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); }