merged with changes from Matej
This commit is contained in:
@@ -41,6 +41,7 @@ LIBSRCS += timeFunction.cpp
|
||||
LIBSRCS += timer.cpp
|
||||
LIBSRCS += queueVoid.cpp
|
||||
LIBSRCS += messageQueue.cpp
|
||||
LIBSRCS += StatusCreateFactory.cpp
|
||||
|
||||
SRC_DIRS += $(PVDATA)/pv
|
||||
|
||||
@@ -83,7 +84,6 @@ LIBSRCS += PVDataCreateFactory.cpp
|
||||
LIBSRCS += Convert.cpp
|
||||
LIBSRCS += StandardField.cpp
|
||||
LIBSRCS += StandardPVField.cpp
|
||||
LIBSRCS += StatusCreateFactory.cpp
|
||||
|
||||
SRC_DIRS += $(PVDATA)/property
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include <cstdio>
|
||||
#include <lock.h>
|
||||
#include "lock.h"
|
||||
#include "factory.h"
|
||||
#include "byteBuffer.h"
|
||||
#include "showConstructDestruct.h"
|
||||
@@ -53,6 +53,13 @@ class StatusImpl : public Status
|
||||
{
|
||||
public:
|
||||
|
||||
StatusImpl(StatusType type, String message) :
|
||||
m_type(type), m_message(message)
|
||||
{
|
||||
Lock xx(globalMutex);
|
||||
totalConstruct++;
|
||||
}
|
||||
|
||||
StatusImpl(StatusType type, String message, String stackDump) :
|
||||
m_type(type), m_message(message), m_stackDump(stackDump)
|
||||
{
|
||||
@@ -60,7 +67,7 @@ class StatusImpl : public Status
|
||||
totalConstruct++;
|
||||
}
|
||||
|
||||
~StatusImpl() {
|
||||
virtual ~StatusImpl() {
|
||||
Lock xx(globalMutex);
|
||||
totalDestruct++;
|
||||
}
|
||||
@@ -112,6 +119,13 @@ class StatusImpl : public Status
|
||||
throw new std::runtime_error("use getStatusCreate()->deserialize()");
|
||||
}
|
||||
|
||||
virtual String toString()
|
||||
{
|
||||
String str;
|
||||
toString(&str, 0);
|
||||
return str;
|
||||
}
|
||||
|
||||
virtual void toString(StringBuilder buffer, int indentLevel)
|
||||
{
|
||||
*buffer += "StatusImpl [type=";
|
||||
@@ -150,13 +164,18 @@ class StatusCreateImpl : public StatusCreate {
|
||||
m_ok = createStatus(STATUSTYPE_OK, "OK", 0);
|
||||
}
|
||||
|
||||
~StatusCreateImpl()
|
||||
{
|
||||
delete m_ok;
|
||||
}
|
||||
|
||||
virtual Status* getStatusOK() {
|
||||
return m_ok;
|
||||
}
|
||||
|
||||
virtual Status* createStatus(StatusType type, String message, BaseException* cause) {
|
||||
if (cause == 0)
|
||||
return new StatusImpl(type, message, "");
|
||||
return new StatusImpl(type, message);
|
||||
else
|
||||
{
|
||||
std::string stackDump;
|
||||
@@ -7,19 +7,63 @@
|
||||
#include "string.h"
|
||||
#include "stdio.h"
|
||||
#include "bitSet.h"
|
||||
#include "lock.h"
|
||||
|
||||
namespace epics { namespace pvData {
|
||||
|
||||
//static DebugLevel debugLevel = lowDebug;
|
||||
|
||||
static volatile int64 totalConstruct = 0;
|
||||
static volatile int64 totalDestruct = 0;
|
||||
static Mutex *globalMutex = 0;
|
||||
|
||||
static int64 getTotalConstruct()
|
||||
{
|
||||
Lock xx(globalMutex);
|
||||
return totalConstruct;
|
||||
}
|
||||
|
||||
static int64 getTotalDestruct()
|
||||
{
|
||||
Lock xx(globalMutex);
|
||||
return totalDestruct;
|
||||
}
|
||||
|
||||
static ConstructDestructCallback *pConstructDestructCallback;
|
||||
|
||||
static void init()
|
||||
{
|
||||
static Mutex mutex = Mutex();
|
||||
Lock xx(&mutex);
|
||||
if(globalMutex==0) {
|
||||
globalMutex = new Mutex();
|
||||
pConstructDestructCallback = new ConstructDestructCallback(
|
||||
String("bitSet"),
|
||||
getTotalConstruct,getTotalDestruct,0);
|
||||
}
|
||||
}
|
||||
|
||||
BitSet::BitSet() : words(0), wordsLength(0), wordsInUse(0) {
|
||||
initWords(BITS_PER_WORD);
|
||||
|
||||
init();
|
||||
Lock xx(globalMutex);
|
||||
totalConstruct++;
|
||||
}
|
||||
|
||||
BitSet::BitSet(uint32 nbits) : words(0), wordsLength(0), wordsInUse(0) {
|
||||
initWords(nbits);
|
||||
|
||||
init();
|
||||
Lock xx(globalMutex);
|
||||
totalConstruct++;
|
||||
}
|
||||
|
||||
BitSet::~BitSet() {
|
||||
delete words;
|
||||
|
||||
Lock xx(globalMutex);
|
||||
totalDestruct++;
|
||||
}
|
||||
|
||||
void BitSet::initWords(uint32 nbits) {
|
||||
@@ -315,8 +359,6 @@ namespace epics { namespace pvData {
|
||||
return !(*this == set);
|
||||
}
|
||||
|
||||
void BitSet::toString(StringBuilder buffer) { toString(buffer, 0); }
|
||||
|
||||
void BitSet::toString(StringBuilder buffer, int indentLevel) const
|
||||
{
|
||||
*buffer += '{';
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
#define BITSET_H
|
||||
#include <stdexcept>
|
||||
#include <pvType.h>
|
||||
#include "factory.h"
|
||||
#include "showConstructDestruct.h"
|
||||
//#include "byteBuffer.h"
|
||||
//#include "serialize.h"
|
||||
namespace epics { namespace pvData {
|
||||
@@ -213,9 +215,7 @@ namespace epics { namespace pvData {
|
||||
|
||||
bool operator!=(const BitSet &set) const;
|
||||
|
||||
void toString(StringBuilder buffer);
|
||||
|
||||
void toString(StringBuilder buffer, int indentLevel) const;
|
||||
void toString(StringBuilder buffer, int indentLevel = 0) const;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -20,11 +20,11 @@ namespace epics { namespace pvData {
|
||||
*/
|
||||
virtual void destroy() = 0;
|
||||
|
||||
private:
|
||||
protected:
|
||||
/**
|
||||
* Do not allow delete on this instance.
|
||||
* Do not allow delete on this instance and derived classes, destroy() must be used instead.
|
||||
*/
|
||||
//~Destroyable() {};
|
||||
virtual ~Destroyable() {};
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
@@ -35,7 +35,8 @@ namespace epics { namespace pvData {
|
||||
*/
|
||||
class Status : public epics::pvData::Serializable {
|
||||
public:
|
||||
|
||||
virtual ~Status() {};
|
||||
|
||||
/**
|
||||
* Get status type.
|
||||
* @return status type, non-<code>null</code>.
|
||||
@@ -69,7 +70,7 @@ namespace epics { namespace pvData {
|
||||
*/
|
||||
virtual bool isSuccess() = 0;
|
||||
|
||||
|
||||
virtual String toString() = 0;
|
||||
virtual void toString(StringBuilder buffer, int indentLevel = 0) = 0;
|
||||
|
||||
};
|
||||
@@ -95,7 +96,7 @@ namespace epics { namespace pvData {
|
||||
* @param cause exception that caused an error. Optional.
|
||||
* @return status instance.
|
||||
*/
|
||||
virtual Status* createStatus(StatusType type, String message, BaseException* cause) = 0;
|
||||
virtual Status* createStatus(StatusType type, String message, BaseException* cause = 0) = 0;
|
||||
|
||||
/**
|
||||
* Deserialize status.
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
|
||||
Time test
|
||||
diff 30.476650 milliSeconds
|
||||
time per iteration 30.476650 microseconds
|
||||
time per addTail/removeHead 0.015238 microseconds
|
||||
diff 28.744510 milliSeconds
|
||||
time per iteration 28.744510 microseconds
|
||||
time per addTail/removeHead 0.014372 microseconds
|
||||
|
||||
Time test locked
|
||||
diff 182.684171 milliSeconds
|
||||
time per iteration 182.684171 microseconds
|
||||
time per addTail/removeHead 0.091342 microseconds
|
||||
diff 187.872582 milliSeconds
|
||||
time per iteration 187.872582 microseconds
|
||||
time per addTail/removeHead 0.093936 microseconds
|
||||
|
||||
Time std::list test
|
||||
diff 649.338813 milliSeconds
|
||||
time per iteration 649.338813 microseconds
|
||||
time per addTail/removeHead 0.324669 microseconds
|
||||
diff 682.009561 milliSeconds
|
||||
time per iteration 682.009561 microseconds
|
||||
time per addTail/removeHead 0.341005 microseconds
|
||||
|
||||
Time std::list test locked
|
||||
diff 803.852839 milliSeconds
|
||||
time per iteration 803.852839 microseconds
|
||||
time per addTail/removeHead 0.401926 microseconds
|
||||
diff 817.248344 milliSeconds
|
||||
time per iteration 817.248344 microseconds
|
||||
time per addTail/removeHead 0.408624 microseconds
|
||||
|
||||
@@ -1 +1 @@
|
||||
time per call 9.434397 microseconds
|
||||
time per call 38.080599 microseconds
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
current 1292845147 903990741 milliSec 1292845147903
|
||||
2010.12.20 06:39:07 903990741 nanoSeconds isDst false
|
||||
current 1293027467 787274811 milliSec 1293027467787
|
||||
2010.12.22 09:17:47 787274811 nanoSeconds isDst false
|
||||
fromTime_t
|
||||
current 1292845147 0 milliSec 1292845147000
|
||||
2010.12.20 06:39:07 0 nanoSeconds isDst false
|
||||
current 1293027467 0 milliSec 1293027467000
|
||||
2010.12.22 09:17:47 0 nanoSeconds isDst false
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
one requested 0.400000 diff 0.400215 seconds
|
||||
two requested 0.200000 diff 0.200168 seconds
|
||||
one requested 0.200000 diff 0.200188 seconds
|
||||
two requested 0.400000 diff 0.400392 seconds
|
||||
one requested 0.000000 diff 0.000068 seconds
|
||||
two requested 0.000000 diff 0.000091 seconds
|
||||
one requested 0.400000 diff 0.400192 seconds
|
||||
two requested 0.200000 diff 0.200170 seconds
|
||||
one requested 0.200000 diff 0.200340 seconds
|
||||
two requested 0.400000 diff 0.400313 seconds
|
||||
one requested 0.000000 diff 0.000046 seconds
|
||||
two requested 0.000000 diff 0.000068 seconds
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "bitSet.h"
|
||||
|
||||
#include <bitSet.h>
|
||||
#include <showConstructDestruct.h>
|
||||
|
||||
#include <epicsAssert.h>
|
||||
|
||||
@@ -143,6 +143,7 @@ int main(int argc,char *argv[])
|
||||
{
|
||||
testGetSetClearFlip();
|
||||
testOperators();
|
||||
//getShowConstructDestruct()->constuctDestructTotals(stdout);
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user