From 6d894788a3894d03d4bf91d028f4aa6c6374ea90 Mon Sep 17 00:00:00 2001
From: Marty Kraimer
Date: Thu, 23 May 2013 13:19:22 -0400
Subject: [PATCH] more work on memory issues. Still problems. Added
channelLocalDebug.
---
documentation/pvDatabaseCPP.html | 165 +++-
documentation/pvDatabaseCPP_20130523.html | 996 ++++++++++++++++++++++
src/Makefile | 2 +
src/pvAccess/channelLocal.cpp | 302 ++++---
src/pvAccess/channelLocalDebugRecord.cpp | 75 ++
src/pvAccess/channelLocalDebugRecord.h | 46 +
src/pvAccess/channelProviderLocal.cpp | 47 +-
src/pvAccess/channelProviderLocal.h | 45 +-
src/pvAccess/monitorFactory.cpp | 54 +-
src/pvAccess/pvCopy.cpp | 1 +
test/server/exampleCounterMain.cpp | 1 +
test/server/testExampleServerMain.cpp | 9 +
12 files changed, 1568 insertions(+), 175 deletions(-)
create mode 100644 documentation/pvDatabaseCPP_20130523.html
create mode 100644 src/pvAccess/channelLocalDebugRecord.cpp
create mode 100644 src/pvAccess/channelLocalDebugRecord.h
diff --git a/documentation/pvDatabaseCPP.html b/documentation/pvDatabaseCPP.html
index 4c5aef2..ca4feee 100644
--- a/documentation/pvDatabaseCPP.html
+++ b/documentation/pvDatabaseCPP.html
@@ -38,7 +38,7 @@
pvDatabaseCPP
-EPICS v4 Working Group, Working Draft, 16-May-2013
+EPICS v4 Working Group, Working Draft, 23-May-2013
- Latest version:
-
- This version:
- pvDatabaseCPP20130516.html
+ href="http://epics-pvdata.hg.sourceforge.net/hgweb/epics-pvdata/pvDatabaseCPP/raw-file/tip/documentation/pvDatabaseCPP_20130523.html">pvDatabaseCPP20130523.html
- Previous version:
- pvDatabaseCPP20130417.html
+ href="http://epics-pvdata.hg.sourceforge.net/hgweb/epics-pvdata/pvDatabaseCPP/raw-file/tip/documentation/pvDatabaseCPP_20130516.html">pvDatabaseCPP20130516.html
- Editors:
- Marty Kraimer, BNL
@@ -74,24 +74,29 @@ The minimum that an extenson must provide is a top level PVStructure and a proce
Status of this Document
-This is the 16-May-2013 version of the definition of pvDatabaseCPP.
+
This is the 23-May-2013 version of the definition of pvDatabaseCPP.
The following Channel methods are implemented and working: getField,
channelProcess, channelGet, channelPut, channelPutGet, and Monitor.
But lots of work remains:
- Other Channel Methods
- - ChannelArray is next.
+ - Only ChannelArray remains.
+ Note that pvIOCJava does not implement the pvRequest for channelArray
+ correctly. It uses a private convention rather than using the output
+ of CreateRequest. This will be fixed before pvDatabaseCPP implements ChannelArray.
+
- Monitor Algorithms
- - Monitor algorithms have no been implemented.
+
- Monitor algorithms have not been implemented.
Thus all monitors are onPut.
- Lifecycle problems
- Problems when channel clients disconnect.
- May need help from Matej
- - Memory leaks at exit
- - May need help from Matej.
+ I am asking for help from Matej
+ - Memory leak at exit
+ - I am asking for help from Matej
- Scalar Arrays
- - Have not been tested. Share has not been implemented.
+ - Share has not been implemented.
+ This will wait until Michael has new implementation of ScalarArray.
- Structure Arrays
- Has not been implemented
- Testing
@@ -116,7 +121,7 @@ The local provider provides access to the records in the pvDatabase.
This local provider is accessed by the remote pvAccess server.
A record is smart because code can be attached to a record, which is accessed via a method named process.
-This document describes components that provides the following features:
+
This document describes components that provide the following features:
- database
-
- This encapsulates the concept of a database of memory resident smart records.
@@ -188,8 +193,9 @@ mrk> bin/linux-x86_64/exampleCounter
ExampleCounter.h
The example resides in src/database.
The complete implementation is in the header file.
-A serious implementation would probably break the code into two files:
-1) a header, and 2) the implementation. The description consists of
+A serious implementation might break the code into a header and an
+implementation file.
+
The description consists of
class ExampleCounter;
typedef std::tr1::shared_ptr<ExampleCounter> ExampleCounterPtr;
@@ -455,6 +461,18 @@ The following are the minimium features required
Thus code will be generated only if other code includes the
header file and creates a record instance.
+ - recordList.h
+ - This implements a PVRecord that provides a list of the names
+ of the records in the PVDatabase.
+ It also serves as an example of how to implement a service.
+ The testExampleServer creates an instance via the following code:
+
+recordName = "laptoprecordListPGRPC";
+pvRecord = RecordListRecord::create(recordName);
+result = master->addRecord(pvRecord);
+
+
+
The classes in pvDatabase.h describe a database of memory resident
smart records.
@@ -856,16 +874,123 @@ private:
Virtual message of Requester.
pvAccess
-Not yet described.
-It is only of interest to someone who wants to understand how it works.
-
-A brief description is that it implements the following components of pvIOCJava:
+This is code that provides an implementation of channelProvider as
+defined by pvAccess.
+It provides access to PVRecords and is access by the server side of remote pvAccess.
+channelProviderLocal
+This is a complete implementation of channelProvider and ,
+except for channelRPC, provides a complete implementation of Channel
+as defined by pvAccess.
+For monitors it calls the code described in the following sections.
+ChannelLocalDebug
+The channelProvider implementation provides the ability to generate
+debug messages based a debug level with the following meaning:
- - pvCopy
- - monitor
- - local ChannelProvider and Channel
+ - <=0
+ - No debug messages
+ - >0
+ - Generate a message when anything is created or destroyed
+ - >1
+ - Also generate processing messages.
+ChannelProviderLocal has a method:
+
+ void createChannelLocalDebugRecord(
+ String const & recordName);
+
+This method creates a PVRecord that allows a pvAccess client to set the
+debug level.
+pvCopy
+This provides code that creates a top level PVStructure that is an arbitrary
+subset of the fields in the PVStructure from a PVRecord.
+In addition it provides code that monitors changes to the fields in a PVRecord.
+A client configures the desired set of subfields and monitoring options
+via a pvRequest structure.
+pvAccess provides a class CreatePVRequest that creates a pvRequest.
+The pvCopy code provides the same functionality as the pvCopy code in pvIOCJava.
+
+monitorAlgorithm
+Currently all that is implemented is a header file.
+The only algorithm currently implemented is onPut
+
+monitorFactory
+Overview
+epics::pvData::monitor defines the monitor interfaces
+as seen by a client.
+See
+ pvDatabaseCPP.html
+ For details.
+
+monitorFactory implements the
+monitoring interfaces for a PVRecord.
+It implements queueSize=0 and queueSize>=2.
+
+
+The implementation uses PVCopy and PVCopyMonitor which are implemented in pvCopy.
+When PVCopyMonitor tells monitor that changes
+have occurred, monitor applies the appropriate algorithm to each changed field.
+
+Currently only algorithm onPut is implemented but,
+like pvIOCJava there are plans to support for the following monitor algorithms:
+
+ - onPut
+ - A monitor is issued whenever a put is issued to the field. This is the
+ default unless the record defines deadbands for a field. An exception is
+ the top level timeStamp which by default is made onChange and monitor
+ will not be raised.
+ - onChange
+ - This provides two options: 1) A monitor is raised whenever a field
+ changes value, and 2) A monitor will never be raised for the field.
+ - deadband
+ - The field must be a numeric scalar. Whenever the absolute or percentage
+ value of the field changes by more than a deadband a monitor is issued.
+ The record instance can also define deadbands.
+ - periodic
+ - A monitor is issued at a periodic rate if a put was issued to any field
+ being monitored.
+
+MonitorFactory
+MonitorFactory provides the following methods:
+class MonitorFactory
+{
+ static MonitorPtr create(
+ PVRecordPtr const & pvRecord,
+ MonitorRequester::shared_pointer const & monitorRequester,
+ PVStructurePtr const & pvRequest);
+ static void registerMonitorAlgorithmCreater(
+ MonitorAlgorithmCreatePtr const & monitorAlgorithmCreate,
+ String const & algorithmName);
+}
+
+where
+
+ - create
+ - Create a monitor. The arguments are:
+
+ - pvRecord
+ - The record being monitored.
+ - monitorRequester
+ - The monitor requester. This is the code to which monitot events
+ will be delivered.
+ - pvRequest
+ - The request options
+
+
+ - registerMonitorAlgorithmCreater
+ - Called by code that implements a monitor algorithm.
+
+channelLocalDebugRecord
+This implements a PVRecord that allows a client to set
+a debug level for the local channel provider implementation.
+The top level structure has a single integer field named value.
+See ChannelProviderLocal for the meaning associated with value.
+ChannelProviderLocal has a method:
+
+ void createChannelLocalDebugRecord(String const & recordName);
+
+This creates an instance of a ChannelLocalDebugRecord and installs it
+into the PVDatabase.