Beispiel #1
0
 public static void RMWCompletionCallback(Key *key, Input *input, Context *ctx, Status status)
 {
 }
Beispiel #2
0
 public static void InPlaceUpdater(Key *key, Input *input, Value *value)
 {
     Value.AcquireWriteLock(value);
     Value.Copy((Value *)input, value);
     Value.ReleaseWriteLock(value);
 }
Beispiel #3
0
 public static void CopyUpdater(Key *key, Input *input, Value *oldValue, Value *newValue)
 {
     Value.Copy((Value *)input, newValue);
 }
Beispiel #4
0
 public static int InitialValueLength(Key *key, Input *input)
 {
     return(Value.GetLength(default(Value *)));
 }
Beispiel #5
0
 public static void InitialUpdater(Key *key, Input *input, Value *value)
 {
     Value.Copy((Value *)input, value);
 }
        internal unsafe (double, double) Run(TestLoader testLoader)
        {
            RandomGenerator rng = new RandomGenerator();

            GCHandle handle = GCHandle.Alloc(input_, GCHandleType.Pinned);

            input_ptr = (Input *)handle.AddrOfPinnedObject();

#if DASHBOARD
            var dash = new Thread(() => DoContinuousMeasurements());
            dash.Start();
#endif

            Thread[] workers = new Thread[testLoader.Options.ThreadCount];

            Console.WriteLine("Executing setup.");

            // Setup the store for the YCSB benchmark.
            for (int idx = 0; idx < testLoader.Options.ThreadCount; ++idx)
            {
                int x = idx;
                workers[idx] = new Thread(() => SetupYcsb(x));
            }
            Stopwatch sw = new Stopwatch();
            sw.Start();
            // Start threads.
            foreach (Thread worker in workers)
            {
                worker.Start();
            }
            foreach (Thread worker in workers)
            {
                worker.Join();
            }
            sw.Stop();

            double insertsPerSecond = ((double)YcsbConstants.kInitCount / sw.ElapsedMilliseconds) * 1000;
            Console.WriteLine(TestStats.GetLoadingTimeLine(insertsPerSecond, sw.ElapsedMilliseconds));

            idx_ = 0;

            Console.WriteLine("Executing experiment.");

            // Run the experiment.
            for (int idx = 0; idx < testLoader.Options.ThreadCount; ++idx)
            {
                int x = idx;
                workers[idx] = new Thread(() => RunYcsb(x));
            }
            // Start threads.
            foreach (Thread worker in workers)
            {
                worker.Start();
            }

            Stopwatch swatch = new Stopwatch();
            swatch.Start();

            if (YcsbConstants.kPeriodicCheckpointMilliseconds <= 0)
            {
                Thread.Sleep(TimeSpan.FromSeconds(testLoader.Options.RunSeconds));
            }
            else
            {
                double runSeconds = 0;
                while (runSeconds < testLoader.Options.RunSeconds)
                {
                    Thread.Sleep(TimeSpan.FromMilliseconds(YcsbConstants.kPeriodicCheckpointMilliseconds));
                    runSeconds += YcsbConstants.kPeriodicCheckpointMilliseconds / 1000;
                }
            }

            swatch.Stop();

            done = true;

            foreach (Thread worker in workers)
            {
                worker.Join();
            }

#if DASHBOARD
            dash.Abort();
#endif

            handle.Free();
            input_ptr = null;

            double seconds = swatch.ElapsedMilliseconds / 1000.0;

            double opsPerSecond = total_ops_done / seconds;
            Console.WriteLine(TestStats.GetTotalOpsString(total_ops_done, seconds));
            Console.WriteLine(TestStats.GetStatsLine(StatsLineNum.Iteration, YcsbConstants.OpsPerSec, opsPerSecond));
            return(insertsPerSecond, opsPerSecond);
        }
Beispiel #7
0
 public static void ConcurrentReader(Key *key, Input *input, Value *value, Output *dst)
 {
     Value.AcquireReadLock(value);
     Value.Copy(value, (Value *)dst);
     Value.ReleaseReadLock(value);
 }
Beispiel #8
0
 public static void CopyUpdater(AdId *key, Input *input, NumClicks *oldValue, NumClicks *newValue)
 {
     newValue->numClicks += oldValue->numClicks + input->numClicks.numClicks;
 }
Beispiel #9
0
 public static Input *MoveToContext(Input *value)
 {
     return(value);
 }
Beispiel #10
0
 public static void InitialUpdater(AdId *key, Input *input, NumClicks *value)
 {
     NumClicks.Copy(&input->numClicks, value);
 }
Beispiel #11
0
 public static void InPlaceUpdater(AdId *key, Input *input, NumClicks *value)
 {
     Interlocked.Add(ref value->numClicks, input->numClicks.numClicks);
 }
Beispiel #12
0
 public static int InitialValueLength(AdId *key, Input *input)
 {
     return(NumClicks.GetLength(default(NumClicks *)));
 }
Beispiel #13
0
 public static void ConcurrentReader(AdId *key, Input *input, NumClicks *value, Output *dst)
 {
     NumClicks.AcquireReadLock(value);
     NumClicks.Copy(value, (NumClicks *)dst);
     NumClicks.ReleaseReadLock(value);
 }
Beispiel #14
0
 public static void SingleReader(AdId *key, Input *input, NumClicks *value, Output *dst)
 {
     NumClicks.Copy(value, (NumClicks *)dst);
 }
Beispiel #15
0
 public static void ReadCompletionCallback(AdId *key, Input *input, Output *output, Empty *ctx, Status status)
 {
 }
Beispiel #16
0
        public unsafe void Run()
        {
            RandomGenerator rng = new RandomGenerator();

            LoadData();

            input_ = new Input[8];
            for (int i = 0; i < 8; i++)
            {
                input_[i].value = i;
            }
            GCHandle handle = GCHandle.Alloc(input_, GCHandleType.Pinned);

            input_ptr = (Input *)handle.AddrOfPinnedObject();

#if DASHBOARD
            var dash = new Thread(() => DoContinuousMeasurements());
            dash.Start();
#endif

            Thread[] workers = new Thread[threadCount];

            Console.WriteLine("Executing setup.");

            // Setup the store for the YCSB benchmark.
            for (int idx = 0; idx < threadCount; ++idx)
            {
                int x = idx;
                workers[idx] = new Thread(() => SetupYcsb(x));
            }

            Stopwatch sw = new Stopwatch();
            sw.Start();
            // Start threads.
            foreach (Thread worker in workers)
            {
                worker.Start();
            }
            foreach (Thread worker in workers)
            {
                worker.Join();
            }
            sw.Stop();
            Console.WriteLine("Loading time: {0}ms", sw.ElapsedMilliseconds);

            long startTailAddress = store.LogTailAddress;
            Console.WriteLine("Start tail address = " + startTailAddress);


            idx_ = 0;
            store.DumpDistribution();

            Console.WriteLine("Executing experiment.");

            // Run the experiment.
            for (int idx = 0; idx < threadCount; ++idx)
            {
                int x = idx;
                workers[idx] = new Thread(() => RunYcsb(x));
            }
            // Start threads.
            foreach (Thread worker in workers)
            {
                worker.Start();
            }

            Stopwatch swatch = new Stopwatch();
            swatch.Start();

            if (kCheckpointSeconds <= 0)
            {
                Thread.Sleep(TimeSpan.FromSeconds(kRunSeconds));
            }
            else
            {
                int runSeconds = 0;
                while (runSeconds < kRunSeconds)
                {
                    Thread.Sleep(TimeSpan.FromSeconds(kCheckpointSeconds));
                    store.TakeFullCheckpoint(out Guid token);
                    runSeconds += kCheckpointSeconds;
                }
            }

            swatch.Stop();

            done = true;

            foreach (Thread worker in workers)
            {
                worker.Join();
            }

#if DASHBOARD
            dash.Abort();
#endif

            double seconds        = swatch.ElapsedMilliseconds / 1000.0;
            long   endTailAddress = store.LogTailAddress;
            Console.WriteLine("End tail address = " + endTailAddress);

            Console.WriteLine("Total " + total_ops_done + " ops done " + " in " + seconds + " secs.");
            Console.WriteLine("##, " + distribution + ", " + numaStyle + ", " + readPercent + ", "
                              + threadCount + ", " + total_ops_done / seconds + ", "
                              + (endTailAddress - startTailAddress));
        }