summaryrefslogtreecommitdiff
path: root/0.8/src/monitor
diff options
context:
space:
mode:
Diffstat (limited to '0.8/src/monitor')
-rw-r--r--0.8/src/monitor/dump.cpp145
-rw-r--r--0.8/src/monitor/dump.h87
-rw-r--r--0.8/src/monitor/stats.cpp139
-rw-r--r--0.8/src/monitor/stats.h66
4 files changed, 0 insertions, 437 deletions
diff --git a/0.8/src/monitor/dump.cpp b/0.8/src/monitor/dump.cpp
deleted file mode 100644
index e249767..0000000
--- a/0.8/src/monitor/dump.cpp
+++ /dev/null
@@ -1,145 +0,0 @@
-/*:*
- *: File: ./src/monitor/dump.cpp
- *:
- *: yChat; Homepage: ychat.buetow.org; Version 0.9.0-CURRENT
- *:
- *: Copyright (C) 2003 Paul C. Buetow, Volker Richter
- *: Copyright (C) 2004 Paul C. Buetow
- *: Copyright (C) 2005 EXA Digital Solutions GbR
- *: Copyright (C) 2006, 2007 Paul C. Buetow
- *:
- *: This program is free software; you can redistribute it and/or
- *: modify it under the terms of the GNU General Public License
- *: as published by the Free Software Foundation; either version 2
- *: of the License, or (at your option) any later version.
- *:
- *: This program is distributed in the hope that it will be useful,
- *: but WITHOUT ANY WARRANTY; without even the implied warranty of
- *: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *: GNU General Public License for more details.
- *:
- *: You should have received a copy of the GNU General Public License
- *: along with this program; if not, write to the Free Software
- *: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *:*/
-
-#ifndef DUMP_CPP
-#define DUMP_CPP
-
-#include "dump.h"
-
-using namespace std;
-
-const string dumpable::s_sep = "->";
-const int dumpable::i_max_level = 100;
-
-dumpable::dumpable()
-{
- initialize(0);
-}
-
-void
-dumpable::initialize(int i_level)
-{
- this->i_level = i_level;
- this->i_lined = i_level;
- this->b_lined = false;
- this->b_next_no_nl = false;
- this->s_dump = "";
-}
-
-string
-dumpable::dump()
-{
- return dump(0);
-}
-
-string
-dumpable::dump(int i_level)
-{
- initialize(i_level);
- dumpit();
- return s_dump;
-}
-
-void
-dumpable::add
-(string s_line)
-{
- if ( i_lined > i_max_level )
- i_lined = i_max_level;
-
- if (!b_lined)
- s_dump.append(s_sep);
-
- else
- for ( int i = 0; i < i_lined; ++i )
- s_dump.append(" ");
-
- s_dump.append(s_line);
-
- if (b_next_no_nl)
- b_next_no_nl = false;
-
- else
- s_dump.append("\n");
-
- if (!b_lined)
- {
- b_lined = true;
- i_lined = i_level + s_sep.length();
- }
-}
-
-int
-dumpable::get_level() const
-{
- return i_lined;
-}
-
-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;
- }
-
- cout << run(vec_params);
-}
-
-string
-dump::run(vector<string> &vec_params)
-{
- string s_ret("");
- string s_part;
-
- vector<string>::iterator iter;
- for (iter = vec_params.begin(); iter != vec_params.end(); ++iter)
- {
- s_part = *iter;
-
- if (!s_part.compare("conf") || !s_part.compare("all"))
- s_ret.append(wrap::CONF->dump());
-
- 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;
-}
-
-#endif
diff --git a/0.8/src/monitor/dump.h b/0.8/src/monitor/dump.h
deleted file mode 100644
index 7f4b59b..0000000
--- a/0.8/src/monitor/dump.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*:*
- *: File: ./src/monitor/dump.h
- *:
- *: yChat; Homepage: ychat.buetow.org; Version 0.9.0-CURRENT
- *:
- *: Copyright (C) 2003 Paul C. Buetow, Volker Richter
- *: Copyright (C) 2004 Paul C. Buetow
- *: Copyright (C) 2005 EXA Digital Solutions GbR
- *: Copyright (C) 2006, 2007 Paul C. Buetow
- *:
- *: This program is free software; you can redistribute it and/or
- *: modify it under the terms of the GNU General Public License
- *: as published by the Free Software Foundation; either version 2
- *: of the License, or (at your option) any later version.
- *:
- *: This program is distributed in the hope that it will be useful,
- *: but WITHOUT ANY WARRANTY; without even the implied warranty of
- *: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *: GNU General Public License for more details.
- *:
- *: You should have received a copy of the GNU General Public License
- *: along with this program; if not, write to the Free Software
- *: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *:*/
-
-#include "../incl.h"
-
-#ifndef DUMP_H
-#define DUMP_H
-
-using namespace std;
-
-class dumpable
-{
-private:
- int i_level;
- int i_lined;
- bool b_lined;
- bool b_next_no_nl;
- string s_dump;
-
- static const string s_sep;
- 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);
- dumpable();
-
- void next_no_newline()
- {
- b_next_no_nl = true;
- }
-
-public:
- string dump();
- string dump(int i_level);
- int get_level() const;
-};
-
-class dump
-{
-private:
- string run(vector<string> &vec_params);
-public:
- dump(vector<string> vec_params);
-};
-
-#endif
diff --git a/0.8/src/monitor/stats.cpp b/0.8/src/monitor/stats.cpp
deleted file mode 100644
index cd69673..0000000
--- a/0.8/src/monitor/stats.cpp
+++ /dev/null
@@ -1,139 +0,0 @@
-/*:*
- *: File: ./src/monitor/stats.cpp
- *:
- *: yChat; Homepage: ychat.buetow.org; Version 0.9.0-CURRENT
- *:
- *: Copyright (C) 2003 Paul C. Buetow, Volker Richter
- *: Copyright (C) 2004 Paul C. Buetow
- *: Copyright (C) 2005 EXA Digital Solutions GbR
- *: Copyright (C) 2006, 2007 Paul C. Buetow
- *:
- *: This program is free software; you can redistribute it and/or
- *: modify it under the terms of the GNU General Public License
- *: as published by the Free Software Foundation; either version 2
- *: of the License, or (at your option) any later version.
- *:
- *: This program is distributed in the hope that it will be useful,
- *: but WITHOUT ANY WARRANTY; without even the implied warranty of
- *: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *: GNU General Public License for more details.
- *:
- *: You should have received a copy of the GNU General Public License
- *: along with this program; if not, write to the Free Software
- *: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *:*/
-
-#ifndef STATS_CPP
-#define STATS_CPP
-
-#include "stats.h"
-
-using namespace std;
-
-stats::stats()
-{
- i_rusage_vec_size = tool::string2int(
- wrap::CONF->get_elem("httpd.stats.rusagehistory"));
-
- i_num_rooms = 0; //<<
-
-
-}
-
-stats::~stats()
-{}
-
-void
-stats::update_rusage_history()
-{
- wrap::system_message(STATUPR);
-
- rusage* p_rusage = new rusage;
- getrusage( RUSAGE_SELF, p_rusage );
-
- map<string,long> map_rusage;
-
- map_rusage["ru_maxrss"] = p_rusage->ru_maxrss;
- map_rusage["ru_ixrss"] = p_rusage->ru_ixrss;
- map_rusage["ru_idrss"] = p_rusage->ru_idrss;
- map_rusage["ru_isrss"] = p_rusage->ru_isrss;
- map_rusage["ru_minflt"] = p_rusage->ru_minflt;
- map_rusage["ru_majflt"] = p_rusage->ru_majflt;
- map_rusage["ru_nswap"] = p_rusage->ru_nswap;
- map_rusage["ru_inblock"] = p_rusage->ru_inblock;
- map_rusage["ru_oublock"] = p_rusage->ru_oublock;
- map_rusage["ru_msgsnd"] = p_rusage->ru_msgsnd;
- map_rusage["ru_msgrcv"] = p_rusage->ru_msgrcv;
- map_rusage["ru_nsignals"] = p_rusage->ru_nsignals;
- map_rusage["ru_nvcsw"] = p_rusage->ru_nvcsw;
- map_rusage["ru_nivcsw"] = p_rusage->ru_nivcsw;
-
- delete p_rusage;
-
-
- if ( vec_rusage_history.size() >= i_rusage_vec_size )
- vec_rusage_history.erase( vec_rusage_history.begin() );
-
- vec_rusage_history.push_back(map_rusage);
-
-}
-
-void
-stats::set_rusage_vec_size( int i_rusage_vec_size )
-{
- this->i_rusage_vec_size = i_rusage_vec_size;
-}
-
-long
-stats::get_ru_maxrss()
-{
- rusage* p_rusage = new rusage;
- getrusage( RUSAGE_SELF, p_rusage );
-
- long l_ret = p_rusage->ru_maxrss;
- delete p_rusage;
-
- return l_ret;
-}
-
-string
-stats::get_rusage_history( string s_type, string s_seperator )
-{
- string s_ret;
- int i_count = 0;
- vector< map<string,long> >::iterator iter;
-
-
- for ( iter = vec_rusage_history.begin();
- iter != vec_rusage_history.end();
- iter++, i_count++ )
- s_ret.append(s_seperator +
- tool::int2string(i_count) + ". " + iter->find(s_type)->first + " " +
- tool::int2string( iter->find(s_type)->second) + "\n");
-
-
- return s_ret;
-}
-
-//<<*
-int
-stats::get_num_rooms()
-{
- int i_ret = i_num_rooms;
- return i_ret;
-}
-
-void
-stats::increment_num_rooms()
-{
- ++i_num_rooms;
-}
-void
-stats::decrement_num_rooms()
-{
- --i_num_rooms;
-}
-
-//*>>
-
-#endif
diff --git a/0.8/src/monitor/stats.h b/0.8/src/monitor/stats.h
deleted file mode 100644
index 4b8aa13..0000000
--- a/0.8/src/monitor/stats.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*:*
- *: File: ./src/monitor/stats.h
- *:
- *: yChat; Homepage: ychat.buetow.org; Version 0.9.0-CURRENT
- *:
- *: Copyright (C) 2003 Paul C. Buetow, Volker Richter
- *: Copyright (C) 2004 Paul C. Buetow
- *: Copyright (C) 2005 EXA Digital Solutions GbR
- *: Copyright (C) 2006, 2007 Paul C. Buetow
- *:
- *: This program is free software; you can redistribute it and/or
- *: modify it under the terms of the GNU General Public License
- *: as published by the Free Software Foundation; either version 2
- *: of the License, or (at your option) any later version.
- *:
- *: This program is distributed in the hope that it will be useful,
- *: but WITHOUT ANY WARRANTY; without even the implied warranty of
- *: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *: GNU General Public License for more details.
- *:
- *: You should have received a copy of the GNU General Public License
- *: along with this program; if not, write to the Free Software
- *: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *:*/
-
-#include "../incl.h"
-
-#ifndef STATS_H
-#define STATS_H
-
-#include "../tool/tool.h"
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-
-using namespace std;
-
-class stats
-{
-private:
- // Specifies the max. amount of elements in vec_rusage_history;
- int i_rusage_vec_size;
- // History of the last i_rusage_vec_size rusage values.
- vector< map<string,long> > vec_rusage_history;
-
- int i_num_rooms; //<<
-
- void set_rusage_vec_size( int i_rusage_vec_size );
-
-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();
-};
-
-#endif