summaryrefslogtreecommitdiff
path: root/src/monitor
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2013-04-06 13:14:45 +0200
committerPaul Buetow <paul@buetow.org>2013-04-06 13:14:45 +0200
commit9dcec1feba68dc5ba38cdc634f5bf113c0f77348 (patch)
tree1d3b0191f4377b0b93ebc67b989e4b8a4f9c3671 /src/monitor
parentd34015c5ba231b95de20e9fcd7a33c5b2b9a1006 (diff)
tagging yhttpd-0.7.2yhttpd-0.7.2
Diffstat (limited to 'src/monitor')
-rw-r--r--src/monitor/dump.cpp38
-rw-r--r--src/monitor/dump.h31
-rw-r--r--src/monitor/stats.cpp48
-rw-r--r--src/monitor/stats.h13
4 files changed, 22 insertions, 108 deletions
diff --git a/src/monitor/dump.cpp b/src/monitor/dump.cpp
index 71cc862..6b49bfe 100644
--- a/src/monitor/dump.cpp
+++ b/src/monitor/dump.cpp
@@ -8,13 +8,13 @@ using namespace std;
const string dumpable::s_sep = "->";
const int dumpable::i_max_level = 100;
-dumpable::dumpable()
+dumpable::dumpable()
{
initialize(0);
}
void
-dumpable::initialize(int i_level)
+dumpable::initialize(int i_level)
{
this->i_level = i_level;
this->i_lined = i_level;
@@ -24,13 +24,13 @@ dumpable::initialize(int i_level)
}
string
-dumpable::dump()
+dumpable::dump()
{
return dump(0);
}
string
-dumpable::dump(int i_level)
+dumpable::dump(int i_level)
{
initialize(i_level);
dumpit();
@@ -38,37 +38,34 @@ dumpable::dump(int i_level)
}
void
-dumpable::add
- (string s_line)
+dumpable::add(string s_line)
{
if ( i_lined > i_max_level )
i_lined = i_max_level;
- if (!b_lined)
+ if (!b_lined)
s_dump.append(s_sep);
- else
- for ( int i = 0; i < i_lined; ++i )
- s_dump.append(" ");
+ else for ( int i = 0; i < i_lined; ++i )
+ s_dump.append(" ");
s_dump.append(s_line);
- if (b_next_no_nl)
+ if (b_next_no_nl)
b_next_no_nl = false;
else
s_dump.append("\n");
- if (!b_lined)
- {
+ if (!b_lined) {
b_lined = true;
i_lined = i_level + s_sep.length();
}
}
int
-dumpable::get_level() const
-{
+dumpable::get_level() const
+{
return i_lined;
}
@@ -77,7 +74,6 @@ dump::dump(vector<string> vec_params)
if (vec_params.empty())
{
cout << CLIPRMO << "all conf sock";
- cout << " chat modl sman"; //<< Not for yhttpd
cout << endl;
return;
}
@@ -102,16 +98,6 @@ dump::run(vector<string> &vec_params)
if (!s_part.compare("sock") || !s_part.compare("all"))
s_ret.append(wrap::SOCK->dump());
- //<<*
- if (!s_part.compare("modl") || !s_part.compare("all"))
- s_ret.append(wrap::MODL->dump());
-
- if (!s_part.compare("sman") || !s_part.compare("all"))
- s_ret.append(wrap::SMAN->dump());
-
- if (!s_part.compare("chat") || !s_part.compare("all"))
- s_ret.append(wrap::CHAT->dump());
- //*>>
}
return s_ret;
diff --git a/src/monitor/dump.h b/src/monitor/dump.h
index ffb3529..8e84cb1 100644
--- a/src/monitor/dump.h
+++ b/src/monitor/dump.h
@@ -15,35 +15,24 @@ private:
string s_dump;
static const string s_sep;
- static const int i_max_level;
+ static const int i_max_level;
virtual void dumpit() = 0;
void initialize(int i_level);
void reset();
protected:
- void add
- (unsigned i_num)
- {
- add
- ("<unsigned>");
- }
-
- void add
- (int i_num)
- {
- add
- ("<int>");
- }
-
- void add
- (string s_line);
+ void add(unsigned i_num)
+ { add("<unsigned>"); }
+
+ void add(int i_num)
+ { add("<int>"); }
+
+ void add(string s_line);
dumpable();
- void next_no_newline()
- {
- b_next_no_nl = true;
- }
+ void next_no_newline()
+ { b_next_no_nl = true; }
public:
string dump();
diff --git a/src/monitor/stats.cpp b/src/monitor/stats.cpp
index 5d5cc39..e0aa146 100644
--- a/src/monitor/stats.cpp
+++ b/src/monitor/stats.cpp
@@ -10,17 +10,14 @@ stats::stats()
i_rusage_vec_size = tool::string2int(
wrap::CONF->get_elem("httpd.stats.rusagehistory"));
- i_num_rooms = 0; //<<
pthread_mutex_init( &mut_vec_rusage, NULL );
- pthread_mutex_init( &mut_num_rooms, NULL ); //<<
}
stats::~stats()
{
pthread_mutex_destroy( &mut_vec_rusage );
- pthread_mutex_destroy( &mut_num_rooms ); //<<
}
void
@@ -101,50 +98,5 @@ stats::get_rusage_history( string s_type, string s_seperator )
return s_ret;
}
-//<<*
-int
-stats::get_num_rooms()
-{
- pthread_mutex_lock ( &mut_num_rooms );
- int i_ret = i_num_rooms;
- pthread_mutex_unlock( &mut_num_rooms );
- return i_ret;
-}
-
-void
-stats::increment_num_rooms()
-{
- pthread_mutex_lock ( &mut_num_rooms );
- ++i_num_rooms;
- pthread_mutex_unlock( &mut_num_rooms );
-#ifdef NCURSES
-
- print_num_rooms();
-#endif
-}
-void
-stats::decrement_num_rooms()
-{
- pthread_mutex_lock ( &mut_num_rooms );
- --i_num_rooms;
- pthread_mutex_unlock( &mut_num_rooms );
-#ifdef NCURSES
-
- print_num_rooms();
-#endif
-}
-
-#ifdef NCURSES
-void
-stats::print_num_rooms()
-{
- if ( !wrap::NCUR->is_ready() )
- return;
-
- mvprintw( NCUR_NUM_ROOMS_X, NCUR_NUM_ROOMS_Y, "Rooms: %d", get_num_rooms());
- refresh();
-}
-#endif
-//*>>
#endif
diff --git a/src/monitor/stats.h b/src/monitor/stats.h
index 231d876..0478258 100644
--- a/src/monitor/stats.h
+++ b/src/monitor/stats.h
@@ -21,8 +21,6 @@ private:
vector< map<string,long> > vec_rusage_history;
pthread_mutex_t mut_vec_rusage;
- int i_num_rooms; //<<
- pthread_mutex_t mut_num_rooms; //<<
void set_rusage_vec_size( int i_rusage_vec_size );
@@ -30,20 +28,9 @@ public:
stats( );
~stats( );
- //<<*
- int get_num_rooms();
- void increment_num_rooms();
- void decrement_num_rooms();
- //*>>
void update_rusage_history();
string get_rusage_history( string s_type, string s_seperator );
long get_ru_maxrss();
- //<<*
-#ifdef NCURSES
-
- void print_num_rooms();
-#endif
- //*>>
};
#endif