本文整理汇总了C++中CurOp::lockStat方法的典型用法代码示例。如果您正苦于以下问题:C++ CurOp::lockStat方法的具体用法?C++ CurOp::lockStat怎么用?C++ CurOp::lockStat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CurOp
的用法示例。
在下文中一共展示了CurOp::lockStat方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: append
void OpDebug::append( const CurOp& curop, BSONObjBuilder& b ) const {
b.append( "op" , iscommand ? "command" : opToString( op ) );
b.append( "ns" , ns );
if ( ! query.isEmpty() )
b.append( iscommand ? "command" : "query" , query );
else if ( ! iscommand && curop.haveQuery() )
curop.appendQuery( b , "query" );
if ( ! updateobj.isEmpty() )
b.append( "updateobj" , updateobj );
OPDEBUG_APPEND_NUMBER( cursorid );
OPDEBUG_APPEND_NUMBER( ntoreturn );
OPDEBUG_APPEND_NUMBER( ntoskip );
OPDEBUG_APPEND_BOOL( exhaust );
OPDEBUG_APPEND_NUMBER( nscanned );
OPDEBUG_APPEND_BOOL( idhack );
OPDEBUG_APPEND_BOOL( scanAndOrder );
OPDEBUG_APPEND_NUMBER( nupdated );
OPDEBUG_APPEND_NUMBER( ninserted );
OPDEBUG_APPEND_NUMBER( ndeleted );
OPDEBUG_APPEND_BOOL( fastmod );
OPDEBUG_APPEND_BOOL( fastmodinsert );
OPDEBUG_APPEND_BOOL( upsert );
OPDEBUG_APPEND_NUMBER( keyUpdates );
b.append( "lockStats" , curop.lockStat().report() );
if ( ! exceptionInfo.empty() )
exceptionInfo.append( b , "exception" , "exceptionCode" );
OPDEBUG_APPEND_NUMBER( nreturned );
OPDEBUG_APPEND_NUMBER( responseLength );
b.append( "millis" , executionTime );
}
示例2: report
string OpDebug::report( const CurOp& curop ) const {
StringBuilder s;
if ( iscommand )
s << "command ";
else
s << opToString( op ) << ' ';
s << ns;
if ( ! query.isEmpty() ) {
if ( iscommand )
s << " command: ";
else
s << " query: ";
s << query.toString(false, true);
}
if ( ! updateobj.isEmpty() ) {
s << " update: ";
updateobj.toString( s );
}
OPDEBUG_TOSTRING_HELP( cursorid );
OPDEBUG_TOSTRING_HELP( ntoreturn );
OPDEBUG_TOSTRING_HELP( ntoskip );
OPDEBUG_TOSTRING_HELP_BOOL( exhaust );
OPDEBUG_TOSTRING_HELP( nscanned );
OPDEBUG_TOSTRING_HELP_BOOL( idhack );
OPDEBUG_TOSTRING_HELP_BOOL( scanAndOrder );
OPDEBUG_TOSTRING_HELP( nupdated );
OPDEBUG_TOSTRING_HELP( ninserted );
OPDEBUG_TOSTRING_HELP( ndeleted );
OPDEBUG_TOSTRING_HELP_BOOL( fastmodinsert );
OPDEBUG_TOSTRING_HELP_BOOL( upsert );
OPDEBUG_TOSTRING_HELP( keyUpdates );
if ( extra.len() )
s << " " << extra.str();
if ( ! exceptionInfo.empty() ) {
s << " exception: " << exceptionInfo.msg;
if ( exceptionInfo.code )
s << " code:" << exceptionInfo.code;
}
if (!lockNotGrantedInfo.isEmpty()) {
BSONObjBuilder expandedLockNotGrantedInfoBuilder;
expandedLockNotGrantedInfoBuilder.appendElements(lockNotGrantedInfo);
verify(lockNotGrantedInfo["blockingTxnid"].isNumber());
long long blockingTxnid = lockNotGrantedInfo["blockingTxnid"].numberLong();
{
scoped_lock bl(Client::clientsMutex);
for (set<Client*>::iterator i = Client::clients.begin(); i != Client::clients.end(); i++) {
Client *c = *i;
verify(c);
if (c->rootTransactionId() == blockingTxnid && c->curop() != NULL) {
expandedLockNotGrantedInfoBuilder.append("blockingOp", c->curop()->info());
break;
}
}
}
s << " lockNotGranted: " << expandedLockNotGrantedInfoBuilder.done();
}
s << " ";
curop.lockStat().report( s );
OPDEBUG_TOSTRING_HELP( nreturned );
if ( responseLength > 0 )
s << " reslen:" << responseLength;
s << " " << executionTime << "ms";
return s.str();
}
示例3: append
bool OpDebug::append(const CurOp& curop, BSONObjBuilder& b, size_t maxSize) const {
b.append( "op" , iscommand ? "command" : opToString( op ) );
b.append( "ns" , ns.toString() );
int queryUpdateObjSize = 0;
if (!query.isEmpty()) {
queryUpdateObjSize += query.objsize();
}
else if (!iscommand && curop.haveQuery()) {
queryUpdateObjSize += curop.query()["query"].size();
}
if (!updateobj.isEmpty()) {
queryUpdateObjSize += updateobj.objsize();
}
if (static_cast<size_t>(queryUpdateObjSize) > maxSize) {
if (!query.isEmpty()) {
// Use 60 since BSONObj::toString can truncate strings into 150 chars
// and we want to have enough room for both query and updateobj when
// the entire document is going to be serialized into a string
const string abbreviated(query.toString(false, false), 0, 60);
b.append(iscommand ? "command" : "query", abbreviated + "...");
}
else if (!iscommand && curop.haveQuery()) {
const string abbreviated(curop.query()["query"].toString(false, false), 0, 60);
b.append("query", abbreviated + "...");
}
if (!updateobj.isEmpty()) {
const string abbreviated(updateobj.toString(false, false), 0, 60);
b.append("updateobj", abbreviated + "...");
}
return false;
}
if (!query.isEmpty()) {
b.append(iscommand ? "command" : "query", query);
}
else if (!iscommand && curop.haveQuery()) {
curop.appendQuery(b, "query");
}
if (!updateobj.isEmpty()) {
b.append("updateobj", updateobj);
}
const bool moved = (nmoved >= 1);
OPDEBUG_APPEND_NUMBER( cursorid );
OPDEBUG_APPEND_NUMBER( ntoreturn );
OPDEBUG_APPEND_NUMBER( ntoskip );
OPDEBUG_APPEND_BOOL( exhaust );
OPDEBUG_APPEND_NUMBER( nscanned );
OPDEBUG_APPEND_BOOL( idhack );
OPDEBUG_APPEND_BOOL( scanAndOrder );
OPDEBUG_APPEND_BOOL( moved );
OPDEBUG_APPEND_NUMBER( nmoved );
OPDEBUG_APPEND_NUMBER( nMatched );
OPDEBUG_APPEND_NUMBER( nModified );
OPDEBUG_APPEND_NUMBER( ninserted );
OPDEBUG_APPEND_NUMBER( ndeleted );
OPDEBUG_APPEND_BOOL( fastmod );
OPDEBUG_APPEND_BOOL( fastmodinsert );
OPDEBUG_APPEND_BOOL( upsert );
OPDEBUG_APPEND_NUMBER( keyUpdates );
b.appendNumber( "numYield" , curop.numYields() );
b.append( "lockStats" , curop.lockStat().report() );
if ( ! exceptionInfo.empty() )
exceptionInfo.append( b , "exception" , "exceptionCode" );
OPDEBUG_APPEND_NUMBER( nreturned );
OPDEBUG_APPEND_NUMBER( responseLength );
b.append( "millis" , executionTime );
execStats.append(b, "execStats");
return true;
}
示例4: report
string OpDebug::report( const CurOp& curop ) const {
StringBuilder s;
if ( iscommand )
s << "command ";
else
s << opToString( op ) << ' ';
s << ns.toString();
if ( ! query.isEmpty() ) {
if ( iscommand ) {
s << " command: ";
Command* curCommand = curop.getCommand();
if (curCommand) {
mutablebson::Document cmdToLog(curop.query(),
mutablebson::Document::kInPlaceDisabled);
curCommand->redactForLogging(&cmdToLog);
s << cmdToLog.toString();
}
else { // Should not happen but we need to handle curCommand == NULL gracefully
s << query.toString();
}
}
else {
s << " query: ";
s << query.toString();
}
}
if (!planSummary.empty()) {
s << " planSummary: " << planSummary.toString();
}
if ( ! updateobj.isEmpty() ) {
s << " update: ";
updateobj.toString( s );
}
OPDEBUG_TOSTRING_HELP( cursorid );
OPDEBUG_TOSTRING_HELP( ntoreturn );
OPDEBUG_TOSTRING_HELP( ntoskip );
OPDEBUG_TOSTRING_HELP_BOOL( exhaust );
OPDEBUG_TOSTRING_HELP( nscanned );
OPDEBUG_TOSTRING_HELP_BOOL( idhack );
OPDEBUG_TOSTRING_HELP_BOOL( scanAndOrder );
OPDEBUG_TOSTRING_HELP( nmoved );
OPDEBUG_TOSTRING_HELP( nMatched );
OPDEBUG_TOSTRING_HELP( nModified );
OPDEBUG_TOSTRING_HELP( ninserted );
OPDEBUG_TOSTRING_HELP( ndeleted );
OPDEBUG_TOSTRING_HELP_BOOL( fastmod );
OPDEBUG_TOSTRING_HELP_BOOL( fastmodinsert );
OPDEBUG_TOSTRING_HELP_BOOL( upsert );
OPDEBUG_TOSTRING_HELP( keyUpdates );
if ( extra.len() )
s << " " << extra.str();
if ( ! exceptionInfo.empty() ) {
s << " exception: " << exceptionInfo.msg;
if ( exceptionInfo.code )
s << " code:" << exceptionInfo.code;
}
s << " numYields:" << curop.numYields();
s << " ";
curop.lockStat().report( s );
OPDEBUG_TOSTRING_HELP( nreturned );
if ( responseLength > 0 )
s << " reslen:" << responseLength;
s << " " << executionTime << "ms";
return s.str();
}
示例5: report
string OpDebug::report( const CurOp& curop ) const {
StringBuilder s;
if ( iscommand )
s << "command ";
else
s << opToString( op ) << ' ';
s << ns;
if ( ! query.isEmpty() ) {
if ( iscommand )
s << " command: ";
else
s << " query: ";
s << query.toString(false, true);
}
if ( ! updateobj.isEmpty() ) {
s << " update: ";
updateobj.toString( s );
}
OPDEBUG_TOSTRING_HELP( cursorid );
OPDEBUG_TOSTRING_HELP( ntoreturn );
OPDEBUG_TOSTRING_HELP( ntoskip );
OPDEBUG_TOSTRING_HELP_BOOL( exhaust );
OPDEBUG_TOSTRING_HELP( nscanned );
OPDEBUG_TOSTRING_HELP_BOOL( idhack );
OPDEBUG_TOSTRING_HELP_BOOL( scanAndOrder );
OPDEBUG_TOSTRING_HELP( nupdated );
OPDEBUG_TOSTRING_HELP( ninserted );
OPDEBUG_TOSTRING_HELP( ndeleted );
OPDEBUG_TOSTRING_HELP_BOOL( fastmod );
OPDEBUG_TOSTRING_HELP_BOOL( fastmodinsert );
OPDEBUG_TOSTRING_HELP_BOOL( upsert );
OPDEBUG_TOSTRING_HELP( keyUpdates );
if ( extra.len() )
s << " " << extra.str();
if ( ! exceptionInfo.empty() ) {
s << " exception: " << exceptionInfo.msg;
if ( exceptionInfo.code )
s << " code:" << exceptionInfo.code;
}
if ( ! lockNotGrantedInfo.isEmpty() ) {
s << " lockNotGranted: " << lockNotGrantedInfo;
}
s << " ";
curop.lockStat().report( s );
OPDEBUG_TOSTRING_HELP( nreturned );
if ( responseLength > 0 )
s << " reslen:" << responseLength;
s << " " << executionTime << "ms";
return s.str();
}