started on documentation and changes to misc as a result
This commit is contained in:
@@ -352,7 +352,7 @@ static void testTimeLocked(FILE *auxFd) {
|
||||
}
|
||||
|
||||
typedef std::list<Basic *> stdList;
|
||||
static void testArrayListTime(FILE *auxFd) {
|
||||
static void testStdListTime(FILE *auxFd) {
|
||||
TimeStamp startTime;
|
||||
TimeStamp endTime;
|
||||
int numNodes = 1000;
|
||||
@@ -362,7 +362,7 @@ static void testArrayListTime(FILE *auxFd) {
|
||||
for(int i=0; i<numNodes; i++) {
|
||||
basics[i] = new Basic(i);
|
||||
}
|
||||
fprintf(auxFd,"\nTime ArrayList test\n");
|
||||
fprintf(auxFd,"\nTime std::list test\n");
|
||||
int ntimes = 1000;
|
||||
startTime.getCurrent();
|
||||
for(int i=0; i<ntimes; i++) {
|
||||
@@ -385,7 +385,7 @@ static void testArrayListTime(FILE *auxFd) {
|
||||
for(int i=0; i<numNodes; i++) delete basics[i];
|
||||
}
|
||||
|
||||
static void testArrayListTimeLocked(FILE *auxFd) {
|
||||
static void testStdListTimeLocked(FILE *auxFd) {
|
||||
TimeStamp startTime;
|
||||
TimeStamp endTime;
|
||||
int numNodes = 1000;
|
||||
@@ -396,7 +396,7 @@ static void testArrayListTimeLocked(FILE *auxFd) {
|
||||
for(int i=0; i<numNodes; i++) {
|
||||
basics[i] = new Basic(i);
|
||||
}
|
||||
fprintf(auxFd,"\nTime ArrayList test locked\n");
|
||||
fprintf(auxFd,"\nTime std::list test locked\n");
|
||||
int ntimes = 1000;
|
||||
startTime.getCurrent();
|
||||
for(int i=0; i<ntimes; i++) {
|
||||
@@ -444,8 +444,8 @@ int main(int argc, char *argv[]) {
|
||||
testOrderedQueue(fd);
|
||||
testTime(auxFd);
|
||||
testTimeLocked(auxFd);
|
||||
testArrayListTime(auxFd);
|
||||
testArrayListTimeLocked(auxFd);
|
||||
testStdListTime(auxFd);
|
||||
testStdListTimeLocked(auxFd);
|
||||
getShowConstructDestruct()->constuctDestructTotals(fd);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ private:
|
||||
Basic::Basic(Executor *executor)
|
||||
: executor(executor),
|
||||
executorNode(executor->createNode(this)),
|
||||
wait(new Event(eventEmpty))
|
||||
wait(new Event())
|
||||
{
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ void Basic::run()
|
||||
{
|
||||
executor->execute(executorNode);
|
||||
bool result = wait->wait();
|
||||
if(result==false) printf("basic::run wait returned true\n");
|
||||
if(result==false) printf("basic::run wait returned false\n");
|
||||
}
|
||||
|
||||
void Basic::command()
|
||||
@@ -65,14 +65,14 @@ void Basic::command()
|
||||
|
||||
|
||||
static void testBasic(FILE *fd) {
|
||||
Executor *executor = Executor::create(String("basic"),middlePriority);
|
||||
Executor *executor = new Executor(String("basic"),middlePriority);
|
||||
Basic *basic = new Basic(executor);
|
||||
basic->run();
|
||||
delete basic;
|
||||
String buf("");
|
||||
Thread::showThreads(&buf);
|
||||
fprintf(fd,"threads\n%s\n",buf.c_str());
|
||||
executor->destroy();
|
||||
delete executor;
|
||||
}
|
||||
|
||||
class MyFunc : public TimeFunctionRequester {
|
||||
@@ -89,7 +89,7 @@ private:
|
||||
};
|
||||
|
||||
static void testThreadContext(FILE *fd,FILE *auxFd) {
|
||||
Executor *executor = Executor::create(String("basic"),middlePriority);
|
||||
Executor *executor = new Executor(String("basic"),middlePriority);
|
||||
Basic *basic = new Basic(executor);
|
||||
MyFunc myFunc(basic);
|
||||
TimeFunction timeFunction(&myFunc);
|
||||
@@ -97,7 +97,7 @@ static void testThreadContext(FILE *fd,FILE *auxFd) {
|
||||
perCall *= 1e6;
|
||||
fprintf(auxFd,"time per call %f microseconds\n",perCall);
|
||||
delete basic;
|
||||
executor->destroy();
|
||||
delete executor;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
@@ -14,7 +14,9 @@
|
||||
#include <cstdlib>
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <ctime>
|
||||
#include <list>
|
||||
|
||||
#include <epicsAssert.h>
|
||||
@@ -32,6 +34,30 @@ void testTimeStamp(FILE *fd,FILE *auxfd)
|
||||
current.getSecondsPastEpoch(),
|
||||
current.getNanoSeconds(),
|
||||
current.getMilliseconds());
|
||||
time_t tt;
|
||||
current.toTime_t(tt);
|
||||
struct tm ctm;
|
||||
memcpy(&ctm,localtime(&tt),sizeof(struct tm));
|
||||
fprintf(auxfd,
|
||||
"%4.4d.%2.2d.%2.2d %2.2d:%2.2d:%2.2d %d nanoSeconds isDst %s\n",
|
||||
ctm.tm_year+1900,ctm.tm_mon + 1,ctm.tm_mday,
|
||||
ctm.tm_hour,ctm.tm_min,ctm.tm_sec,
|
||||
current.getNanoSeconds(),
|
||||
(ctm.tm_isdst==0) ? "false" : "true");
|
||||
tt = time(&tt);
|
||||
current.fromTime_t(tt);
|
||||
fprintf(auxfd,"fromTime_t\ncurrent %lli %i milliSec %lli\n",
|
||||
current.getSecondsPastEpoch(),
|
||||
current.getNanoSeconds(),
|
||||
current.getMilliseconds());
|
||||
current.toTime_t(tt);
|
||||
memcpy(&ctm,localtime(&tt),sizeof(struct tm));
|
||||
fprintf(auxfd,
|
||||
"%4.4d.%2.2d.%2.2d %2.2d:%2.2d:%2.2d %d nanoSeconds isDst %s\n",
|
||||
ctm.tm_year+1900,ctm.tm_mon + 1,ctm.tm_mday,
|
||||
ctm.tm_hour,ctm.tm_min,ctm.tm_sec,
|
||||
current.getNanoSeconds(),
|
||||
(ctm.tm_isdst==0) ? "false" : "true");
|
||||
TimeStamp right;
|
||||
TimeStamp left;
|
||||
right.put(current.getSecondsPastEpoch(),current.getNanoSeconds());
|
||||
|
||||
@@ -33,12 +33,12 @@ class MyCallback : public TimerCallback {
|
||||
public:
|
||||
MyCallback(String name,FILE *fd,FILE *auxfd,Event *wait)
|
||||
: name(name),fd(fd),auxfd(auxfd),wait(wait),
|
||||
timerNode(TimerNode::create(this)),timeStamp(TimeStamp())
|
||||
timerNode(new TimerNode(this)),timeStamp(TimeStamp())
|
||||
{
|
||||
}
|
||||
~MyCallback()
|
||||
{
|
||||
timerNode->destroy();
|
||||
delete timerNode;
|
||||
}
|
||||
virtual void callback()
|
||||
{
|
||||
@@ -64,9 +64,9 @@ static void testBasic(FILE *fd, FILE *auxfd)
|
||||
{
|
||||
String one("one");
|
||||
String two("two");
|
||||
Event *eventOne = new Event(eventEmpty);
|
||||
Event *eventTwo = new Event(eventEmpty);
|
||||
Timer *timer = Timer::create(String("timer"),middlePriority);
|
||||
Event *eventOne = new Event();
|
||||
Event *eventTwo = new Event();
|
||||
Timer *timer = new Timer(String("timer"),middlePriority);
|
||||
MyCallback *callbackOne = new MyCallback(
|
||||
one,fd,auxfd,eventOne);
|
||||
MyCallback *callbackTwo = new MyCallback(
|
||||
@@ -83,11 +83,11 @@ static void testBasic(FILE *fd, FILE *auxfd)
|
||||
diff = TimeStamp::diff(
|
||||
callbackTwo->getTimeStamp(),currentTimeStamp);
|
||||
fprintf(auxfd,"two requested %f diff %f seconds\n",twoDelay,diff);
|
||||
timer->destroy();
|
||||
delete callbackOne;
|
||||
delete timer;
|
||||
delete callbackTwo;
|
||||
delete eventOne;
|
||||
delete callbackOne;
|
||||
delete eventTwo;
|
||||
delete eventOne;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
Reference in New Issue
Block a user