git-svn-id: svn://db.shs.com.ru/pip@186 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5

This commit is contained in:
2016-03-02 08:09:01 +00:00
parent 0d77d3b425
commit 741615b9d3
11 changed files with 104 additions and 19 deletions

View File

@@ -18,6 +18,7 @@
*/
#include "piintrospection.h"
#include "pisysteminfo.h"
PIIntrospectionContainers::PIIntrospectionContainers() {
@@ -32,6 +33,7 @@ PIIntrospectionThreads::PIIntrospectionThreads() {
PIIntrospectionContainers * __PIIntrospectionContainers__::p = 0;
PIIntrospectionThreads * __PIIntrospectionThreads__::p = 0;
PIIntrospectionServer * __PIIntrospectionServer__::p = 0;
void PIIntrospectionThreads::registerThread(int id, short prior, const PIString & name) {
@@ -92,3 +94,25 @@ void PIIntrospectionContainers::containerUnused(ullong cnt) {
bytes_used -= cnt;
mutex.unlock();
}
PIIntrospectionServer::PIIntrospectionServer(): PIPeer(genName()) {
CONNECTU(&timer, tickEvent, this, timerEvent)
timer.start(100);
}
PIString PIIntrospectionServer::genName() {
randomize();
return "__introspection__server_" + PIString::fromNumber(rand() % 1000);
}
void PIIntrospectionServer::timerEvent() {
PIByteArray ba;
PIINTROSPECTION_THREADS->mutex.lock();
ba << appname << *(PIINTROSPECTION_CONTAINERS) << PIINTROSPECTION_THREADS->threads.values();
PIINTROSPECTION_THREADS->mutex.unlock();
//piCout << "send" << appname;
send("__introspection_client__", ba);
}