Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
StackExchange.Redis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tsai
StackExchange.Redis
Commits
4fe6bb2d
Commit
4fe6bb2d
authored
Aug 08, 2018
by
Nick Craver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DebuggAids: remove ResultBox bits
We'll be using BenchmarkDotNet for this going forward
parent
e8d90569
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
1 addition
and
48 deletions
+1
-48
MassiveOps.cs
StackExchange.Redis.Tests/MassiveOps.cs
+0
-17
Secure.cs
StackExchange.Redis.Tests/Secure.cs
+0
-8
DebuggingAids.cs
StackExchange.Redis/StackExchange/Redis/DebuggingAids.cs
+0
-12
ResultBox.cs
StackExchange.Redis/StackExchange/Redis/ResultBox.cs
+1
-11
No files found.
StackExchange.Redis.Tests/MassiveOps.cs
View file @
4fe6bb2d
...
@@ -72,9 +72,6 @@ public void MassiveBulkOpsSync(int threads)
...
@@ -72,9 +72,6 @@ public void MassiveBulkOpsSync(int threads)
RedisKey
key
=
"MBOS"
;
RedisKey
key
=
"MBOS"
;
var
conn
=
muxer
.
GetDatabase
();
var
conn
=
muxer
.
GetDatabase
();
conn
.
KeyDelete
(
key
,
CommandFlags
.
FireAndForget
);
conn
.
KeyDelete
(
key
,
CommandFlags
.
FireAndForget
);
#if DEBUG
long
oldAlloc
=
ConnectionMultiplexer
.
GetResultBoxAllocationCount
();
#endif
var
timeTaken
=
RunConcurrent
(
delegate
var
timeTaken
=
RunConcurrent
(
delegate
{
{
for
(
int
i
=
0
;
i
<
workPerThread
;
i
++)
for
(
int
i
=
0
;
i
<
workPerThread
;
i
++)
...
@@ -87,11 +84,6 @@ public void MassiveBulkOpsSync(int threads)
...
@@ -87,11 +84,6 @@ public void MassiveBulkOpsSync(int threads)
Assert
.
Equal
(
workPerThread
*
threads
,
val
);
Assert
.
Equal
(
workPerThread
*
threads
,
val
);
Log
(
"{2}: Time for {0} ops on {3} threads: {1}ms (any order); ops/s: {4}"
,
Log
(
"{2}: Time for {0} ops on {3} threads: {1}ms (any order); ops/s: {4}"
,
threads
*
workPerThread
,
timeTaken
.
TotalMilliseconds
,
Me
(),
threads
,
(
workPerThread
*
threads
)
/
timeTaken
.
TotalSeconds
);
threads
*
workPerThread
,
timeTaken
.
TotalMilliseconds
,
Me
(),
threads
,
(
workPerThread
*
threads
)
/
timeTaken
.
TotalSeconds
);
#if DEBUG
long
newAlloc
=
ConnectionMultiplexer
.
GetResultBoxAllocationCount
();
Log
(
"ResultBox allocations: {0}"
,
newAlloc
-
oldAlloc
);
Assert
.
True
(
newAlloc
-
oldAlloc
<=
2
*
threads
,
"number of box allocations"
);
#endif
}
}
}
}
...
@@ -102,9 +94,6 @@ public void MassiveBulkOpsFireAndForget(int threads)
...
@@ -102,9 +94,6 @@ public void MassiveBulkOpsFireAndForget(int threads)
{
{
using
(
var
muxer
=
Create
(
syncTimeout
:
30000
))
using
(
var
muxer
=
Create
(
syncTimeout
:
30000
))
{
{
#if DEBUG
long
oldAlloc
=
ConnectionMultiplexer
.
GetResultBoxAllocationCount
();
#endif
RedisKey
key
=
"MBOF"
;
RedisKey
key
=
"MBOF"
;
var
conn
=
muxer
.
GetDatabase
();
var
conn
=
muxer
.
GetDatabase
();
conn
.
Ping
();
conn
.
Ping
();
...
@@ -125,12 +114,6 @@ public void MassiveBulkOpsFireAndForget(int threads)
...
@@ -125,12 +114,6 @@ public void MassiveBulkOpsFireAndForget(int threads)
Log
(
"{2}: Time for {0} ops over {4} threads: {1:###,###}ms (any order); ops/s: {3:###,###,##0}"
,
Log
(
"{2}: Time for {0} ops over {4} threads: {1:###,###}ms (any order); ops/s: {3:###,###,##0}"
,
val
,
elapsed
.
TotalMilliseconds
,
Me
(),
val
,
elapsed
.
TotalMilliseconds
,
Me
(),
val
/
elapsed
.
TotalSeconds
,
threads
);
val
/
elapsed
.
TotalSeconds
,
threads
);
#if DEBUG
long
newAlloc
=
ConnectionMultiplexer
.
GetResultBoxAllocationCount
();
Log
(
"ResultBox allocations: {0}"
,
newAlloc
-
oldAlloc
);
Assert
.
True
(
newAlloc
-
oldAlloc
<=
4
);
#endif
}
}
}
}
}
}
...
...
StackExchange.Redis.Tests/Secure.cs
View file @
4fe6bb2d
...
@@ -19,9 +19,6 @@ public void MassiveBulkOpsFireAndForgetSecure()
...
@@ -19,9 +19,6 @@ public void MassiveBulkOpsFireAndForgetSecure()
{
{
using
(
var
muxer
=
Create
())
using
(
var
muxer
=
Create
())
{
{
#if DEBUG
long
oldAlloc
=
ConnectionMultiplexer
.
GetResultBoxAllocationCount
();
#endif
RedisKey
key
=
"MBOF"
;
RedisKey
key
=
"MBOF"
;
var
conn
=
muxer
.
GetDatabase
();
var
conn
=
muxer
.
GetDatabase
();
conn
.
Ping
();
conn
.
Ping
();
...
@@ -37,11 +34,6 @@ public void MassiveBulkOpsFireAndForgetSecure()
...
@@ -37,11 +34,6 @@ public void MassiveBulkOpsFireAndForgetSecure()
watch
.
Stop
();
watch
.
Stop
();
Log
(
"{2}: Time for {0} ops: {1}ms (any order); ops/s: {3}"
,
AsyncOpsQty
,
watch
.
ElapsedMilliseconds
,
Me
(),
Log
(
"{2}: Time for {0} ops: {1}ms (any order); ops/s: {3}"
,
AsyncOpsQty
,
watch
.
ElapsedMilliseconds
,
Me
(),
AsyncOpsQty
/
watch
.
Elapsed
.
TotalSeconds
);
AsyncOpsQty
/
watch
.
Elapsed
.
TotalSeconds
);
#if DEBUG
long
newAlloc
=
ConnectionMultiplexer
.
GetResultBoxAllocationCount
();
Log
(
"ResultBox allocations: {0}"
,
newAlloc
-
oldAlloc
);
Assert
.
True
(
newAlloc
-
oldAlloc
<=
2
,
$"NewAllocs:
{
newAlloc
}
, OldAllocs:
{
oldAlloc
}
"
);
#endif
}
}
}
}
...
...
StackExchange.Redis/StackExchange/Redis/DebuggingAids.cs
View file @
4fe6bb2d
...
@@ -5,13 +5,6 @@
...
@@ -5,13 +5,6 @@
namespace
StackExchange.Redis
namespace
StackExchange.Redis
{
{
#if DEBUG
#if DEBUG
internal
partial
class
ResultBox
{
internal
static
long
allocations
;
public
static
long
GetAllocationCount
()
=>
System
.
Threading
.
Interlocked
.
Read
(
ref
allocations
);
static
partial
void
OnAllocated
()
=>
System
.
Threading
.
Interlocked
.
Increment
(
ref
allocations
);
}
public
partial
interface
IServer
public
partial
interface
IServer
{
{
/// <summary>
/// <summary>
...
@@ -37,11 +30,6 @@ internal partial class RedisServer
...
@@ -37,11 +30,6 @@ internal partial class RedisServer
public
partial
class
ConnectionMultiplexer
public
partial
class
ConnectionMultiplexer
{
{
/// <summary>
/// Gets how many result-box instances were allocated
/// </summary>
public
static
long
GetResultBoxAllocationCount
()
=>
ResultBox
.
GetAllocationCount
();
private
volatile
bool
allowConnect
=
true
,
private
volatile
bool
allowConnect
=
true
,
ignoreConnect
=
false
;
ignoreConnect
=
false
;
...
...
StackExchange.Redis/StackExchange/Redis/ResultBox.cs
View file @
4fe6bb2d
using
System
;
using
System
;
using
System.Diagnostics
;
using
System.Threading
;
using
System.Threading
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
namespace
StackExchange.Redis
namespace
StackExchange.Redis
{
{
internal
abstract
partial
class
ResultBox
internal
abstract
class
ResultBox
{
{
protected
Exception
_exception
;
protected
Exception
_exception
;
public
abstract
bool
IsAsync
{
get
;
}
public
abstract
bool
IsAsync
{
get
;
}
...
@@ -15,14 +14,6 @@ internal abstract partial class ResultBox
...
@@ -15,14 +14,6 @@ internal abstract partial class ResultBox
public
abstract
bool
TryComplete
(
bool
isAsync
);
public
abstract
bool
TryComplete
(
bool
isAsync
);
[
Conditional
(
"DEBUG"
)]
protected
static
void
IncrementAllocationCount
()
{
OnAllocated
();
}
static
partial
void
OnAllocated
();
public
void
Cancel
()
=>
_exception
=
s_cancelled
;
public
void
Cancel
()
=>
_exception
=
s_cancelled
;
// in theory nobody should directly observe this; the only things
// in theory nobody should directly observe this; the only things
...
@@ -54,7 +45,6 @@ public static ResultBox<T> Get(object stateOrCompletionSource)
...
@@ -54,7 +45,6 @@ public static ResultBox<T> Get(object stateOrCompletionSource)
return
found
;
return
found
;
}
}
}
}
IncrementAllocationCount
();
return
new
ResultBox
<
T
>(
stateOrCompletionSource
);
return
new
ResultBox
<
T
>(
stateOrCompletionSource
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment