Skip to content

Commit

Permalink
[C#] RecordInfo v2 (#577)
Browse files Browse the repository at this point in the history
* RecordInfo v2

* fix version jump in CPR.

* Updated misc stuff

* nit

* misc updates to SpanByte

* Remove IntExclLocker

* Add Try APIs to record locking

* cleanup
  • Loading branch information
badrishc authored Oct 19, 2021
1 parent 2287004 commit 0c7ff6b
Show file tree
Hide file tree
Showing 14 changed files with 286 additions and 331 deletions.
4 changes: 1 addition & 3 deletions cs/benchmark/FasterSpanByteYcsbBenchmark.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.

#pragma warning disable CS0162 // Unreachable code detected -- when switching on YcsbConstants

// Define below to enable continuous performance report for dashboard
// #define DASHBOARD

Expand Down Expand Up @@ -297,7 +295,7 @@ internal unsafe (double, double) Run(TestLoader testLoader)
long start = swatch.ElapsedTicks;
if (store.TakeHybridLogCheckpoint(out _, testLoader.Options.PeriodicCheckpointType, testLoader.Options.PeriodicCheckpointTryIncremental))
{
store.CompleteCheckpointAsync().GetAwaiter().GetResult();
store.CompleteCheckpointAsync().AsTask().GetAwaiter().GetResult();
var timeTaken = (swatch.ElapsedTicks - start) / TimeSpan.TicksPerMillisecond;
Console.WriteLine("Checkpoint time: {0}ms", timeTaken);
checkpointTaken++;
Expand Down
4 changes: 1 addition & 3 deletions cs/benchmark/FasterYcsbBenchmark.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.

#pragma warning disable CS0162 // Unreachable code detected -- when switching on YcsbConstants

// Define below to enable continuous performance report for dashboard
// #define DASHBOARD

Expand Down Expand Up @@ -292,7 +290,7 @@ internal unsafe (double, double) Run(TestLoader testLoader)
long start = swatch.ElapsedTicks;
if (store.TakeHybridLogCheckpoint(out _, testLoader.Options.PeriodicCheckpointType, testLoader.Options.PeriodicCheckpointTryIncremental))
{
store.CompleteCheckpointAsync().GetAwaiter().GetResult();
store.CompleteCheckpointAsync().AsTask().GetAwaiter().GetResult();
var timeTaken = (swatch.ElapsedTicks - start) / TimeSpan.TicksPerMillisecond;
Console.WriteLine("Checkpoint time: {0}ms", timeTaken);
checkpointTaken++;
Expand Down
10 changes: 8 additions & 2 deletions cs/benchmark/Functions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,18 @@ public void CopyUpdater(ref Key key, ref Input input, ref Value oldValue, ref Va

public void Lock(ref RecordInfo recordInfo, ref Key key, ref Value value, LockType lockType, ref long lockContext)
{
recordInfo.SpinLock();
if (lockType == LockType.Exclusive)
recordInfo.LockExclusive();
else
recordInfo.LockShared();
}

public bool Unlock(ref RecordInfo recordInfo, ref Key key, ref Value value, LockType lockType, long lockContext)
{
recordInfo.Unlock();
if (lockType == LockType.Exclusive)
recordInfo.UnlockExclusive();
else
recordInfo.UnlockShared();
return true;
}
}
Expand Down
Loading

0 comments on commit 0c7ff6b

Please sign in to comment.