PLCnext API Documentation 24.0.0.71
|
This service provides an Interface to manage and control the LTTng tracing on the PLCnext controller. More...
#include <ITraceControllerService.hpp>
Public Types | |
using | Ptr = std::shared_ptr< ITraceControllerService > |
![]() | |
typedef std::shared_ptr< IRscService > | Ptr |
Public Member Functions | |
ITraceControllerService (void)=default | |
Constructs an ITraceControllerService instance. | |
virtual boolean | IsSessionDaemonAlive ()=0 |
Checks if the LTTng session daemon for tracing is alive. More... | |
virtual boolean | LoadSessionConfiguration (const RscString< 512 > &session, const RscString< 512 > &path)=0 |
Tries to loads a tracing session from a given configuration file. More... | |
virtual std::vector< RscString< 512 > > | ListSessions ()=0 |
Queries a list of all loaded (both started and stopped sessions) LTTng tracing sessions. More... | |
virtual boolean | StartSession (const RscString< 512 > &session)=0 |
Starts a LTTng tracing session. More... | |
virtual boolean | StopSession (const RscString< 512 > &session)=0 |
Stops a LTTng tracing session. More... | |
virtual boolean | DestroySession (const RscString< 512 > &session)=0 |
Destroys/Unloads a LTTng tracing session. More... | |
virtual void | LoadTracepointLib ()=0 |
Loads the PLCnext userspace Tracepoint library. More... | |
virtual void | UnloadTracepointLib ()=0 |
Unloads the userspace Tracepoint library. More... | |
virtual boolean | TriggerSavingTraceOutputs (boolean stopTriggerSession)=0 |
Triggers the recording/saving all outputs of a configured session. Saving will be performed by another thread (delayed). More... | |
virtual boolean | IsSessionInSnapshotMode (const RscString< 512 > &session)=0 |
Checks if a tracing session is in Snapshot Mode. More... | |
virtual boolean | IsSessionEnabled (const RscString< 512 > &session)=0 |
Checks if a tracing session is already enabled/started. More... | |
virtual boolean | IsSessionLoaded (const RscString< 512 > &session)=0 |
Checks if a trace session is already loaded. More... | |
![]() | |
IRscService (void)=default | |
Constructs an IRscService instance. | |
virtual | ~IRscService (void)=default |
Destructs this instance and frees all resouces. | |
Static Public Member Functions | |
static IRscServiceProxyFactory & | GetProxyFactory (void) |
![]() | |
static IRscServiceProxyFactory & | GetProxyFactory (void) |
Returns a reference to service proxy factory to create a proxy instance of the service More... | |
This service provides an Interface to manage and control the LTTng tracing on the PLCnext controller.
This service is defined in library Arp.Services.TraceController.
The LTTng tracing sessions can only loaded/started if the LTTng daemon is running
A recording session belongs to a session daemon (see lttng-sessiond(8)). For a given session daemon, each Unix user has its own, private recording sessions. Note, however, that the root Linux user may operate on or destroy another user's tracing session. The plcnext_firmware user will not be able to see or control tracing sessions of another users.
LTTng generally offers four recording session modes (see LTTng Documentation):
Running LTTng tracing may affect the performance of the PLCnext controller.
Realtime Usage: This API call does not have to be deterministic in runtime behaviour, so an asynchronous execution should be considered.
|
pure virtual |
Destroys/Unloads a LTTng tracing session.
A tracing session with the specified name must be loaded (see Arp.Services.TraceController.Services.ITraceControllerService.IsSessionLoaded) and stopped (see Arp.Services.TraceController.Services.ITraceControllerService.IsSessionEnabled).
session | Name of Session which will be destroyed/unloaded. |
!:Arp.Exception | if the session does not exist or an internal LTTng error is occured. |
false
if the !:Arp.System.Commons.Diagnostics.TraceController singleton instance was not created or if the instance was desposed, otherwise true
.
|
pure virtual |
Checks if the LTTng session daemon for tracing is alive.
The tracing sessions can only loaded/started if the LTTng daemon is running.
true
if the LTTng session daemon is running, otherwise false
.
|
pure virtual |
Checks if a tracing session is already enabled/started.
A tracing session can be enabled/started with the method Arp.Services.TraceController.Services.ITraceControllerService.StartSession and stopped with the method (see Arp.Services.TraceController.Services.ITraceControllerService.StopSession)
session | Session Name, which mode will be checked |
!:Arp.Exception | if the session does not exist or an internal LTTng error has occurred. |
true
if the session is in enabled/started, otherwise false
|
pure virtual |
Checks if a tracing session is in Snapshot Mode.
The specified trace session must exist (see Arp.Services.TraceController.Services.ITraceControllerService.ListSessions and Arp.Services.TraceController.Services.ITraceControllerService.IsSessionLoaded) when this method is called .
The specified trace session must exist when this method is called (see Arp.Services.TraceController.Services.ITraceControllerService.ListSessions).
See lttng-sessiond(8) for more information about LTTng snapshot sessions.
session | Session name |
!:Arp.Exception | if the specified session does not exist or an internal LTTng error has occurred. |
true
if the tracing session is in snapshot mode, otherwise false
.
|
pure virtual |
Checks if a trace session is already loaded.
session | Session Name, which mode will be checked |
!:Arp.Exception | if an internal LTTng error has occurred. |
true
if the session is in loaded, otherwise false
|
pure virtual |
Queries a list of all loaded (both started and stopped sessions) LTTng tracing sessions.
!:Arp.Exception | if an internal LTTng error has occurred. |
|
pure virtual |
Tries to loads a tracing session from a given configuration file.
The PLCnext firmware provides two .lttng configuration files in the folder /opt/plcnext/lttng:
See LTTng documentaion for more information about session configuration.
The LTTng tracing sessions can only loaded/started if the LTTng daemon is running
This method fails if a tracing session with the same name is already loaded in the system. The method Arp.Services.TraceController.Services.ITraceControllerService.IsSessionLoaded can be used to check if a tracing session is already loaded.
Restrictions:
See LTTng documentaion for more information about defined restrictions.
A tracing session can be unloaded/destroyed with the method (see Arp.Services.TraceController.Services.ITraceControllerService.DestroySession)
session | Session name, which must be identical with the trace name configured in the .lttng configuration file. |
path | Path to the .lttng configuration file of the specified tracing session. |
!:Arp.Exception | if the specified tracing session is already loaded or an internal LTTng error has occurred. |
true
if the session was loaded successfully, otherwise false
.
|
pure virtual |
Loads the PLCnext userspace Tracepoint library.
The user trace points will not be exported to lttng if the Tracepoint library is not loaded.
!:Arp.System.Commons.InvalidConfigException | if the path to the Tracepoint library does not exist. |
!:Arp.System.Commons.InvalidOperationException | if the Tracepoint library ist already loaded. |
!:Arp.Exception | an internal error occurred while loading the Tracepoint library. |
|
pure virtual |
Starts a LTTng tracing session.
A tracing session with the specified name must have been both loaded (see Arp.Services.TraceController.Services.ITraceControllerService.IsSessionLoaded) and stopped (see Arp.Services.TraceController.Services.ITraceControllerService.IsSessionEnabled).
The Tracepoint library must be loaded to start the tracing session Arp.Services.TraceController.Services.ITraceControllerService.LoadTracepointLib.
session | Name of Session which will be started. |
!:Arp.Exception | an exception will be thrown if:
|
!:Arp.System.Commons.InvalidOperationException | if the Tracepoint library was not loaded. |
true
if the tracing session was started successfully, otherwise false
.
|
pure virtual |
Stops a LTTng tracing session.
A tracing session with the specified name must be loaded (see Arp.Services.TraceController.Services.ITraceControllerService.IsSessionLoaded) and started (see Arp.Services.TraceController.Services.ITraceControllerService.IsSessionEnabled).
session | Name of Session which will be stopped. |
!:Arp.Exception | an exception will be thrown if:
|
true
if the session was stopped successfully, otherwise false
.
|
pure virtual |
Triggers the recording/saving all outputs of a configured session. Saving will be performed by another thread (delayed).
The configuration file of the TraceController PLCnext component (under /opt/plcnext/projects/Default/Services/TraceController/) contains the following configuration parameters for the traces saving trigger:
The traces output directory works as a ring buffer. If the configured maximum size of the folder is reached, the oldest trace(s) is/are deleted from this folder as needed and the new trace is then saved.
The way the session data is stored depends on its operation mode:
true
if the recording/saving of the tracing session was successful, otherwise false
.
|
pure virtual |
Unloads the userspace Tracepoint library.
All LTTng tracing sessions must be stopped before unloading the Tracepoint library (see methods Arp.Services.TraceController.Services.ITraceControllerService.ListSessionsArp.Services.TraceController.Services.ITraceControllerService.IsSessionEnabled).
!:Arp.System.Commons.InvalidConfigException | if the path to the Tracepoint library cannot be resolved. |
!:Arp.System.Commons.InvalidOperationException | if at least one tracing session still running. |
!:Arp.Exception | an internal error occurred while unloading the Tracepoint library. |