diff options
author | Eliot Horowitz <eliot@10gen.com> | 2009-12-29 14:48:42 -0500 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2009-12-29 14:48:42 -0500 |
commit | 758cd7350d350b9dc9433fd1e8f04990cf7e5294 (patch) | |
tree | 610f4c6c5cb114c4c0a07d763f77ae067ab9adef /shell | |
parent | f05a6aafb31d483b56dc1c9008e5b07e44a735ef (diff) | |
download | mongo-758cd7350d350b9dc9433fd1e8f04990cf7e5294.tar.gz |
configure "slow" queries
either --slowms on the command line
or through setProfilingLevel
SERVER-457
Diffstat (limited to 'shell')
-rw-r--r-- | shell/db.js | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/shell/db.js b/shell/db.js index 118c3e44ac5..ab79e22a1bd 100644 --- a/shell/db.js +++ b/shell/db.js @@ -268,7 +268,7 @@ DB.prototype.help = function() { print("\tdb.repairDatabase()"); print("\tdb.resetError()"); print("\tdb.runCommand(cmdObj) run a database command. if cmdObj is a string, turns it into { cmdObj : 1 }"); - print("\tdb.setProfilingLevel(level) 0=off 1=slow 2=all"); + print("\tdb.setProfilingLevel(level,<slowms>) 0=off 1=slow 2=all"); print("\tdb.shutdownServer()"); print("\tdb.version() current version of the server" ); } @@ -298,17 +298,16 @@ DB.prototype.printCollectionStats = function(){ * @param {String} level Desired level of profiling * @return SOMETHING_FIXME or null on error */ -DB.prototype.setProfilingLevel = function(level) { +DB.prototype.setProfilingLevel = function(level,slowms) { if (level < 0 || level > 2) { throw { dbSetProfilingException : "input level " + level + " is out of range [0..2]" }; } - - if (level) { - // if already exists does nothing - this.createCollection("system.profile", { capped: true, size: 128 * 1024 } ); - } - return this._dbCommand( { profile: level } ); + + var cmd = { profile: level }; + if ( slowms ) + cmd["slowms"] = slowms; + return this._dbCommand( cmd ); } |