diff --git a/Driver/Core/SystemProfileInfo.cs b/Driver/Core/SystemProfileInfo.cs
index 698fb1f3be0..eec019cd748 100644
--- a/Driver/Core/SystemProfileInfo.cs
+++ b/Driver/Core/SystemProfileInfo.cs
@@ -50,12 +50,14 @@ public class SystemProfileInfo
private bool _idHack;
private string _info;
private int _keyUpdates;
+ private BsonDocument _lockStatistics;
private bool _moved;
private string _namespace;
private int _numberReturned;
private int _numberScanned;
private int _numberToReturn;
private int _numberToSkip;
+ private int _numberOfYields;
private string _op;
private BsonDocument _query;
private int _responseLength;
@@ -65,14 +67,6 @@ public class SystemProfileInfo
private bool _upsert;
private string _user;
- // constructors
- ///
- /// Initializes a new instance of the SystemProfileInfo class.
- ///
- public SystemProfileInfo()
- {
- }
-
// public properties
///
/// Gets or sets the abbreviated profile info (only used when the profile info would have exceeded 100KB).
@@ -200,6 +194,12 @@ public int KeyUpdates
set { _keyUpdates = value; }
}
+ public BsonDocument LockStatistics
+ {
+ get { return _lockStatistics; }
+ set { _lockStatistics = value; }
+ }
+
///
/// Gets or sets whether moved was true.
///
@@ -254,6 +254,15 @@ public int NumberToSkip
set { _numberToSkip = value; }
}
+ ///
+ /// Gets or sets the number of yields.
+ ///
+ public int NumberOfYields
+ {
+ get { return _numberOfYields; }
+ set { _numberOfYields = value; }
+ }
+
///
/// Gets or sets the operation.
///
@@ -404,6 +413,9 @@ public class SystemProfileInfoSerializer : BsonBaseSerializer, IBsonDocumentSeri
case "keyUpdates":
profileInfo.KeyUpdates = BsonValue.ReadFrom(bsonReader).ToInt32();
break;
+ case "lockStatMillis":
+ profileInfo.LockStatistics = BsonValue.ReadFrom(bsonReader).AsBsonDocument;
+ break;
case "millis":
profileInfo.Duration = TimeSpan.FromMilliseconds(BsonValue.ReadFrom(bsonReader).ToDouble());
break;
@@ -425,6 +437,9 @@ public class SystemProfileInfoSerializer : BsonBaseSerializer, IBsonDocumentSeri
case "ntoskip":
profileInfo.NumberToSkip = BsonValue.ReadFrom(bsonReader).ToInt32();
break;
+ case "numYield":
+ profileInfo.NumberOfYields = BsonValue.ReadFrom(bsonReader).ToInt32();
+ break;
case "op":
profileInfo.Op = bsonReader.ReadString();
break;
@@ -545,6 +560,11 @@ public BsonSerializationInfo GetMemberSerializationInfo(string memberName)
serializer = Int32Serializer.Instance;
nominalType = typeof(int);
break;
+ case "LockStatistics":
+ elementName = "lockStatMillis";
+ serializer = BsonDocumentSerializer.Instance;
+ nominalType = typeof(BsonDocument);
+ break;
case "Moved":
elementName = "moved";
serializer = BooleanSerializer.Instance;
@@ -575,6 +595,11 @@ public BsonSerializationInfo GetMemberSerializationInfo(string memberName)
serializer = Int32Serializer.Instance;
nominalType = typeof(int);
break;
+ case "NumberOfYields":
+ elementName = "numYield";
+ serializer = Int32Serializer.Instance;
+ nominalType = typeof(int);
+ break;
case "Op":
elementName = "op";
serializer = StringSerializer.Instance;
@@ -693,6 +718,10 @@ public BsonSerializationInfo GetMemberSerializationInfo(string memberName)
{
bsonWriter.WriteInt32("nscanned", profileInfo.NumberScanned);
}
+ if (profileInfo.NumberOfYields != 0)
+ {
+ bsonWriter.WriteInt32("numYield", profileInfo.NumberOfYields);
+ }
if (profileInfo.IdHack)
{
bsonWriter.WriteBoolean("idhack", profileInfo.IdHack);
@@ -754,6 +783,11 @@ public BsonSerializationInfo GetMemberSerializationInfo(string memberName)
{
bsonWriter.WriteString("abbreviated", profileInfo.Abbreviated);
}
+ if (profileInfo.LockStatistics != null)
+ {
+ bsonWriter.WriteName("lockStatMillis");
+ profileInfo.LockStatistics.WriteTo(bsonWriter);
+ }
bsonWriter.WriteEndDocument();
}
}
diff --git a/DriverUnitTests/Core/SystemProfileIntoTests.cs b/DriverUnitTests/Core/SystemProfileIntoTests.cs
index b5075750380..06f4df94647 100644
--- a/DriverUnitTests/Core/SystemProfileIntoTests.cs
+++ b/DriverUnitTests/Core/SystemProfileIntoTests.cs
@@ -60,12 +60,14 @@ public void TestAll()
IdHack = true,
Info = "info",
KeyUpdates = 4,
+ LockStatistics = new BsonDocument().Add("timeLocked", new BsonDocument("r", 11L).Add("w", 12L)).Add("timeAcquiring", new BsonDocument("r",12L).Add("w", 12L)),
Moved = true,
Namespace = "ns",
NumberReturned = 5,
NumberScanned = 6,
NumberToReturn = 7,
NumberToSkip = 8,
+ NumberOfYields = 10,
Op = "op",
Query = new BsonDocument("query", 1),
ResponseLength = 9,
@@ -91,12 +93,14 @@ public void TestAll()
Assert.AreEqual(info.IdHack, rehydrated.IdHack);
Assert.AreEqual(info.Info, rehydrated.Info);
Assert.AreEqual(info.KeyUpdates, rehydrated.KeyUpdates);
+ Assert.AreEqual(info.LockStatistics, rehydrated.LockStatistics);
Assert.AreEqual(info.Moved, rehydrated.Moved);
Assert.AreEqual(info.Namespace, rehydrated.Namespace);
Assert.AreEqual(info.NumberReturned, rehydrated.NumberReturned);
Assert.AreEqual(info.NumberScanned, rehydrated.NumberScanned);
Assert.AreEqual(info.NumberToReturn, rehydrated.NumberToReturn);
Assert.AreEqual(info.NumberToSkip, rehydrated.NumberToSkip);
+ Assert.AreEqual(info.NumberOfYields, rehydrated.NumberOfYields);
Assert.AreEqual(info.Op, rehydrated.Op);
Assert.AreEqual(info.Query, rehydrated.Query);
Assert.AreEqual(info.ResponseLength, rehydrated.ResponseLength);