system time source is always running.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2995 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -11,6 +11,14 @@
|
|||||||
#include "ServerInterface.h"
|
#include "ServerInterface.h"
|
||||||
#include "TimeSourceObject.h"
|
#include "TimeSourceObject.h"
|
||||||
|
|
||||||
|
#define DEBUG_TIMESOURCE 0
|
||||||
|
|
||||||
|
#if DEBUG_TIMESOURCE
|
||||||
|
#define TRACE_TIMESOURCE printf
|
||||||
|
#else
|
||||||
|
#define TRACE_TIMESOURCE if (1) {} else printf
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace BPrivate { namespace media {
|
namespace BPrivate { namespace media {
|
||||||
|
|
||||||
struct TimeSourceTransmit // sizeof() must be <= 4096
|
struct TimeSourceTransmit // sizeof() must be <= 4096
|
||||||
@@ -117,10 +125,15 @@ bool
|
|||||||
BTimeSource::IsRunning()
|
BTimeSource::IsRunning()
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
bool isrunning;
|
|
||||||
isrunning = fBuf ? atomic_add(&fBuf->isrunning, 0) : fStarted;
|
|
||||||
|
|
||||||
printf("BTimeSource::IsRunning() node %ld, port %ld, %s\n", fNodeID, fControlPort, isrunning ? "yes" : "no");
|
bool isrunning;
|
||||||
|
|
||||||
|
if (fIsRealtime)
|
||||||
|
isrunning = true; // The system time source is always running :)
|
||||||
|
else
|
||||||
|
isrunning = fBuf ? atomic_add(&fBuf->isrunning, 0) : fStarted;
|
||||||
|
|
||||||
|
TRACE_TIMESOURCE("BTimeSource::IsRunning() node %ld, port %ld, %s\n", fNodeID, fControlPort, isrunning ? "yes" : "no");
|
||||||
return isrunning;
|
return isrunning;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,7 +169,7 @@ BTimeSource::GetTime(bigtime_t *performance_time,
|
|||||||
// return B_OK;
|
// return B_OK;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
printf("BTimeSource::GetTime timesource %ld, perf %16Ld, real %16Ld, drift %2.2f\n", ID(), *performance_time, *real_time, *drift);
|
TRACE_TIMESOURCE("BTimeSource::GetTime timesource %ld, perf %16Ld, real %16Ld, drift %2.2f\n", ID(), *performance_time, *real_time, *drift);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -266,7 +279,7 @@ BTimeSource::PublishTime(bigtime_t performance_time,
|
|||||||
bigtime_t real_time,
|
bigtime_t real_time,
|
||||||
float drift)
|
float drift)
|
||||||
{
|
{
|
||||||
printf("BTimeSource::PublishTime timesource %ld, perf %16Ld, real %16Ld, drift %2.2f\n", ID(), performance_time, real_time, drift);
|
TRACE_TIMESOURCE("BTimeSource::PublishTime timesource %ld, perf %16Ld, real %16Ld, drift %2.2f\n", ID(), performance_time, real_time, drift);
|
||||||
if (0 == fBuf) {
|
if (0 == fBuf) {
|
||||||
FATAL("BTimeSource::PublishTime timesource %ld, fBuf = NULL\n", ID());
|
FATAL("BTimeSource::PublishTime timesource %ld, fBuf = NULL\n", ID());
|
||||||
fStarted = true;
|
fStarted = true;
|
||||||
@@ -454,7 +467,7 @@ BTimeSource::DirectAddMe(const media_node &node)
|
|||||||
time_source_op_info msg;
|
time_source_op_info msg;
|
||||||
msg.op = B_TIMESOURCE_START;
|
msg.op = B_TIMESOURCE_START;
|
||||||
msg.real_time = RealTime();
|
msg.real_time = RealTime();
|
||||||
printf("starting time source\n");
|
TRACE_TIMESOURCE("starting time source %ld\n", ID());
|
||||||
write_port(fControlPort, TIMESOURCE_OP, &msg, sizeof(msg));
|
write_port(fControlPort, TIMESOURCE_OP, &msg, sizeof(msg));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@@ -485,7 +498,7 @@ BTimeSource::DirectRemoveMe(const media_node &node)
|
|||||||
time_source_op_info msg;
|
time_source_op_info msg;
|
||||||
msg.op = B_TIMESOURCE_STOP_IMMEDIATELY;
|
msg.op = B_TIMESOURCE_STOP_IMMEDIATELY;
|
||||||
msg.real_time = RealTime();
|
msg.real_time = RealTime();
|
||||||
printf("stopping time source\n");
|
TRACE_TIMESOURCE("stopping time source %ld\n", ID());
|
||||||
write_port(fControlPort, TIMESOURCE_OP, &msg, sizeof(msg));
|
write_port(fControlPort, TIMESOURCE_OP, &msg, sizeof(msg));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user