• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# PerfTracker类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中PerfTracker的典型用法代码示例。如果您正苦于以下问题:C# PerfTracker类的具体用法?C# PerfTracker怎么用?C# PerfTracker使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PerfTracker类属于命名空间,在下文中一共展示了PerfTracker类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ReadSequential

        public override PerformanceRecord ReadSequential(PerfTracker perfTracker)
        {
            IEnumerable<uint> sequentialIds = Enumerable.Range(0, Constants.ReadItems).Select(x => (uint)x); ;

            return Read(string.Format("[FoundationDB] sequential read ({0} items)", Constants.ReadItems), sequentialIds,
                perfTracker);
        }
开发者ID:j2jensen,项目名称:ravendb,代码行数:7,代码来源:FdbTest.cs


示例2: WriteParallelRandom

 public override List<PerformanceRecord> WriteParallelRandom(IEnumerable<TestData> data, PerfTracker perfTracker,
     int numberOfThreads, out long elapsedMilliseconds)
 {
     return
         WriteParallel(
             string.Format("[FoundationDB] parallel random write ({0} items)", Constants.ItemsPerTransaction),
             data,
             Constants.ItemsPerTransaction, Constants.WriteTransactions, perfTracker, numberOfThreads,
             out elapsedMilliseconds);
 }
开发者ID:j2jensen,项目名称:ravendb,代码行数:10,代码来源:FdbTest.cs


示例3: Read

        private PerformanceRecord Read(string operation, IEnumerable<uint> ids, PerfTracker perfTracker)
        {
			LightningDatabase db;
            using (var env = NewEnvironment(out db, delete: false))
            {
                var sw = Stopwatch.StartNew();

                ReadInternal(ids, perfTracker, env, db);

                sw.Stop();

                return new PerformanceRecord
                {
                    Operation = operation,
                    Time = DateTime.Now,
                    Duration = sw.ElapsedMilliseconds,
                    ProcessedItems = ids.Count()
                };
            }
        }
开发者ID:WimVergouwe,项目名称:ravendb,代码行数:20,代码来源:LmdbTest.cs


示例4: ReadParallelRandom

 public override PerformanceRecord ReadParallelRandom(IEnumerable<uint> randomIds, PerfTracker perfTracker, int numberOfThreads)
 {
     return ReadParallel(string.Format("[Voron] parallel random read ({0} items)", Constants.ReadItems), randomIds, perfTracker, numberOfThreads);
 }
开发者ID:ReginaBricker,项目名称:ravendb,代码行数:4,代码来源:VoronTest.cs


示例5: ReadParallelSequential

        public override PerformanceRecord ReadParallelSequential(PerfTracker perfTracker, int numberOfThreads)
        {
			var sequentialIds = Enumerable.Range(0, Constants.ReadItems).Select(x => (uint)x);

            return ReadParallel(string.Format("[Voron] parallel sequential read ({0} items)", Constants.ReadItems), sequentialIds, perfTracker, numberOfThreads);
        }
开发者ID:ReginaBricker,项目名称:ravendb,代码行数:6,代码来源:VoronTest.cs


示例6: ReadInternal

        private static long ReadInternal(IEnumerable<uint> ids, PerfTracker perfTracker, StorageEnvironment env)
        {
            var ms = new byte[4096];

            using (var tx = env.NewTransaction(TransactionFlags.Read))
            {
                var sw = Stopwatch.StartNew();
                long v = 0;
                foreach (var id in ids)
                {
                    var key = id.ToString("0000000000000000");
                    var readResult = tx.State.Root.Read(tx, key);
                    int reads = 0;
                    while ((reads = readResult.Reader.Read(ms, 0, ms.Length)) > 0)
                    {
                        v += reads;
                    }
	             
                }
                perfTracker.Record(sw.ElapsedMilliseconds);
                return v;
            }
        }
开发者ID:ReginaBricker,项目名称:ravendb,代码行数:23,代码来源:VoronTest.cs


示例7: Read

        private PerformanceRecord Read(string operation, IEnumerable<uint> ids, PerfTracker perfTracker)
        {
            var options = StorageEnvironmentOptions.ForPath(dataPath);
            options.ManualFlushing = true;

            using (var env = new StorageEnvironment(options))
            {
                env.FlushLogToDataFile();

                var sw = Stopwatch.StartNew();

                var v = ReadInternal(ids, perfTracker, env);

                sw.Stop();

                return new PerformanceRecord
                {
                    Bytes = v,
                    Operation = operation,
                    Time = DateTime.Now,
                    Duration = sw.ElapsedMilliseconds,
                    ProcessedItems = ids.Count()
                };
            }
        }
开发者ID:ReginaBricker,项目名称:ravendb,代码行数:25,代码来源:VoronTest.cs


示例8: WriteInternalBatch

        private List<PerformanceRecord> WriteInternalBatch(
            string operation,
            IEnumerator<TestData> enumerator,
            long itemsPerBatch,
            long numberOfBatches,
            PerfTracker perfTracker,
            StorageEnvironment env)
        {
            var sw = new Stopwatch();
            byte[] valueToWrite = null;
            var records = new List<PerformanceRecord>();
            for (var b = 0; b < numberOfBatches; b++)
            {
                sw.Restart();
                long v = 0;
                using (var batch = new WriteBatch())
                {
                    for (var i = 0; i < itemsPerBatch; i++)
                    {
                        enumerator.MoveNext();

                        valueToWrite = GetValueToWrite(valueToWrite, enumerator.Current.ValueSize);
                        v += valueToWrite.Length;
                        batch.Add(enumerator.Current.Id.ToString("0000000000000000"), new MemoryStream(valueToWrite), "Root");
                    }

                    env.Writer.Write(batch);
                }

                sw.Stop();
                perfTracker.Record(sw.ElapsedMilliseconds);

                records.Add(new PerformanceRecord
                {
                    Bytes = v,
                    Operation = operation,
                    Time = DateTime.Now,
                    Duration = sw.ElapsedMilliseconds,
                    ProcessedItems = itemsPerBatch
                });
            }

            return records;
        }
开发者ID:ReginaBricker,项目名称:ravendb,代码行数:44,代码来源:VoronTest.cs


示例9: WriteInternalAsync

        private async Task<List<PerformanceRecord>> WriteInternalAsync(string operation,
            IEnumerator<TestData> enumerator,
            long itemsPerTransaction, long numberOfTransactions, PerfTracker perfTracker, FdbDatabase db)
        {
            var sw = new Stopwatch();
            byte[] valueToWrite = null;
            var records = new List<PerformanceRecord>();

            var location = db.GlobalSpace;

            sw.Restart();
            for (int transactions = 0; transactions < numberOfTransactions; transactions++)
            {
                sw.Restart();
                using (IFdbTransaction tx = db.BeginTransaction())
                {
                    for (int i = 0; i < itemsPerTransaction; i++)
                    {
                        enumerator.MoveNext();

                        valueToWrite = GetValueToWrite(valueToWrite, enumerator.Current.ValueSize);

                        tx.Set(location.Pack(enumerator.Current.Id), Slice.Create(valueToWrite));
                    }

                    await tx.CommitAsync();
                    perfTracker.Record(sw.ElapsedMilliseconds);
                }

                sw.Stop();

                records.Add(new PerformanceRecord
                {
                    Operation = operation,
                    Time = DateTime.Now,
                    Duration = sw.ElapsedMilliseconds,
                    ProcessedItems = itemsPerTransaction
                });
            }

            sw.Stop();

            return records;
        }
开发者ID:j2jensen,项目名称:ravendb,代码行数:44,代码来源:FdbTest.cs


示例10: WriteParallelAsync

        private async Task<Tuple<List<PerformanceRecord>, long>> WriteParallelAsync(string operation,
            IEnumerable<TestData> data,
            int itemsPerTransaction, int numberOfTransactions, PerfTracker perfTracker, int numberOfThreads)
        {
            await NewDatabaseAsync();

            using (FdbDatabase db = await OpenDatabaseAsync())
            {
                long elapsedMilliseconds;
                List<PerformanceRecord> records = ExecuteWriteWithParallel(
                    data,
                    numberOfTransactions,
                    itemsPerTransaction,
                    numberOfThreads,
                    (enumerator, itmsPerTransaction, nmbrOfTransactions) =>
                        WriteInternal(operation, enumerator, itmsPerTransaction, nmbrOfTransactions, perfTracker, db),
                    out elapsedMilliseconds);
                return new Tuple<List<PerformanceRecord>, long>(records, elapsedMilliseconds);
            }
        }
开发者ID:j2jensen,项目名称:ravendb,代码行数:20,代码来源:FdbTest.cs


示例11: WriteParallel

 private List<PerformanceRecord> WriteParallel(string operation, IEnumerable<TestData> data,
     int itemsPerTransaction, int numberOfTransactions, PerfTracker perfTracker, int numberOfThreads,
     out long elapsedMilliseconds)
 {
     Tuple<List<PerformanceRecord>, long> result
         =
         WriteParallelAsync(operation, data, itemsPerTransaction, numberOfTransactions, perfTracker,
             numberOfThreads).Result;
     elapsedMilliseconds = result.Item2;
     return result.Item1;
 }
开发者ID:j2jensen,项目名称:ravendb,代码行数:11,代码来源:FdbTest.cs


示例12: WriteAsync

        private async Task<List<PerformanceRecord>> WriteAsync(string operation, IEnumerable<TestData> data,
            int itemsPerTransaction,
            int numberOfTransactions, PerfTracker perfTracker)
        {
            await NewDatabaseAsync();

            using (FdbDatabase db = await OpenDatabaseAsync())
            {
                IEnumerator<TestData> enumerator = data.GetEnumerator();

                return WriteInternal(operation, enumerator, itemsPerTransaction, numberOfTransactions, perfTracker, db);
            }
        }
开发者ID:j2jensen,项目名称:ravendb,代码行数:13,代码来源:FdbTest.cs


示例13: Write

 private List<PerformanceRecord> Write(string operation, IEnumerable<TestData> data, int itemsPerTransaction,
     int numberOfTransactions, PerfTracker perfTracker)
 {
     return WriteAsync(operation, data, itemsPerTransaction, numberOfTransactions, perfTracker).Result;
 }
开发者ID:j2jensen,项目名称:ravendb,代码行数:5,代码来源:FdbTest.cs


示例14: ReadInternal

        private static long ReadInternal(IEnumerable<uint> ids, PerfTracker perfTracker, LightningEnvironment env,
			LightningDatabase db)
        {
            using (var tx = env.BeginTransaction(LightningDB.TransactionBeginFlags.ReadOnly))
			using (var cursor = new LightningCursor(db, tx))
            {
                long v = 0;
                foreach (var id in ids)
                {
                    var value = cursor.MoveTo(Encoding.UTF8.GetBytes(id.ToString("0000000000000000")));
                    v += value.Value.Length;
                    //Debug.Assert(value != null);
                }
                return v;
            }
        }
开发者ID:WimVergouwe,项目名称:ravendb,代码行数:16,代码来源:LmdbTest.cs


示例15: ReadParallel

        private PerformanceRecord ReadParallel(string operation, IEnumerable<uint> ids, PerfTracker perfTracker, int numberOfThreads)
        {
			LightningDatabase db;
            using (var env = NewEnvironment(out db, delete: false))
            {
                return ExecuteReadWithParallel(operation, ids, numberOfThreads, () => ReadInternal(ids, perfTracker, env, db));
            }
        }
开发者ID:WimVergouwe,项目名称:ravendb,代码行数:8,代码来源:LmdbTest.cs


示例16: WriteSequential

 public override List<PerformanceRecord> WriteSequential(IEnumerable<TestData> data, PerfTracker perfTracker)
 {
     return Write(string.Format("[FoundationDB] sequential write ({0} items)", Constants.ItemsPerTransaction),
         data,
         Constants.ItemsPerTransaction, Constants.WriteTransactions, perfTracker);
 }
开发者ID:j2jensen,项目名称:ravendb,代码行数:6,代码来源:FdbTest.cs


示例17: WriteInternal

 private List<PerformanceRecord> WriteInternal(string operation, IEnumerator<TestData> enumerator,
     long itemsPerTransaction, long numberOfTransactions, PerfTracker perfTracker, FdbDatabase db)
 {
     return
         WriteInternalAsync(operation, enumerator, itemsPerTransaction, numberOfTransactions, perfTracker, db)
             .Result;
 }
开发者ID:j2jensen,项目名称:ravendb,代码行数:7,代码来源:FdbTest.cs


示例18: Read

 private PerformanceRecord Read(string operation, IEnumerable<uint> ids, PerfTracker perfTracker)
 {
     return ReadAsync(operation, ids, perfTracker).Result;
 }
开发者ID:j2jensen,项目名称:ravendb,代码行数:4,代码来源:FdbTest.cs


示例19: WriteParallel

        private List<PerformanceRecord> WriteParallel(string operation, IEnumerable<TestData> data, int itemsPerTransaction, int numberOfTransactions, PerfTracker perfTracker, int numberOfThreads, out long elapsedMilliseconds)
        {
            NewStorage();

            using (var env = new StorageEnvironment(StorageEnvironmentOptions.ForPath(dataPath)))
            {
                return ExecuteWriteWithParallel(
                data,
                numberOfTransactions,
                itemsPerTransaction,
                numberOfThreads,
                (enumerator, itmsPerTransaction, nmbrOfTransactions) => WriteInternalBatch(operation, enumerator, itmsPerTransaction, nmbrOfTransactions, perfTracker, env),
                out elapsedMilliseconds);
            }
        }
开发者ID:ReginaBricker,项目名称:ravendb,代码行数:15,代码来源:VoronTest.cs


示例20: ReadAsync

        private async Task<PerformanceRecord> ReadAsync(string operation, IEnumerable<uint> ids, PerfTracker perfTracker)
        {
            Stopwatch sw = Stopwatch.StartNew();

            using (FdbDatabase db = await OpenDatabaseAsync())
            {
                await ReadInternalAsync(ids, perfTracker, db);
            }

            sw.Stop();

            return new PerformanceRecord
            {
                Operation = operation,
                Time = DateTime.Now,
                Duration = sw.ElapsedMilliseconds,
                ProcessedItems = ids.Count()
            };
        }
开发者ID:j2jensen,项目名称:ravendb,代码行数:19,代码来源:FdbTest.cs



注:本文中的PerfTracker类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# PerfUtils类代码示例发布时间:2022-05-24
下一篇:
C# Peptide类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap