コード例 #1
0
        /// <summary>
        /// Run multithreaded operations.
        /// </summary>
        /// <param name="worker">The worker to use.</param>
        private static void StressThreadTrx(PerfTestWorker worker)
        {
            const int NumRecords   = 50000;
            const int NumRetrieves = 100;

            worker.InsertRecordsWithSetColumn(NumRecords);
            worker.RepeatedlyRetrieveOneRecord(NumRetrieves);
            worker.RepeatedlyRetrieveOneRecordWithJetRetrieveColumns(NumRetrieves);
            worker.RepeatedlyRetrieveOneRecordWithRetrieveColumns(NumRetrieves);
            worker.RepeatedlyRetrieveOneRecordWithEnumColumns(NumRetrieves);
            worker.RetrieveAllRecords();

            worker.InsertRecordsWithSetColumns(NumRecords);
            worker.RepeatedlyRetrieveOneRecord(NumRetrieves);
            worker.RepeatedlyRetrieveOneRecordWithJetRetrieveColumns(NumRetrieves);
            worker.RepeatedlyRetrieveOneRecordWithRetrieveColumns(NumRetrieves);
            worker.RepeatedlyRetrieveOneRecordWithEnumColumns(NumRetrieves);
            worker.RetrieveAllRecords();
        }
コード例 #2
0
        /// <summary>
        /// Insert some records and then retrieve them.
        /// </summary>
        private void InsertReadSeek()
        {
            const int NumRecords = 1000000;

            long[] keys = this.GetRandomKeys(NumRecords);

            using (var worker = new PerfTestWorker(this.instance, this.database))
            {
                TimeAction("Insert records", () => worker.InsertRecordsWithSetColumn(NumRecords / 2));
                TimeAction("Insert records with SetColumns", () => worker.InsertRecordsWithSetColumns(NumRecords / 2));
                TimeAction("Read one record", () => worker.RepeatedlyRetrieveOneRecord(NumRecords));
                TimeAction("Read one record with JetRetrieveColumns", () => worker.RepeatedlyRetrieveOneRecordWithJetRetrieveColumns(NumRecords));
                TimeAction("Read one record with RetrieveColumns", () => worker.RepeatedlyRetrieveOneRecordWithRetrieveColumns(NumRecords));
                TimeAction("Read one record with JetEnumerateColumns", () => worker.RepeatedlyRetrieveOneRecordWithEnumColumns(NumRecords));
                TimeAction("Read all records", worker.RetrieveAllRecords);
                TimeAction("Seek to all records", () => worker.SeekToAllRecords(keys));
            }
        }