insturment with reftrack

This commit is contained in:
Michael Davidsaver
2017-08-29 17:28:50 -05:00
parent 6aa6a570de
commit 98df225583
8 changed files with 81 additions and 3 deletions

View File

@@ -1056,7 +1056,10 @@ public:
POINTER_DEFINITIONS(ChannelRequester);
typedef Channel operation_type;
virtual ~ChannelRequester() {}
static size_t num_instances;
ChannelRequester();
virtual ~ChannelRequester();
/**
* The request made with ChannelProvider::createChannel() is satisfied.

View File

@@ -4,6 +4,8 @@
* in file LICENSE that is included with this distribution.
*/
#include <pv/reftrack.h>
#define epicsExportSharedSymbols
#include <pv/pvAccess.h>
@@ -118,6 +120,19 @@ ChannelArray::shared_pointer Channel::createChannelArray(
return ret;
}
size_t ChannelRequester::num_instances;
ChannelRequester::ChannelRequester()
{
REFTRACE_INCREMENT(num_instances);
}
ChannelRequester::~ChannelRequester()
{
REFTRACE_DECREMENT(num_instances);
}
std::string DefaultChannelRequester::getRequesterName() { return "DefaultChannelRequester"; }
void DefaultChannelRequester::channelCreated(const epics::pvData::Status& status, Channel::shared_pointer const & channel)

View File

@@ -12,10 +12,13 @@
#include <pv/lock.h>
#include <pv/noDefaultMethods.h>
#include <pv/pvData.h>
#include <pv/reftrack.h>
#define epicsExportSharedSymbols
#include <pv/pvAccess.h>
#include <pv/factory.h>
#include "pv/codec.h"
#include <pv/serverContextImpl.h>
using namespace epics::pvData;
using std::string;
@@ -156,6 +159,9 @@ epicsThreadOnceId providerRegOnce = EPICS_THREAD_ONCE_INIT;
void providerRegInit(void*)
{
providerRegGbl = new providerRegGbl_t;
registerRefCounter("ServerContext (PVA)", &ServerContextImpl::num_instances);
registerRefCounter("BlockingTCPTransportCodec", &detail::BlockingTCPTransportCodec::num_instances);
registerRefCounter("ChannelRequester", &ChannelRequester::num_instances);
}
} // namespace

View File

@@ -27,6 +27,7 @@
#include <pv/lock.h>
#include <pv/timer.h>
#include <pv/event.h>
#include <pv/reftrack.h>
#define epicsExportSharedSymbols
#include <pv/blockingTCP.h>
@@ -1001,6 +1002,8 @@ bool AbstractCodec::directDeserialize(ByteBuffer *existingBuffer, char* deserial
BlockingTCPTransportCodec::~BlockingTCPTransportCodec()
{
REFTRACE_DECREMENT(num_instances);
waitJoin();
}
@@ -1138,6 +1141,7 @@ void BlockingTCPTransportCodec::sendBufferFull(int tries) {
//
//
size_t BlockingTCPTransportCodec::num_instances;
BlockingTCPTransportCodec::BlockingTCPTransportCodec(bool serverFlag, const Context::shared_pointer &context,
SOCKET channel, const ResponseHandler::shared_pointer &responseHandler,
@@ -1163,6 +1167,8 @@ BlockingTCPTransportCodec::BlockingTCPTransportCodec(bool serverFlag, const Cont
,_remoteTransportRevision(0), _priority(priority)
,_verified(false)
{
REFTRACE_INCREMENT(num_instances);
_isOpen.getAndSet(true);
// get remote address

View File

@@ -302,6 +302,8 @@ public:
POINTER_DEFINITIONS(BlockingTCPTransportCodec);
static size_t num_instances;
BlockingTCPTransportCodec(
bool serverFlag,
Context::shared_pointer const & context,

View File

@@ -14,6 +14,7 @@
#include <pv/timer.h>
#include <pv/bitSetUtil.h>
#include <pv/standardPVField.h>
#include <pv/reftrack.h>
#define epicsExportSharedSymbols
#include <pv/pvAccess.h>
@@ -165,6 +166,9 @@ protected:
return std::tr1::static_pointer_cast<subklass>(P);
}
public:
static size_t num_instances;
static size_t num_active;
template<class subklass>
static
typename std::tr1::shared_ptr<subklass>
@@ -180,6 +184,7 @@ public:
const_cast<BaseRequestImpl::weak_pointer&>(internal->m_this_internal) = internal;
const_cast<BaseRequestImpl::weak_pointer&>(internal->m_this_external) = external;
internal->activate();
REFTRACE_INCREMENT(num_active);
return external;
}
protected:
@@ -197,9 +202,13 @@ protected:
m_destroyed(false),
m_initialized(false),
m_subscribed()
{}
{
REFTRACE_INCREMENT(num_instances);
}
virtual ~BaseRequestImpl() {}
virtual ~BaseRequestImpl() {
REFTRACE_DECREMENT(num_instances);
}
virtual void activate() {
// register response request
@@ -344,6 +353,8 @@ public:
}
}
REFTRACE_DECREMENT(num_active);
}
virtual void timeout() OVERRIDE FINAL {
@@ -396,6 +407,8 @@ public:
};
size_t BaseRequestImpl::num_instances;
size_t BaseRequestImpl::num_active;
PVDataCreatePtr BaseRequestImpl::pvDataCreate = getPVDataCreate();
@@ -3248,6 +3261,11 @@ private:
*/
ServerGUID m_guid;
public:
static size_t num_instances;
static size_t num_active;
private:
/**
* Constructor.
* @param context
@@ -3275,6 +3293,7 @@ private:
m_serverChannelID(0xFFFFFFFF),
m_issueCreateMessage(true)
{
REFTRACE_INCREMENT(num_instances);
PVACCESS_REFCOUNT_MONITOR_CONSTRUCT(channel);
}
@@ -3285,6 +3304,8 @@ private:
// connect
connect();
REFTRACE_INCREMENT(num_active);
}
public:
@@ -3307,11 +3328,15 @@ private:
virtual ~InternalChannelImpl()
{
REFTRACE_DECREMENT(num_instances);
PVACCESS_REFCOUNT_MONITOR_DESTRUCT(channel);
}
virtual void destroy() OVERRIDE FINAL
{
REFTRACE_DECREMENT(num_active);
destroy(false);
}
@@ -4035,6 +4060,7 @@ public:
public:
static size_t num_instances;
InternalClientContextImpl(const Configuration::shared_pointer& conf) :
m_addressList(""), m_autoAddressList(true), m_connectionTimeout(30.0f), m_beaconPeriod(15.0f),
@@ -4049,6 +4075,8 @@ public:
m_configuration(conf),
m_flushStrategy(DELAYED)
{
REFTRACE_INCREMENT(num_instances);
PVACCESS_REFCOUNT_MONITOR_CONSTRUCT(remoteClientContext);
MB_INIT;
if(!m_configuration) m_configuration = ConfigurationFactory::getConfiguration("pvAccess-client");
@@ -4148,6 +4176,7 @@ public:
virtual ~InternalClientContextImpl()
{
REFTRACE_DECREMENT(num_instances);
PVACCESS_REFCOUNT_MONITOR_DESTRUCT(remoteClientContext);
}
@@ -4716,6 +4745,10 @@ private:
FlushStrategy m_flushStrategy;
};
size_t InternalClientContextImpl::num_instances;
size_t InternalClientContextImpl::InternalChannelImpl::num_instances;
size_t InternalClientContextImpl::InternalChannelImpl::num_active;
PVACCESS_REFCOUNT_MONITOR_DEFINE(channelGetField);
class ChannelGetFieldRequestImpl :
@@ -4908,6 +4941,11 @@ namespace pvAccess {
ChannelProvider::shared_pointer createClientProvider(const Configuration::shared_pointer& conf)
{
registerRefCounter("InternalClientContextImpl", &InternalClientContextImpl::num_instances);
registerRefCounter("InternalChannelImpl", &InternalClientContextImpl::InternalChannelImpl::num_instances);
registerRefCounter("InternalChannelImpl (Active)", &InternalClientContextImpl::InternalChannelImpl::num_active);
registerRefCounter("BaseRequestImpl", &BaseRequestImpl::num_instances);
registerRefCounter("BaseRequestImpl (Active)", &BaseRequestImpl::num_active);
InternalClientContextImpl::shared_pointer internal(new InternalClientContextImpl(conf)),
external(internal.get(), epics::pvAccess::Destroyable::cleaner(internal));
const_cast<InternalClientContextImpl::weak_pointer&>(internal->m_external_this) = external;

View File

@@ -32,6 +32,8 @@ public:
typedef std::tr1::shared_ptr<ServerContextImpl> shared_pointer;
typedef std::tr1::shared_ptr<const ServerContextImpl> const_shared_pointer;
static size_t num_instances;
ServerContextImpl();
virtual ~ServerContextImpl();

View File

@@ -9,6 +9,7 @@
#include <pv/lock.h>
#include <pv/timer.h>
#include <pv/thread.h>
#include <pv/reftrack.h>
#define epicsExportSharedSymbols
#include <pv/responseHandlers.h>
@@ -27,6 +28,8 @@ namespace pvAccess {
const Version ServerContextImpl::VERSION("pvAccess Server", "cpp",
EPICS_PVA_MAJOR_VERSION, EPICS_PVA_MINOR_VERSION, EPICS_PVA_MAINTENANCE_VERSION, EPICS_PVA_DEVELOPMENT_FLAG);
size_t ServerContextImpl::num_instances;
ServerContextImpl::ServerContextImpl():
_beaconAddressList(),
_ignoreAddressList(),
@@ -43,6 +46,8 @@ ServerContextImpl::ServerContextImpl():
_beaconServerStatusProvider(),
_startTime()
{
REFTRACE_INCREMENT(num_instances);
epicsTimeGetCurrent(&_startTime);
// TODO maybe there is a better place for this (when there will be some factory)
@@ -63,6 +68,7 @@ ServerContextImpl::~ServerContextImpl()
{
std::cerr<<"Error in: ServerContextImpl::dispose: "<<e.what()<<"\n";
}
REFTRACE_DECREMENT(num_instances);
}
const ServerGUID& ServerContextImpl::getGUID()