From 865f6fc91e448c4a6d50698e41ccc02393fb9c06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D0=B5=D0=BB=D0=B8=D0=BF=D0=B5=D0=BD=D0=BA=D0=BE=20?= =?UTF-8?q?=D0=98=D0=B2=D0=B0=D0=BD?= Date: Thu, 27 Jun 2019 15:24:21 +0000 Subject: [PATCH] git-svn-id: svn://db.shs.com.ru/pip@824 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5 --- src_main/containers/pideque.h | 36 +++++----- src_main/containers/pivector.h | 34 ++++----- .../piintrospection_containers.cpp | 4 +- .../piintrospection_containers.h | 6 +- .../piintrospection_containers_p.cpp | 71 +++++++++++++------ .../piintrospection_containers_p.h | 33 +++++---- .../piintrospection_server_p.cpp | 21 +++--- .../introspection/piintrospection_server_p.h | 4 +- 8 files changed, 120 insertions(+), 89 deletions(-) diff --git a/src_main/containers/pideque.h b/src_main/containers/pideque.h index e17f2beb..b07a93eb 100755 --- a/src_main/containers/pideque.h +++ b/src_main/containers/pideque.h @@ -36,26 +36,26 @@ class PIDeque { public: inline PIDeque(): pid_data(0), pid_size(0), pid_rsize(0), pid_start(0) { //piCout << "PIDeque"; - PIINTROSPECTION_CONTAINER_NEW(T) + PIINTROSPECTION_CONTAINER_NEW(T, sizeof(T)) } inline PIDeque(const PIDeque & other): pid_data(0), pid_size(0), pid_rsize(0), pid_start(0) { - PIINTROSPECTION_CONTAINER_NEW(T) + PIINTROSPECTION_CONTAINER_NEW(T, sizeof(T)) alloc(other.pid_size, true); newT(pid_data + pid_start, other.pid_data + other.pid_start, pid_size); } inline PIDeque(const T * data, size_t size): pid_data(0), pid_size(0), pid_rsize(0), pid_start(0) { - PIINTROSPECTION_CONTAINER_NEW(T) + PIINTROSPECTION_CONTAINER_NEW(T, sizeof(T)) alloc(size, true); newT(pid_data + pid_start, data, pid_size); } inline PIDeque(size_t pid_size, const T & f = T()): pid_data(0), pid_size(0), pid_rsize(0), pid_start(0) { - PIINTROSPECTION_CONTAINER_NEW(T) + PIINTROSPECTION_CONTAINER_NEW(T, sizeof(T)) resize(pid_size, f); } inline virtual ~PIDeque() { //piCout << "~PIDeque"; PIINTROSPECTION_CONTAINER_DELETE(T) - PIINTROSPECTION_CONTAINER_FREE(T, (pid_rsize)*sizeof(T)) + PIINTROSPECTION_CONTAINER_FREE(T, (pid_rsize)) deleteT(pid_data + pid_start, pid_size); dealloc(); _reset(); @@ -206,7 +206,7 @@ public: inline PIDeque & clear() {resize(0); return *this;} inline PIDeque & fill(const T & f = T()) { deleteT(pid_data + pid_start, pid_size); - PIINTROSPECTION_CONTAINER_USED(T, pid_size*sizeof(T)) + PIINTROSPECTION_CONTAINER_USED(T, pid_size) for (size_t i = pid_start; i < pid_start + pid_size; ++i) elementNew(pid_data + i, f); return *this; @@ -225,7 +225,7 @@ public: if (new_size > pid_size) { size_t os = pid_size; alloc(new_size, true); - PIINTROSPECTION_CONTAINER_USED(T, (new_size-os)*sizeof(T)) + PIINTROSPECTION_CONTAINER_USED(T, (new_size-os)) for (size_t i = os + pid_start; i < new_size + pid_start; ++i) elementNew(pid_data + i, f); } return *this; @@ -257,7 +257,7 @@ public: if (index > 0) memmove((void*)(&(pid_data[pid_start])), (const void*)(&(pid_data[pid_start + 1])), index * sizeof(T)); } - PIINTROSPECTION_CONTAINER_USED(T, sizeof(T)) + PIINTROSPECTION_CONTAINER_USED(T, 1) elementNew(pid_data + pid_start + index, v); return *this; } @@ -337,7 +337,7 @@ public: inline PIDeque & push_back(const T & v) { alloc(pid_size + 1, true); - PIINTROSPECTION_CONTAINER_USED(T, sizeof(T)); + PIINTROSPECTION_CONTAINER_USED(T, 1); elementNew(pid_data + pid_start + pid_size - 1, v); return *this; } @@ -381,12 +381,12 @@ private: return (1 << t); } inline void newT(T * dst, const T * src, size_t s) { - PIINTROSPECTION_CONTAINER_USED(T, s*sizeof(T)) + PIINTROSPECTION_CONTAINER_USED(T, s) for (size_t i = 0; i < s; ++i) elementNew(dst + i, src[i]); } inline void deleteT(T * d, size_t sz) { - PIINTROSPECTION_CONTAINER_UNUSED(T, sz*sizeof(T)) + PIINTROSPECTION_CONTAINER_UNUSED(T, sz) if ((uchar*)d != 0) { for (size_t i = 0; i < sz; ++i) elementDelete(d[i]); @@ -427,7 +427,7 @@ private: pid_size = new_size; size_t as = asize(pid_start + new_size); if (as != pid_rsize) { - PIINTROSPECTION_CONTAINER_ALLOC(T, (as-pid_rsize)*sizeof(T)) + PIINTROSPECTION_CONTAINER_ALLOC(T, (as-pid_rsize)) T * p_d = (T*)(realloc((void*)(pid_data), as*sizeof(T))); assert(p_d); pid_data = p_d; @@ -442,7 +442,7 @@ private: if (as > pid_rsize) { T * td = (T*)(malloc(as * sizeof(T))); ssize_t ns = pid_start + as - pid_rsize; - PIINTROSPECTION_CONTAINER_ALLOC(T, (as-pid_rsize)*sizeof(T)) + PIINTROSPECTION_CONTAINER_ALLOC(T, (as-pid_rsize)) if (pid_rsize > 0 && pid_data != 0) { memcpy((void*)(td + ns), (const void*)(pid_data + pid_start), pid_size * sizeof(T)); dealloc(); @@ -463,21 +463,21 @@ private: }; #define __PIDEQUE_SIMPLE_TYPE__(T) \ - template<> inline void PIDeque::newT(T * dst, const T * src, size_t s) {PIINTROSPECTION_CONTAINER_USED(T, s*sizeof(T)); memcpy((void*)(dst), (const void*)(src), s * sizeof(T));} \ - template<> inline void PIDeque::deleteT(T *, size_t sz) {PIINTROSPECTION_CONTAINER_UNUSED(T, sz*sizeof(T));} \ + template<> inline void PIDeque::newT(T * dst, const T * src, size_t s) {PIINTROSPECTION_CONTAINER_USED(T, s); memcpy((void*)(dst), (const void*)(src), s * sizeof(T));} \ + template<> inline void PIDeque::deleteT(T *, size_t sz) {PIINTROSPECTION_CONTAINER_UNUSED(T, sz);} \ template<> inline void PIDeque::elementNew(T * to, const T & from) {(*to) = from;} \ template<> inline void PIDeque::elementDelete(T &) {;} \ template<> inline PIDeque & PIDeque::_resizeRaw(size_t new_size) { \ if (new_size > pid_size) { \ - PIINTROSPECTION_CONTAINER_USED(T, (new_size-pid_size)*sizeof(T)); \ + PIINTROSPECTION_CONTAINER_USED(T, (new_size-pid_size)); \ } \ if (new_size < pid_size) { \ - PIINTROSPECTION_CONTAINER_UNUSED(T, (pid_size-new_size)*sizeof(T)); \ + PIINTROSPECTION_CONTAINER_UNUSED(T, (pid_size-new_size)); \ } \ alloc(new_size, true); \ return *this; \ } \ - template<> inline PIDeque & PIDeque::clear() {PIINTROSPECTION_CONTAINER_UNUSED(T, pid_size*sizeof(T)); pid_size = 0; return *this;} \ + template<> inline PIDeque & PIDeque::clear() {PIINTROSPECTION_CONTAINER_UNUSED(T, pid_size); pid_size = 0; return *this;} \ template<> inline PIDeque & PIDeque::assign(size_t new_size, const T & f) {_resizeRaw(new_size); return fill(f);} diff --git a/src_main/containers/pivector.h b/src_main/containers/pivector.h index 8e1b1ab4..90584512 100755 --- a/src_main/containers/pivector.h +++ b/src_main/containers/pivector.h @@ -35,25 +35,25 @@ template class PIVector { public: inline PIVector(): piv_data(0), piv_size(0), piv_rsize(0) { - PIINTROSPECTION_CONTAINER_NEW(T) + PIINTROSPECTION_CONTAINER_NEW(T, sizeof(T)) } inline PIVector(const T * data, size_t size): piv_data(0), piv_size(0), piv_rsize(0) { - PIINTROSPECTION_CONTAINER_NEW(T) + PIINTROSPECTION_CONTAINER_NEW(T, sizeof(T)) alloc(size); newT(piv_data, data, piv_size); } inline PIVector(const PIVector & other): piv_data(0), piv_size(0), piv_rsize(0) { - PIINTROSPECTION_CONTAINER_NEW(T) + PIINTROSPECTION_CONTAINER_NEW(T, sizeof(T)) alloc(other.piv_size); newT(piv_data, other.piv_data, piv_size); } inline PIVector(size_t piv_size, const T & f = T()): piv_data(0), piv_size(0), piv_rsize(0) { - PIINTROSPECTION_CONTAINER_NEW(T) + PIINTROSPECTION_CONTAINER_NEW(T, sizeof(T)) resize(piv_size, f); } inline virtual ~PIVector() { PIINTROSPECTION_CONTAINER_DELETE(T) - PIINTROSPECTION_CONTAINER_FREE(T, (piv_rsize)*sizeof(T)) + PIINTROSPECTION_CONTAINER_FREE(T, (piv_rsize)) deleteT(piv_data, piv_size); dealloc(); _reset(); @@ -203,7 +203,7 @@ public: inline PIVector & clear() {resize(0); return *this;} inline PIVector & fill(const T & f = T()) { deleteT(piv_data, piv_size); - PIINTROSPECTION_CONTAINER_USED(T, piv_size*sizeof(T)) + PIINTROSPECTION_CONTAINER_USED(T, piv_size) for (size_t i = 0; i < piv_size; ++i) elementNew(piv_data + i, f); return *this; @@ -223,7 +223,7 @@ public: if (new_size > piv_size) { size_t os = piv_size; alloc(new_size); - PIINTROSPECTION_CONTAINER_USED(T, (new_size-os)*sizeof(T)) + PIINTROSPECTION_CONTAINER_USED(T, (new_size-os)) for (size_t i = os; i < new_size; ++i) elementNew(piv_data + i, f); } @@ -252,7 +252,7 @@ public: size_t os = piv_size - index - 1; memmove((void*)(&(piv_data[index + 1])), (const void*)(&(piv_data[index])), os * sizeof(T)); } - PIINTROSPECTION_CONTAINER_USED(T, sizeof(T)) + PIINTROSPECTION_CONTAINER_USED(T, 1) elementNew(piv_data + index, v); return *this; } @@ -319,7 +319,7 @@ public: inline PIVector & push_back(const T & v) { alloc(piv_size + 1); - PIINTROSPECTION_CONTAINER_USED(T, sizeof(T)); + PIINTROSPECTION_CONTAINER_USED(T, 1); elementNew(piv_data + piv_size - 1, v); return *this; } @@ -372,12 +372,12 @@ private: return (1 << t); } inline void newT(T * dst, const T * src, size_t s) { - PIINTROSPECTION_CONTAINER_USED(T, s*sizeof(T)) + PIINTROSPECTION_CONTAINER_USED(T, s) for (size_t i = 0; i < s; ++i) elementNew(dst + i, src[i]); } inline void deleteT(T * d, size_t sz) { - PIINTROSPECTION_CONTAINER_UNUSED(T, sz*sizeof(T)) + PIINTROSPECTION_CONTAINER_UNUSED(T, sz) if ((uchar*)d != 0) { for (size_t i = 0; i < sz; ++i) elementDelete(d[i]); @@ -397,7 +397,7 @@ private: piv_size = new_size; size_t as = asize(new_size); if (as == piv_rsize) return; - PIINTROSPECTION_CONTAINER_ALLOC(T, (as-piv_rsize)*sizeof(T)) + PIINTROSPECTION_CONTAINER_ALLOC(T, (as-piv_rsize)) T * p_d = (T*)(realloc((void*)(piv_data), as*sizeof(T))); assert(p_d); piv_data = p_d; @@ -410,21 +410,21 @@ private: #define __PIVECTOR_SIMPLE_TYPE__(T) \ - template<> inline void PIVector::newT(T * dst, const T * src, size_t s) {PIINTROSPECTION_CONTAINER_USED(T, s*sizeof(T)); memcpy((void*)(dst), (const void*)(src), s * sizeof(T));} \ - template<> inline void PIVector::deleteT(T *, size_t sz) {PIINTROSPECTION_CONTAINER_UNUSED(T, sz*sizeof(T));} \ + template<> inline void PIVector::newT(T * dst, const T * src, size_t s) {PIINTROSPECTION_CONTAINER_USED(T, s); memcpy((void*)(dst), (const void*)(src), s * sizeof(T));} \ + template<> inline void PIVector::deleteT(T *, size_t sz) {PIINTROSPECTION_CONTAINER_UNUSED(T, sz);} \ template<> inline void PIVector::elementNew(T * to, const T & from) {(*to) = from;} \ template<> inline void PIVector::elementDelete(T &) {;} \ template<> inline PIVector & PIVector::_resizeRaw(size_t new_size) { \ if (new_size > piv_size) { \ - PIINTROSPECTION_CONTAINER_USED(T, (new_size-piv_size)*sizeof(T)); \ + PIINTROSPECTION_CONTAINER_USED(T, (new_size-piv_size)); \ } \ if (new_size < piv_size) { \ - PIINTROSPECTION_CONTAINER_UNUSED(T, (piv_size-new_size)*sizeof(T)); \ + PIINTROSPECTION_CONTAINER_UNUSED(T, (piv_size-new_size)); \ } \ alloc(new_size); \ return *this; \ } \ - template<> inline PIVector & PIVector::clear() {PIINTROSPECTION_CONTAINER_UNUSED(T, piv_size*sizeof(T)); piv_size = 0; return *this;} \ + template<> inline PIVector & PIVector::clear() {PIINTROSPECTION_CONTAINER_UNUSED(T, piv_size); piv_size = 0; return *this;} \ template<> inline PIVector & PIVector::assign(size_t new_size, const T & f) {_resizeRaw(new_size); return fill(f);} diff --git a/src_main/introspection/piintrospection_containers.cpp b/src_main/introspection/piintrospection_containers.cpp index f793d127..6799be98 100644 --- a/src_main/introspection/piintrospection_containers.cpp +++ b/src_main/introspection/piintrospection_containers.cpp @@ -35,8 +35,8 @@ PIIntrospectionContainersInterface::~PIIntrospectionContainersInterface() { } -void PIIntrospectionContainersInterface::containerNew(const char * tn) { - p->containerNew(tn); +void PIIntrospectionContainersInterface::containerNew(const char * tn, uint isz) { + p->containerNew(tn, isz); } diff --git a/src_main/introspection/piintrospection_containers.h b/src_main/introspection/piintrospection_containers.h index 9baffc77..66834d77 100644 --- a/src_main/introspection/piintrospection_containers.h +++ b/src_main/introspection/piintrospection_containers.h @@ -35,7 +35,7 @@ class PIIntrospectionContainers; # define _PIIS_TYPENAME_(t) "" #endif -# define PIINTROSPECTION_CONTAINER_NEW(t) PIINTROSPECTION_CONTAINERS->containerNew (_PIIS_TYPENAME_(t)); +# define PIINTROSPECTION_CONTAINER_NEW(t, isz) PIINTROSPECTION_CONTAINERS->containerNew (_PIIS_TYPENAME_(t), isz); # 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_FREE(t, cnt) PIINTROSPECTION_CONTAINERS->containerFree (_PIIS_TYPENAME_(t), cnt); @@ -49,7 +49,7 @@ class PIP_EXPORT PIIntrospectionContainersInterface { public: __PIINTROSPECTION_SINGLETON_H__(Containers) - void containerNew (const char * tn); + void containerNew (const char * tn, uint isz); void containerDelete(const char * tn); void containerAlloc (const char * tn, ullong cnt); void containerFree (const char * tn, ullong cnt); @@ -66,7 +66,7 @@ private: #else -# define PIINTROSPECTION_CONTAINER_NEW(t) +# define PIINTROSPECTION_CONTAINER_NEW(t, isz) # define PIINTROSPECTION_CONTAINER_DELETE(t) # define PIINTROSPECTION_CONTAINER_ALLOC(t, cnt) # define PIINTROSPECTION_CONTAINER_FREE(t, cnt) diff --git a/src_main/introspection/piintrospection_containers_p.cpp b/src_main/introspection/piintrospection_containers_p.cpp index 024d1ebb..07b970a1 100644 --- a/src_main/introspection/piintrospection_containers_p.cpp +++ b/src_main/introspection/piintrospection_containers_p.cpp @@ -20,10 +20,23 @@ #include "piintrospection_containers_p.h" #include +#ifdef CC_GCC +# include +const PIString demangle(const char * name) { + int status = -4; + char * res = abi::__cxa_demangle(name, NULL, NULL, &status); + PIString ret((status == 0) ? res : name); + free(res); + return ret; +} +#else +const PIString demangle(const char * name) {return PIString(name);} +#endif -PIIntrospectionContainers::Type::Type() { - count = items = 0u; - bytes_allocated = bytes_used = 0U; + +PIIntrospectionContainers::_Type::_Type() { + id = count = item_size = 0u; + allocated = used = 0U; } @@ -35,12 +48,18 @@ PIIntrospectionContainers::PIIntrospectionContainers() { } -void PIIntrospectionContainers::containerNew(const char * tn) { +void PIIntrospectionContainers::containerNew(const char * tn, uint isz) { uint id = typeID(tn); PIMutexLocker _ml(mutex); //printf("containerNew lock\n"); - typenames[id] = tn; - data[id].count++; + std::string & n(typenames[id]); + _Type & d(data[id]); + if (n.empty()) { + n = tn; + d.id = id; + d.item_size = isz; + } + d.count++; //printf("containerNew unlock\n"); } @@ -55,7 +74,7 @@ void PIIntrospectionContainers::containerAlloc(const char * tn, ullong cnt) { //printf(" alloc %s %d\n", tn, cnt); if (cnt == 0) return; PIMutexLocker _ml(mutex); - data[typeID(tn)].bytes_allocated += cnt; + data[typeID(tn)].allocated += cnt; } @@ -63,7 +82,7 @@ void PIIntrospectionContainers::containerFree(const char * tn, ullong cnt) { //printf(" free %s %d\n", tn, cnt); if (cnt == 0) return; PIMutexLocker _ml(mutex); - data[typeID(tn)].bytes_allocated -= cnt; + data[typeID(tn)].allocated -= cnt; } @@ -71,7 +90,7 @@ void PIIntrospectionContainers::containerUsed(const char * tn, ullong cnt) { //printf(" used %s %d\n", tn, cnt); if (cnt == 0) return; PIMutexLocker _ml(mutex); - data[typeID(tn)].bytes_used += cnt; + data[typeID(tn)].used += cnt; } @@ -79,7 +98,7 @@ void PIIntrospectionContainers::containerUnused(const char * tn, ullong cnt) { //printf("unused %s %d\n", tn, cnt); if (cnt == 0) return; PIMutexLocker _ml(mutex); - data[typeID(tn)].bytes_used -= cnt; + data[typeID(tn)].used -= cnt; } @@ -91,23 +110,31 @@ uint PIIntrospectionContainers::typeID(const char * tn) { } - - -PIByteArray & operator <<(PIByteArray & s, const std::map & v) { - PIMap m; - for (typename std::map::const_iterator i = v.cbegin(); i != v.cend(); ++i) { - m[i->first] = PIStringAscii(i->second.c_str()); +PIVector PIIntrospectionContainers::getInfo() const { + PIVector ret; + mutex.lock(); + std::map d = data; + std::map t = typenames; + mutex.unlock(); + ret.reserve(t.size()); + for (typename std::map::const_iterator i = t.cbegin(); i != t.cend(); ++i) { + ret.push_back(TypeInfo()); + TypeInfo & ti(ret.back()); + _Type & _t(d[i->first]); + memcpy((void*)&ti, (const void*)&_t, sizeof(_t)); + ti.name = demangle(i->second.c_str()); } - s << m; - return s; + return ret; } -PIByteArray & operator <<(PIByteArray & s, const PIIntrospectionContainers::Type & v) { - s << v.count << v.items << v.bytes_allocated << v.bytes_used; + + +PIByteArray & operator <<(PIByteArray & s, const PIIntrospectionContainers::TypeInfo & v) { + s << PIByteArray::RawData(&v, sizeof(PIIntrospectionContainers::_Type)) << v.name; return s; } -PIByteArray & operator >>(PIByteArray & s, PIIntrospectionContainers::Type & v) { - s >> v.count >> v.items >> v.bytes_allocated >> v.bytes_used; +PIByteArray & operator >>(PIByteArray & s, PIIntrospectionContainers::TypeInfo & v) { + s >> PIByteArray::RawData(&v, sizeof(PIIntrospectionContainers::_Type)) >> v.name; return s; } diff --git a/src_main/introspection/piintrospection_containers_p.h b/src_main/introspection/piintrospection_containers_p.h index 686a7f68..535a4232 100644 --- a/src_main/introspection/piintrospection_containers_p.h +++ b/src_main/introspection/piintrospection_containers_p.h @@ -30,7 +30,9 @@ class PIP_EXPORT PIIntrospectionContainers { public: PIIntrospectionContainers(); - void containerNew (const char * tn); + struct TypeInfo; + + void containerNew (const char * tn, uint isz); void containerDelete(const char * tn); void containerAlloc (const char * tn, ullong cnt); void containerFree (const char * tn, ullong cnt); @@ -39,23 +41,30 @@ public: uint typeID(const char * tn); - struct Type { - Type(); + PIVector getInfo() const; + +#pragma pack(push, 1) + struct _Type { + _Type(); + uint id; uint count; - uint items; - ullong bytes_allocated; - ullong bytes_used; + uint item_size; + ullong allocated; + ullong used; + }; +#pragma pack(pop) + + struct TypeInfo: _Type { + PIString name; }; - std::map data; + std::map data; std::map typenames; - PIMutex mutex; + mutable PIMutex mutex; CRC_32 crc; }; -PIByteArray & operator <<(PIByteArray & s, const std::map & v); - -PIByteArray & operator <<(PIByteArray & s, const PIIntrospectionContainers::Type & v); -PIByteArray & operator >>(PIByteArray & s, PIIntrospectionContainers::Type & v); +PIByteArray & operator <<(PIByteArray & s, const PIIntrospectionContainers::TypeInfo & v); +PIByteArray & operator >>(PIByteArray & s, PIIntrospectionContainers::TypeInfo & v); #endif // PIINTROSPECTION_CONTAINERS_P_H diff --git a/src_main/introspection/piintrospection_server_p.cpp b/src_main/introspection/piintrospection_server_p.cpp index e832d0e9..5cb0a0e4 100644 --- a/src_main/introspection/piintrospection_server_p.cpp +++ b/src_main/introspection/piintrospection_server_p.cpp @@ -86,9 +86,9 @@ PIVector PIIntrospection::getObjects() { } -PIByteArray & operator <<(PIByteArray & s, const std::map & v) { - PIMap m; - for (typename std::map::const_iterator i = v.cbegin(); i != v.cend(); ++i) { +PIByteArray & operator <<(PIByteArray & s, const std::map & v) { + PIMap m; + for (typename std::map::const_iterator i = v.cbegin(); i != v.cend(); ++i) { m[i->first] = i->second; } s << m; @@ -205,27 +205,22 @@ void PIIntrospection::unpackProcStat(PIByteArray & ba, PIIntrospection::ProcessS PIByteArray PIIntrospection::packContainers() { PIByteArray ret; - std::map data; - std::map typenames; + PIVector data; PIIntrospectionContainers * p = 0; #ifdef PIP_INTROSPECTION p = PIINTROSPECTION_CONTAINERS->p; #endif if (p) { - p->mutex.lock(); - data = p->data; - typenames = p->typenames; - p->mutex.unlock(); + data = p->getInfo(); } - ret << data << typenames; + ret << data; return ret; } -void PIIntrospection::unpackContainers(PIByteArray & ba, PIMap & data, PIMap & typenames) { +void PIIntrospection::unpackContainers(PIByteArray & ba, PIVector & data) { data.clear(); - typenames.clear(); - ba >> data >> typenames; + ba >> data; } diff --git a/src_main/introspection/piintrospection_server_p.h b/src_main/introspection/piintrospection_server_p.h index 6066259f..d7808039 100644 --- a/src_main/introspection/piintrospection_server_p.h +++ b/src_main/introspection/piintrospection_server_p.h @@ -81,7 +81,7 @@ public: static void unpackProcStat(PIByteArray & ba, ProcessStat & info); static PIByteArray packContainers(); - static void unpackContainers(PIByteArray & ba, PIMap & data, PIMap & typenames); + static void unpackContainers(PIByteArray & ba, PIVector & data); static PIByteArray packThreads(); static void unpackThreads(PIByteArray & ba, PIVector & threads); @@ -91,7 +91,7 @@ public: }; -PIByteArray & operator <<(PIByteArray & s, const std::map & v); +PIByteArray & operator <<(PIByteArray & s, const std::map & v); PIByteArray & operator <<(PIByteArray & b, const PIIntrospection::RequiredInfo & v); PIByteArray & operator >>(PIByteArray & b, PIIntrospection::RequiredInfo & v);