diff --git a/src/NetMQ/Core/Utils/OpCode.cs b/src/NetMQ/Core/Utils/OpCode.cs
index 7228fcfc..f2ae4365 100644
--- a/src/NetMQ/Core/Utils/OpCode.cs
+++ b/src/NetMQ/Core/Utils/OpCode.cs
@@ -11,6 +11,8 @@ internal static class Opcode
public static bool Open()
{
+ if (SocketOptions.DoNotUseRDTSC)
+ return false;
#if NETSTANDARD1_1_OR_GREATER || NET471_OR_GREATER
if (RuntimeInformation.ProcessArchitecture != Architecture.X86 &&
RuntimeInformation.ProcessArchitecture != Architecture.X64)
diff --git a/src/NetMQ/SocketOptions.cs b/src/NetMQ/SocketOptions.cs
index 38ed476d..3844e3ca 100644
--- a/src/NetMQ/SocketOptions.cs
+++ b/src/NetMQ/SocketOptions.cs
@@ -12,6 +12,16 @@ namespace NetMQ
///
public class SocketOptions
{
+ ///
+ /// If set, the time stamp counter is not read directly through opcode injection,
+ /// rather is used.
+ /// When false, the time stamp counter is read by allocating a few bytes on the heap with
+ /// read/write/execute privilege. OpCode is copied to this allocated memory and invoked to read
+ /// the time stamp counter, (which is a register available on most modern CPUs). While this is
+ /// an accurate way to read the time stamp counter, because it injects code onto the heap, this
+ /// can be detected as a malware technique by some anti-virus defenders.
+ ///
+ public static bool DoNotUseRDTSC;
///
/// The NetMQSocket that this SocketOptions is referencing.
///