diff options
author | Eliot Horowitz <eliot@10gen.com> | 2010-07-12 13:17:34 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2010-07-12 13:17:34 -0400 |
commit | 28418f3ea2f0534baebeb182f168748de65d0819 (patch) | |
tree | a8842bb3f74b6469ed7a5367237850d8b2fa4923 /tools | |
parent | 275fb3f0567e7d4b1b05b5002fdf33d12f6098e2 (diff) | |
download | mongo-28418f3ea2f0534baebeb182f168748de65d0819.tar.gz |
stat help and cleaning
Diffstat (limited to 'tools')
-rw-r--r-- | tools/stat.cpp | 29 | ||||
-rw-r--r-- | tools/tool.cpp | 4 | ||||
-rw-r--r-- | tools/tool.h | 3 |
3 files changed, 29 insertions, 7 deletions
diff --git a/tools/stat.cpp b/tools/stat.cpp index dc1f14c679e..42fff99e3c0 100644 --- a/tools/stat.cpp +++ b/tools/stat.cpp @@ -60,6 +60,27 @@ namespace mongo { out << "sleep time: time to wait (in seconds) between calls" << endl; } + virtual void printExtraHelpAfter( ostream & out ){ + out << "\n"; + out << " Fields\n"; + out << " inserts/s \t- # of inserts per second\n"; + out << " query/s \t- # of queries per second\n"; + out << " update/s \t- # of updates per second\n"; + out << " delete/s \t- # of deletes per second\n"; + out << " getmore/s \t- # of get mores (cursor batch) per second\n"; + out << " command/s \t- # of commands per second\n"; + out << " flushes/s \t- # of fsync flushes per second\n"; + out << " mapped \t- amount of data mmaped (total data size) megabytes\n"; + out << " visze \t- virtual size of process in megabytes\n"; + out << " res \t- resident size of process in megabytes\n"; + out << " faults/s \t- # of pages faults/sec (linux only)\n"; + out << " locked \t- percent of time in global write lock\n"; + out << " idx miss \t- percent of btree page misses (sampled)\n"; + out << " q t|r|w \t- lock queue lengths (total|read|write)\n"; + out << " conn \t- number of open connections\n"; + } + + BSONObj stats(){ if ( _http ){ HttpClient c; @@ -109,7 +130,9 @@ namespace mongo { double y = ( b.getFieldDotted( outof ).number() - a.getFieldDotted( outof ).number() ); if ( y == 0 ) return 0; - return x / y; + double p = x / y; + p = (double)((int)(p * 1000)) / 10; + return p; } void cellstart( stringstream& ss , string name , unsigned& width ){ @@ -173,8 +196,8 @@ namespace mongo { cell( ss , "faults/s" , 6 , (int)diff( "page_faults" , ax , bx ) ); } - cell( ss , "% locked" , 8 , percent( "globalLock.totalTime" , "globalLock.lockTime" , a , b ) ); - cell( ss , "% idx miss" , 8 , percent( "indexCounters.btree.accesses" , "indexCounters.btree.misses" , a , b ) ); + cell( ss , "locked %" , 8 , percent( "globalLock.totalTime" , "globalLock.lockTime" , a , b ) ); + cell( ss , "idx miss %" , 8 , percent( "indexCounters.btree.accesses" , "indexCounters.btree.misses" , a , b ) ); if ( b.getFieldDotted( "globalLock.currentQueue" ).type() == Object ){ int r = b.getFieldDotted( "globalLock.currentQueue.readers" ).numberInt(); diff --git a/tools/tool.cpp b/tools/tool.cpp index 9b2c6563607..ee3e2baca54 100644 --- a/tools/tool.cpp +++ b/tools/tool.cpp @@ -76,12 +76,10 @@ namespace mongo { delete _conn; } - void Tool::printExtraHelp( ostream & out ){ - } - void Tool::printHelp(ostream &out) { printExtraHelp(out); _options->print(out); + printExtraHelpAfter(out); } int Tool::main( int argc , char ** argv ){ diff --git a/tools/tool.h b/tools/tool.h index 29dee010409..900c02f2205 100644 --- a/tools/tool.h +++ b/tools/tool.h @@ -79,7 +79,8 @@ namespace mongo { virtual void printHelp(ostream &out); - virtual void printExtraHelp( ostream & out ); + virtual void printExtraHelp( ostream & out ){} + virtual void printExtraHelpAfter( ostream & out ){} protected: |