public static void RMWCompletionCallback(Key *key, Input *input, Context *ctx, Status status) { }
public static void InPlaceUpdater(Key *key, Input *input, Value *value) { Value.AcquireWriteLock(value); Value.Copy((Value *)input, value); Value.ReleaseWriteLock(value); }
public static void CopyUpdater(Key *key, Input *input, Value *oldValue, Value *newValue) { Value.Copy((Value *)input, newValue); }
public static int InitialValueLength(Key *key, Input *input) { return(Value.GetLength(default(Value *))); }
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); }
public static void ConcurrentReader(Key *key, Input *input, Value *value, Output *dst) { Value.AcquireReadLock(value); Value.Copy(value, (Value *)dst); Value.ReleaseReadLock(value); }
public static void CopyUpdater(AdId *key, Input *input, NumClicks *oldValue, NumClicks *newValue) { newValue->numClicks += oldValue->numClicks + input->numClicks.numClicks; }
public static Input *MoveToContext(Input *value) { return(value); }
public static void InitialUpdater(AdId *key, Input *input, NumClicks *value) { NumClicks.Copy(&input->numClicks, value); }
public static void InPlaceUpdater(AdId *key, Input *input, NumClicks *value) { Interlocked.Add(ref value->numClicks, input->numClicks.numClicks); }
public static int InitialValueLength(AdId *key, Input *input) { return(NumClicks.GetLength(default(NumClicks *))); }
public static void ConcurrentReader(AdId *key, Input *input, NumClicks *value, Output *dst) { NumClicks.AcquireReadLock(value); NumClicks.Copy(value, (NumClicks *)dst); NumClicks.ReleaseReadLock(value); }
public static void SingleReader(AdId *key, Input *input, NumClicks *value, Output *dst) { NumClicks.Copy(value, (NumClicks *)dst); }
public static void ReadCompletionCallback(AdId *key, Input *input, Output *output, Empty *ctx, Status status) { }
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)); }