public void Run(string name, int nBlockSizeBytes, Action <int, byte[]> fn)
        {
            Stopwatch sw;
            long      ms1, ms2, interval;
            int       nBytesHandled  = 0;
            int       nMaxIterations = 5;

            byte[] pBuffer = new byte[nBlockSizeBytes];

            // Create Redis Wrapper
            var redis = new RedisNativeClient();

            // Clear DB
            redis.FlushAll();

            sw  = Stopwatch.StartNew();
            ms1 = sw.ElapsedMilliseconds;
            for (int i = 0; i < nMaxIterations; i++)
            {
                fn(i, pBuffer);
                nBytesHandled += nBlockSizeBytes;
            }

            ms2      = sw.ElapsedMilliseconds;
            interval = ms2 - ms1;

            // Calculate rate
            double dMBPerSEc = nBytesHandled / 1024.0 / 1024.0 / (interval / 1000.0);

            Console.WriteLine(name + ": Rate {0:N4}, Total: {1}ms", dMBPerSEc, ms2);
        }
        public void Run(string name, int nBlockSizeBytes, Action <int, byte[]> fn)
        {
            var nBytesHandled  = 0;
            var nMaxIterations = 5;
            var pBuffer        = new byte[nBlockSizeBytes];

            // Create Redis Wrapper
            var redis = new RedisNativeClient(Config.MasterHost);

            // Clear DB
            redis.FlushAll();

            var sw  = Stopwatch.StartNew();
            var ms1 = sw.ElapsedMilliseconds;

            for (var i = 0; i < nMaxIterations; i++)
            {
                fn(i, pBuffer);
                nBytesHandled += nBlockSizeBytes;
            }

            var ms2      = sw.ElapsedMilliseconds;
            var interval = ms2 - ms1;

            // Calculate rate mb/s
            var rate = nBytesHandled / 1024.0 / 1024.0 / (interval / 1000.0);

            Console.WriteLine(name + ": Rate {0:N4}, Total: {1}ms", rate, ms2);
        }
Exemplo n.º 3
0
 public void FlushAll()
 {
     foreach (var item in this.clients)
     {
         RedisNativeClient client = item.Value;
         client.FlushAll();
     }
 }