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

This commit is contained in:
2019-06-26 17:01:34 +00:00
parent 19d4ab94b9
commit d3b9155594
13 changed files with 74 additions and 29 deletions

View File

@@ -29,6 +29,7 @@ class PITimer;
class PIPeer; class PIPeer;
class PIIntrospection; class PIIntrospection;
#ifdef PIP_INTROSPECTION
#define __PIINTROSPECTION_SINGLETON_H__(T) \ #define __PIINTROSPECTION_SINGLETON_H__(T) \
static PIIntrospection##T##Interface * instance(); static PIIntrospection##T##Interface * instance();
@@ -37,5 +38,5 @@ class PIIntrospection;
static PIIntrospection##T##Interface ret;\ static PIIntrospection##T##Interface ret;\
return &ret;\ return &ret;\
} }
#endif // PIP_INTROSPECTION
#endif // PIINTROSPECTION_BASE_H #endif // PIINTROSPECTION_BASE_H

View File

@@ -20,6 +20,8 @@
#include "piintrospection_containers.h" #include "piintrospection_containers.h"
#include "piintrospection_containers_p.h" #include "piintrospection_containers_p.h"
#ifdef PIP_INTROSPECTION
__PIINTROSPECTION_SINGLETON_CPP__(Containers) __PIINTROSPECTION_SINGLETON_CPP__(Containers)
@@ -61,3 +63,5 @@ void PIIntrospectionContainersInterface::containerUsed(const char * tn, ullong c
void PIIntrospectionContainersInterface::containerUnused(const char * tn, ullong cnt) { void PIIntrospectionContainersInterface::containerUnused(const char * tn, ullong cnt) {
p->containerUnused(tn, cnt); p->containerUnused(tn, cnt);
} }
#endif

View File

@@ -22,9 +22,6 @@
#include "piintrospection_base.h" #include "piintrospection_base.h"
class PIIntrospectionContainers;
#define PIINTROSPECTION_CONTAINERS (PIIntrospectionContainersInterface::instance())//(PIIntrospectionContainersInterface::instance())
//#if defined(__PIIS__) //#if defined(__PIIS__)
//# undef __PIIS__ //# undef __PIIS__
@@ -32,6 +29,12 @@ class PIIntrospectionContainers;
//# if defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION) //# if defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION)
//#endif //#endif
#if defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION)
class PIIntrospectionContainers;
#define PIINTROSPECTION_CONTAINERS (PIIntrospectionContainersInterface::instance())//(PIIntrospectionContainersInterface::instance())
#ifdef CC_GCC #ifdef CC_GCC
# include <typeinfo> # include <typeinfo>
# define _PIIS_TYPENAME_(t) typeid(t).name() # define _PIIS_TYPENAME_(t) typeid(t).name()
@@ -39,21 +42,12 @@ class PIIntrospectionContainers;
# define _PIIS_TYPENAME_(t) "" # define _PIIS_TYPENAME_(t) ""
#endif #endif
#if defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION)
# define PIINTROSPECTION_CONTAINER_NEW(t) PIINTROSPECTION_CONTAINERS->containerNew (_PIIS_TYPENAME_(t)); # define PIINTROSPECTION_CONTAINER_NEW(t) PIINTROSPECTION_CONTAINERS->containerNew (_PIIS_TYPENAME_(t));
# define PIINTROSPECTION_CONTAINER_DELETE(t) PIINTROSPECTION_CONTAINERS->containerDelete(_PIIS_TYPENAME_(t)); # define PIINTROSPECTION_CONTAINER_DELETE(t) PIINTROSPECTION_CONTAINERS->containerDelete(_PIIS_TYPENAME_(t));
# define PIINTROSPECTION_CONTAINER_ALLOC(t, cnt) PIINTROSPECTION_CONTAINERS->containerAlloc (_PIIS_TYPENAME_(t), cnt); # define PIINTROSPECTION_CONTAINER_ALLOC(t, cnt) PIINTROSPECTION_CONTAINERS->containerAlloc (_PIIS_TYPENAME_(t), cnt);
# define PIINTROSPECTION_CONTAINER_FREE(t, cnt) PIINTROSPECTION_CONTAINERS->containerFree (_PIIS_TYPENAME_(t), cnt); # define PIINTROSPECTION_CONTAINER_FREE(t, cnt) PIINTROSPECTION_CONTAINERS->containerFree (_PIIS_TYPENAME_(t), cnt);
# define PIINTROSPECTION_CONTAINER_USED(t, cnt) PIINTROSPECTION_CONTAINERS->containerUsed (_PIIS_TYPENAME_(t), cnt); # define PIINTROSPECTION_CONTAINER_USED(t, cnt) PIINTROSPECTION_CONTAINERS->containerUsed (_PIIS_TYPENAME_(t), cnt);
# define PIINTROSPECTION_CONTAINER_UNUSED(t, cnt) PIINTROSPECTION_CONTAINERS->containerUnused(_PIIS_TYPENAME_(t), cnt); # define PIINTROSPECTION_CONTAINER_UNUSED(t, cnt) PIINTROSPECTION_CONTAINERS->containerUnused(_PIIS_TYPENAME_(t), cnt);
#else
# define PIINTROSPECTION_CONTAINER_NEW(t)
# define PIINTROSPECTION_CONTAINER_DELETE(t)
# define PIINTROSPECTION_CONTAINER_ALLOC(t, cnt)
# define PIINTROSPECTION_CONTAINER_FREE(t, cnt)
# define PIINTROSPECTION_CONTAINER_USED(t, cnt)
# define PIINTROSPECTION_CONTAINER_UNUSED(t, cnt)
#endif
class PIP_EXPORT PIIntrospectionContainersInterface { class PIP_EXPORT PIIntrospectionContainersInterface {
@@ -78,4 +72,15 @@ private:
}; };
#else
# define PIINTROSPECTION_CONTAINER_NEW(t)
# define PIINTROSPECTION_CONTAINER_DELETE(t)
# define PIINTROSPECTION_CONTAINER_ALLOC(t, cnt)
# define PIINTROSPECTION_CONTAINER_FREE(t, cnt)
# define PIINTROSPECTION_CONTAINER_USED(t, cnt)
# define PIINTROSPECTION_CONTAINER_UNUSED(t, cnt)
#endif
#endif // PIINTROSPECTION_CONTAINERS_H #endif // PIINTROSPECTION_CONTAINERS_H

View File

@@ -17,6 +17,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifdef PIP_INTROSPECTION
#include "piintrospection_containers_p.h" #include "piintrospection_containers_p.h"
#include <stdio.h> #include <stdio.h>
@@ -111,3 +113,5 @@ PIByteArray & operator >>(PIByteArray & s, PIIntrospectionContainers::Type & v)
s >> v.count >> v.items >> v.bytes_allocated >> v.bytes_used; s >> v.count >> v.items >> v.bytes_allocated >> v.bytes_used;
return s; return s;
} }
#endif //PIP_INTROSPECTION

View File

@@ -20,6 +20,8 @@
#ifndef PIINTROSPECTION_CONTAINERS_P_H #ifndef PIINTROSPECTION_CONTAINERS_P_H
#define PIINTROSPECTION_CONTAINERS_P_H #define PIINTROSPECTION_CONTAINERS_P_H
#ifdef PIP_INTROSPECTION
#include "pimutex.h" #include "pimutex.h"
#include <unordered_map> #include <unordered_map>
#include <string> #include <string>
@@ -58,4 +60,5 @@ PIByteArray & operator <<(PIByteArray & s, const std::unordered_map<uint, std::s
PIByteArray & operator <<(PIByteArray & s, const PIIntrospectionContainers::Type & v); PIByteArray & operator <<(PIByteArray & s, const PIIntrospectionContainers::Type & v);
PIByteArray & operator >>(PIByteArray & s, PIIntrospectionContainers::Type & v); PIByteArray & operator >>(PIByteArray & s, PIIntrospectionContainers::Type & v);
#endif // PIP_INTROSPECTION
#endif // PIINTROSPECTION_CONTAINERS_P_H #endif // PIINTROSPECTION_CONTAINERS_P_H

View File

@@ -17,6 +17,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifdef PIP_INTROSPECTION
#include "piintrospection_server.h" #include "piintrospection_server.h"
#include "piintrospection_server_p.h" #include "piintrospection_server_p.h"
#include "pichunkstream.h" #include "pichunkstream.h"
@@ -69,3 +71,6 @@ void PIIntrospectionServer::dataReceived(const PIString & from, const PIByteArra
ba.append(cs.data()); ba.append(cs.data());
send(from, ba); send(from, ba);
} }
#endif // PIP_INTROSPECTION

View File

@@ -20,17 +20,15 @@
#ifndef PIINTROSPECTION_SERVER_H #ifndef PIINTROSPECTION_SERVER_H
#define PIINTROSPECTION_SERVER_H #define PIINTROSPECTION_SERVER_H
#include "pipeer.h" #include "pipeer.h"
#if defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION)
class PIIntrospectionServer; class PIIntrospectionServer;
#define PIINTROSPECTION_SERVER (PIIntrospectionServer::instance()) # define PIINTROSPECTION_SERVER (PIIntrospectionServer::instance())
#if defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION)
# define PIINTROSPECTION_START PIINTROSPECTION_SERVER->start(); # define PIINTROSPECTION_START PIINTROSPECTION_SERVER->start();
#else
# define PIINTROSPECTION_START
#endif
class PIP_EXPORT PIIntrospectionServer: public PIPeer { class PIP_EXPORT PIIntrospectionServer: public PIPeer {
PIOBJECT_SUBCLASS(PIIntrospectionServer, PIPeer) PIOBJECT_SUBCLASS(PIIntrospectionServer, PIPeer)
@@ -51,4 +49,8 @@ private:
PITimer itimer; PITimer itimer;
}; };
#else
# define PIINTROSPECTION_START
#endif
#endif // PIINTROSPECTION_SERVER_H #endif // PIINTROSPECTION_SERVER_H

View File

@@ -17,6 +17,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifdef PIP_INTROSPECTION
#include "piintrospection_server_p.h" #include "piintrospection_server_p.h"
#include "pichunkstream.h" #include "pichunkstream.h"
#include "piinit.h" #include "piinit.h"
@@ -237,3 +239,5 @@ void PIIntrospection::unpackObjects(PIByteArray & ba, PIVector<PIIntrospection::
objects.clear(); objects.clear();
ba >> objects; ba >> objects;
} }
#endif // PIP_INTROSPECTION

View File

@@ -20,6 +20,8 @@
#ifndef PIINTROSPECTION_SERVER_P_H #ifndef PIINTROSPECTION_SERVER_P_H
#define PIINTROSPECTION_SERVER_P_H #define PIINTROSPECTION_SERVER_P_H
#ifdef PIP_INTROSPECTION
#include "piintrospection_containers.h" #include "piintrospection_containers.h"
#include "piintrospection_containers_p.h" #include "piintrospection_containers_p.h"
#include "piintrospection_threads.h" #include "piintrospection_threads.h"
@@ -91,4 +93,5 @@ PIByteArray & operator >>(PIByteArray & b, PIIntrospection::ProcessInfo & v);
PIByteArray & operator <<(PIByteArray & b, const PIIntrospection::ObjectInfo & v); PIByteArray & operator <<(PIByteArray & b, const PIIntrospection::ObjectInfo & v);
PIByteArray & operator >>(PIByteArray & b, PIIntrospection::ObjectInfo & v); PIByteArray & operator >>(PIByteArray & b, PIIntrospection::ObjectInfo & v);
#endif // PIP_INTROSPECTION
#endif // PIINTROSPECTION_SERVER_P_H #endif // PIINTROSPECTION_SERVER_P_H

View File

@@ -17,6 +17,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifdef PIP_INTROSPECTION
#include "piintrospection_threads.h" #include "piintrospection_threads.h"
#include "piintrospection_threads_p.h" #include "piintrospection_threads_p.h"
@@ -66,3 +68,5 @@ void PIIntrospectionThreadsInterface::threadStop(PIThread * t) {
void PIIntrospectionThreadsInterface::threadRunDone(PIThread * t, ullong us) { void PIIntrospectionThreadsInterface::threadRunDone(PIThread * t, ullong us) {
p->threadRunDone(t, us); p->threadRunDone(t, us);
} }
#endif // PIP_INTROSPECTION

View File

@@ -22,11 +22,13 @@
#include "piintrospection_base.h" #include "piintrospection_base.h"
#if defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION)
class PIIntrospectionThreads; class PIIntrospectionThreads;
#define PIINTROSPECTION_THREADS (PIIntrospectionThreadsInterface::instance()) #define PIINTROSPECTION_THREADS (PIIntrospectionThreadsInterface::instance())
#if defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION)
# define PIINTROSPECTION_THREAD_NEW(t) PIINTROSPECTION_THREADS->threadNew (t); # define PIINTROSPECTION_THREAD_NEW(t) PIINTROSPECTION_THREADS->threadNew (t);
# define PIINTROSPECTION_THREAD_DELETE(t) PIINTROSPECTION_THREADS->threadDelete (t); # define PIINTROSPECTION_THREAD_DELETE(t) PIINTROSPECTION_THREADS->threadDelete (t);
# define PIINTROSPECTION_THREAD_START(t) PIINTROSPECTION_THREADS->threadStart (t); # define PIINTROSPECTION_THREAD_START(t) PIINTROSPECTION_THREADS->threadStart (t);
@@ -34,15 +36,6 @@ class PIIntrospectionThreads;
# define PIINTROSPECTION_THREAD_WAIT(t) PIINTROSPECTION_THREADS->threadWait (t); # define PIINTROSPECTION_THREAD_WAIT(t) PIINTROSPECTION_THREADS->threadWait (t);
# define PIINTROSPECTION_THREAD_STOP(t) PIINTROSPECTION_THREADS->threadStop (t); # define PIINTROSPECTION_THREAD_STOP(t) PIINTROSPECTION_THREADS->threadStop (t);
# define PIINTROSPECTION_THREAD_RUN_DONE(t,us) PIINTROSPECTION_THREADS->threadRunDone(t,us); # define PIINTROSPECTION_THREAD_RUN_DONE(t,us) PIINTROSPECTION_THREADS->threadRunDone(t,us);
#else
# define PIINTROSPECTION_THREAD_NEW(t)
# define PIINTROSPECTION_THREAD_DELETE(t)
# define PIINTROSPECTION_THREAD_START(t)
# define PIINTROSPECTION_THREAD_RUN(t)
# define PIINTROSPECTION_THREAD_WAIT(t)
# define PIINTROSPECTION_THREAD_STOP(t)
# define PIINTROSPECTION_THREAD_RUN_DONE(t,us)
#endif
class PIP_EXPORT PIIntrospectionThreadsInterface { class PIP_EXPORT PIIntrospectionThreadsInterface {
friend class PIIntrospection; friend class PIIntrospection;
@@ -65,4 +58,14 @@ private:
}; };
#else
# define PIINTROSPECTION_THREAD_NEW(t)
# define PIINTROSPECTION_THREAD_DELETE(t)
# define PIINTROSPECTION_THREAD_START(t)
# define PIINTROSPECTION_THREAD_RUN(t)
# define PIINTROSPECTION_THREAD_WAIT(t)
# define PIINTROSPECTION_THREAD_STOP(t)
# define PIINTROSPECTION_THREAD_RUN_DONE(t,us)
#endif
#endif // PIINTROSPECTION_THREADS_H #endif // PIINTROSPECTION_THREADS_H

View File

@@ -17,6 +17,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifdef PIP_INTROSPECTION
#include "piintrospection_threads_p.h" #include "piintrospection_threads_p.h"
@@ -98,3 +100,5 @@ PIByteArray & operator >>(PIByteArray & b, PIIntrospectionThreads::ThreadInfo &
v.state = (PIIntrospectionThreads::ThreadState)st; v.state = (PIIntrospectionThreads::ThreadState)st;
return b; return b;
} }
#endif // PIP_INTROSPECTION

View File

@@ -20,6 +20,8 @@
#ifndef PIINTROSPECTION_THREADS_P_H #ifndef PIINTROSPECTION_THREADS_P_H
#define PIINTROSPECTION_THREADS_P_H #define PIINTROSPECTION_THREADS_P_H
#ifdef PIP_INTROSPECTION
#include "pimap.h" #include "pimap.h"
#include "pithread.h" #include "pithread.h"
@@ -60,4 +62,5 @@ public:
PIByteArray & operator <<(PIByteArray & b, const PIIntrospectionThreads::ThreadInfo & v); PIByteArray & operator <<(PIByteArray & b, const PIIntrospectionThreads::ThreadInfo & v);
PIByteArray & operator >>(PIByteArray & b, PIIntrospectionThreads::ThreadInfo & v); PIByteArray & operator >>(PIByteArray & b, PIIntrospectionThreads::ThreadInfo & v);
#endif // PIP_INTROSPECTION
#endif // PIINTROSPECTION_THREADS_P_H #endif // PIINTROSPECTION_THREADS_P_H