Beispiel #1
0
        private static void TestStorage(IKeyValueStorage<Guid, object> storage, int maxElements)
        {
            Console.WriteLine("Testing " + storage.GetType().Name);
            Console.WriteLine("Items,Avg insert (ms),Inserts per second,Avg read (ms),Reads per second,Avg update (ms),Updates per second, Memory(MB)");
            Stopwatch sw = new Stopwatch();
            sw.Start();

            for (int iter = 0; iter < maxElements / reportingFrequency; iter++)
            {
                Collection<Guid> ids = new Collection<Guid>();
                for (int inner = 0; inner < reportingFrequency; inner++)
                {
                    Guid id = Guid.NewGuid();
                    ids.Add(id);
                }

                var avgInsertMs = TestInsert(storage, sw, ids);
                var avgReadMs = TestRead(storage, sw, ids);
                var avgUpdateMs = TestUpdate(storage, sw, ids);

                long memoryStatus = GC.GetTotalMemory(false) - startMemory;

                Console.WriteLine(((iter + 1) * reportingFrequency).ToString()
                    + "," + avgInsertMs.ToString() + "," + 1000 / avgInsertMs
                    + "," + avgReadMs.ToString() + "," + 1000 / avgReadMs
                    + "," + avgUpdateMs.ToString() + "," + 1000 / avgUpdateMs
                    + "," + memoryStatus / 1024 / 1024
                    );
            }
        }
Beispiel #2
0
        private static void TestStorage(IKeyValueStorage <Guid, object> storage, int maxElements)
        {
            Console.WriteLine("Testing " + storage.GetType().Name);
            Console.WriteLine("Items,Avg insert (ms),Inserts per second,Avg read (ms),Reads per second,Avg update (ms),Updates per second, Memory(MB)");
            Stopwatch sw = new Stopwatch();

            sw.Start();

            for (int iter = 0; iter < maxElements / reportingFrequency; iter++)
            {
                Collection <Guid> ids = new Collection <Guid>();
                for (int inner = 0; inner < reportingFrequency; inner++)
                {
                    Guid id = Guid.NewGuid();
                    ids.Add(id);
                }

                var avgInsertMs = TestInsert(storage, sw, ids);
                var avgReadMs   = TestRead(storage, sw, ids);
                var avgUpdateMs = TestUpdate(storage, sw, ids);

                long memoryStatus = GC.GetTotalMemory(false) - startMemory;

                Console.WriteLine(((iter + 1) * reportingFrequency).ToString()
                                  + "," + avgInsertMs.ToString() + "," + 1000 / avgInsertMs
                                  + "," + avgReadMs.ToString() + "," + 1000 / avgReadMs
                                  + "," + avgUpdateMs.ToString() + "," + 1000 / avgUpdateMs
                                  + "," + memoryStatus / 1024 / 1024
                                  );
            }
        }