Dali 3D User Interface Engine
List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
Dali::Internal::Adaptor::NetworkPerformanceServer Class Reference

The class listens for incoming connections on a dedicated thread. More...

#include <network-performance-server.h>

Inheritance diagram for Dali::Internal::Adaptor::NetworkPerformanceServer:
Inheritance graph
[legend]
Collaboration diagram for Dali::Internal::Adaptor::NetworkPerformanceServer:
Collaboration graph
[legend]

Public Member Functions

 NetworkPerformanceServer (AdaptorInternalServices &adaptorServices, const EnvironmentOptions &logOptions)
 Constructor. More...
 
void Start ()
 Start the server, to be called form Dali main thread. More...
 
void Stop ()
 Stop the server. More...
 
bool IsRunning () const
 
void TransmitMarker (const PerformanceMarker &marker, const char *const description)
 Transmit a marker to any clients are listening for this marker. More...
 
 ~NetworkPerformanceServer ()
 Destructor. More...
 

Protected Member Functions

virtual void SendData (const char *const data, unsigned int bufferSizeInBytes, unsigned int clientId)
 Constructor. More...
 
- Protected Member Functions inherited from Dali::Internal::Adaptor::ClientSendDataInterface
 ClientSendDataInterface ()
 Constructor. More...
 
virtual ~ClientSendDataInterface ()
 Virtual Destructor. More...
 

Private Member Functions

void ClientThread (NetworkPerformanceClient *client)
 Client thread function. More...
 
void StopClients ()
 Stop all client threads. More...
 
void ConnectionListener ()
 Waits for new connections to be made. More...
 
NetworkPerformanceClientAddClient (SocketInterface *clientSocket, pthread_t *clientThread)
 Add a new client to the client list. More...
 
void DeleteClient (NetworkPerformanceClient *client)
 Delete a client from the client list. More...
 
 NetworkPerformanceServer (const NetworkPerformanceServer &)
 undefined copy constructor More...
 
NetworkPerformanceServeroperator= (const NetworkPerformanceServer &)
 undefined assignment operator More...
 

Static Private Member Functions

static void * ConnectionListenerFunc (void *This)
 Helper for the thread calling the entry function. More...
 
static void * ClientThreadFunc (void *data)
 Helper for the thread calling the entry function. More...
 

Private Attributes

TriggerEventFactoryInterface & mTriggerEventFactory
 used to create trigger events More...
 
SocketFactoryInterfacemSocketFactory
 used to create sockets More...
 
const EnvironmentOptionsmLogOptions
 log options More...
 
Dali::Vector
< NetworkPerformanceClient * > 
mClients
 list of connected clients More...
 
pthread_t mServerThread
 thread that listens for new connections More...
 
SocketInterfacemListeningSocket
 socket used to listen for new connections More...
 
Dali::Mutex mClientListMutex
 mutex More...
 
unsigned int mClientUniqueId
 increments for every client connection More...
 
volatile unsigned int mClientCount
 client count More...
 
bool mLogFunctionInstalled
 whether the log function is installed More...
 

Detailed Description

The class listens for incoming connections on a dedicated thread.

When a new connection is established a client thread is spawned to handle that connection, along with a NetworkPerformanceClient object. The NetworkPerformanceClient object performs processing of incoming commands and holds the per-client state information for performance monitoring.

Server->Start()

Server->Stop()

Definition at line 61 of file network-performance-server.h.

Constructor & Destructor Documentation

Dali::Internal::Adaptor::NetworkPerformanceServer::NetworkPerformanceServer ( AdaptorInternalServices adaptorServices,
const EnvironmentOptions logOptions 
)

Constructor.

Parameters
[in]adaptorServicesadaptor internal services
[in]logOptionslog options

Definition at line 52 of file network-performance-server.cpp.

Dali::Internal::Adaptor::NetworkPerformanceServer::~NetworkPerformanceServer ( )

Destructor.

Definition at line 65 of file network-performance-server.cpp.

References mLogFunctionInstalled, mLogOptions, Stop(), and Dali::Internal::Adaptor::EnvironmentOptions::UnInstallLogFunction().

Here is the call graph for this function:

Dali::Internal::Adaptor::NetworkPerformanceServer::NetworkPerformanceServer ( const NetworkPerformanceServer )
private

undefined copy constructor

Member Function Documentation

NetworkPerformanceClient * Dali::Internal::Adaptor::NetworkPerformanceServer::AddClient ( SocketInterface clientSocket,
pthread_t *  clientThread 
)
private

Add a new client to the client list.

Parameters
clientSocketclient socket
clientThreadclient thread
Returns
client

Definition at line 233 of file network-performance-server.cpp.

References mClientListMutex, mClients, mClientUniqueId, mSocketFactory, and mTriggerEventFactory.

Referenced by ConnectionListener().

Here is the caller graph for this function:

void Dali::Internal::Adaptor::NetworkPerformanceServer::ClientThread ( NetworkPerformanceClient client)
private
void * Dali::Internal::Adaptor::NetworkPerformanceServer::ClientThreadFunc ( void *  data)
staticprivate

Helper for the thread calling the entry function.

Parameters
[in]ThisA pointer to the current RenderThread object

Definition at line 225 of file network-performance-server.cpp.

Referenced by ConnectionListener().

Here is the caller graph for this function:

void Dali::Internal::Adaptor::NetworkPerformanceServer::ConnectionListener ( )
private
static void* Dali::Internal::Adaptor::NetworkPerformanceServer::ConnectionListenerFunc ( void *  This)
inlinestaticprivate

Helper for the thread calling the entry function.

Parameters
[in]ThisA pointer to the current RenderThread object

Definition at line 118 of file network-performance-server.h.

Referenced by Start().

Here is the caller graph for this function:

void Dali::Internal::Adaptor::NetworkPerformanceServer::DeleteClient ( NetworkPerformanceClient client)
private

Delete a client from the client list.

Parameters
clientnetwork client

Definition at line 251 of file network-performance-server.cpp.

References mClientCount, mClientListMutex, and mClients.

Referenced by ClientThread().

Here is the caller graph for this function:

bool Dali::Internal::Adaptor::NetworkPerformanceServer::IsRunning ( ) const
Returns
true if the server is running

Definition at line 141 of file network-performance-server.cpp.

References mServerThread.

Referenced by TransmitMarker().

Here is the caller graph for this function:

NetworkPerformanceServer& Dali::Internal::Adaptor::NetworkPerformanceServer::operator= ( const NetworkPerformanceServer )
private

undefined assignment operator

void Dali::Internal::Adaptor::NetworkPerformanceServer::SendData ( const char *const  data,
unsigned int  bufferSizeInBytes,
unsigned int  clientId 
)
protectedvirtual
void Dali::Internal::Adaptor::NetworkPerformanceServer::Start ( )
void Dali::Internal::Adaptor::NetworkPerformanceServer::Stop ( )

Stop the server.

Precondition
Can only be called form Dali main thread

Definition at line 116 of file network-performance-server.cpp.

References Dali::Internal::Adaptor::SocketInterface::CloseSocket(), Dali::Internal::Adaptor::SocketFactoryInterface::DestroySocket(), Dali::Internal::Adaptor::SocketInterface::ExitSelect(), mListeningSocket, mServerThread, mSocketFactory, and StopClients().

Referenced by ~NetworkPerformanceServer().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::Adaptor::NetworkPerformanceServer::StopClients ( )
private

Stop all client threads.

Definition at line 310 of file network-performance-server.cpp.

References Dali::Internal::Adaptor::NetworkPerformanceClient::ExitSelect(), Dali::Internal::Adaptor::NetworkPerformanceClient::GetThread(), mClientListMutex, and mClients.

Referenced by Stop().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::Adaptor::NetworkPerformanceServer::TransmitMarker ( const PerformanceMarker marker,
const char *const  description 
)

Transmit a marker to any clients are listening for this marker.

Parameters
[in]markerperformance marker
[in]descriptionmarker description
Precondition
Can be called from any thread

Definition at line 293 of file network-performance-server.cpp.

References IsRunning(), mClientListMutex, mClients, and Dali::Internal::Adaptor::NetworkPerformanceClient::TransmitMarker().

Here is the call graph for this function:

Member Data Documentation

volatile unsigned int Dali::Internal::Adaptor::NetworkPerformanceServer::mClientCount
private

client count

Definition at line 172 of file network-performance-server.h.

Referenced by ClientThread(), DeleteClient(), and SendData().

Dali::Mutex Dali::Internal::Adaptor::NetworkPerformanceServer::mClientListMutex
private

mutex

Definition at line 170 of file network-performance-server.h.

Referenced by AddClient(), DeleteClient(), SendData(), StopClients(), and TransmitMarker().

Dali::Vector< NetworkPerformanceClient* > Dali::Internal::Adaptor::NetworkPerformanceServer::mClients
private

list of connected clients

Definition at line 167 of file network-performance-server.h.

Referenced by AddClient(), DeleteClient(), SendData(), StopClients(), and TransmitMarker().

unsigned int Dali::Internal::Adaptor::NetworkPerformanceServer::mClientUniqueId
private

increments for every client connection

Definition at line 171 of file network-performance-server.h.

Referenced by AddClient().

SocketInterface* Dali::Internal::Adaptor::NetworkPerformanceServer::mListeningSocket
private

socket used to listen for new connections

Definition at line 169 of file network-performance-server.h.

Referenced by ConnectionListener(), Start(), and Stop().

bool Dali::Internal::Adaptor::NetworkPerformanceServer::mLogFunctionInstalled
private

whether the log function is installed

Definition at line 173 of file network-performance-server.h.

Referenced by ConnectionListener(), and ~NetworkPerformanceServer().

const EnvironmentOptions& Dali::Internal::Adaptor::NetworkPerformanceServer::mLogOptions
private

log options

Definition at line 166 of file network-performance-server.h.

Referenced by ConnectionListener(), and ~NetworkPerformanceServer().

pthread_t Dali::Internal::Adaptor::NetworkPerformanceServer::mServerThread
private

thread that listens for new connections

Definition at line 168 of file network-performance-server.h.

Referenced by IsRunning(), Start(), and Stop().

SocketFactoryInterface& Dali::Internal::Adaptor::NetworkPerformanceServer::mSocketFactory
private

used to create sockets

Definition at line 165 of file network-performance-server.h.

Referenced by AddClient(), Start(), and Stop().

TriggerEventFactoryInterface& Dali::Internal::Adaptor::NetworkPerformanceServer::mTriggerEventFactory
private

used to create trigger events

Definition at line 164 of file network-performance-server.h.

Referenced by AddClient().


The documentation for this class was generated from the following files:
Dali Docs Home
Read more about Dali