Skip to content

feat: add TimeSlave process and libTSClient shm IPC channel#8

Open
gordon9901 wants to merge 4 commits intoeclipse-score:mainfrom
gordon9901:ecarx_gptp
Open

feat: add TimeSlave process and libTSClient shm IPC channel#8
gordon9901 wants to merge 4 commits intoeclipse-score:mainfrom
gordon9901:ecarx_gptp

Conversation

@gordon9901
Copy link
Copy Markdown
Contributor

@gordon9901 gordon9901 commented Mar 27, 2026

feat: introduce TimeSlave process and libTSClient IPC channel

Summary

This PR splits the gPTP protocol stack out of TimeDaemon into a new standalone process — TimeSlave — and introduces a lightweight shared-memory IPC library (libTSClient) so that TimeDaemon can consume PtpTimeInfo snapshots from TimeSlave without running the raw-socket protocol itself.

Changes

score/TimeSlave/ (new) A self-contained gPTP slave process (score::ts::TimeSlave) that:

  • Runs GptpEngine (existing RxThread + PdelayThread logic) to participate in IEEE 802.1AS protocol.
  • Includes platform implementations for both Linux and QNX (raw_socket, network_identity, phc_adjuster).
  • Exposes instrumentation (probe) and recording (recorder) capabilities.
  • Publishes PtpTimeInfo snapshots to shared memory via GptpIpcPublisher.

score/libTSClient/ (new) A process-boundary IPC library providing:

  • GptpIpcRegion — 64-byte cache-line-aligned shared memory layout with a seqlock (seq / seq_confirm) for lock-free single-writer / multi-reader access.
  • GptpIpcPublisher — creates and writes to the POSIX shared memory segment (used by TimeSlave).
  • GptpIpcReceiver — opens and reads from the segment with seqlock retry (used by TimeDaemon via RealPTPEngine).

score/TimeDaemon/code/ptp_machine/real/ (new)

  • RealPTPEngine — a PTPEngine-compatible adapter backed by GptpIpcReceiver.
  • GPTPRealMachine — type alias for PTPMachine<RealPTPEngine>, slotting cleanly into the existing TimeDaemon pipeline.
  • CreateGPTPRealMachine() — factory function for convenient construction.

score/TimeDaemon/code/common/BUILD, data_types/BUILD (modified) Widened Bazel visibility from //score/TimeDaemon:__subpackages__ to //score:__subpackages__ so that TimeSlave and libTSClient can reuse shared data types (PtpTimeInfo, etc.) without duplication.

score/TimeDaemon/code/ptp_machine/BUILD (modified) Added //score/TimeDaemon/code/ptp_machine/real:unit_test_suite to the aggregated test target.

Architecture

TimeSlave (new process)
  └── GptpEngine (RxThread + PdelayThread)
        └── GptpIpcPublisher  ──[POSIX shm / seqlock]──►  GptpIpcReceiver
                                                                 └── RealPTPEngine
                                                                       └── GPTPRealMachine
                                                                             └── TimeDaemon pipeline

Test Coverage

Component Line Coverage Function Coverage
ptp_machine/real 100.0% (3/3) 100.0% (1/1)
ptp_machine/real/details 97.6% (41/42) 100.0% (8/8)
libTSClient 87.2% (68/78) 100.0% (10/10)
TimeSlave/gptp 91.4% (170/186) 100.0% (13/13)
TimeSlave/gptp/details 96.9% (284/293) 87.5% (28/32)
TimeSlave/gptp/instrument 100.0% (21/21) 100.0% (6/6)
TimeSlave/gptp/record 100.0% (22/22) 100.0% (4/4)
Overall 94.4% (609/645) 94.6% (70/74)


Ticket:eclipse-score/score#2691

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 27, 2026

License Check Results

🚀 The license check job ran with the Bazel command:

bazel run //:license-check

Status: ⚠️ Needs Review

Click to expand output
[License Check Output]
2026/03/27 06:50:14 Downloading https://releases.bazel.build/8.3.0/release/bazel-8.3.0-linux-x86_64...
Extracting Bazel installation...
Starting local Bazel server (8.3.0) and connecting to it...
INFO: Invocation ID: c1f33f8d-0428-4030-bf53-f4f272c59b17
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
WARNING: For repository 'aspect_rules_lint', the root module requires module version aspect_rules_lint@1.5.3, but got aspect_rules_lint@2.0.0 in the resolved dependency graph. Please update the version in your MODULE.bazel or set --check_direct_dependencies=off
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Loading: 
Loading: 2 packages loaded
Loading: 2 packages loaded
    currently loading: 
Loading: 2 packages loaded
    currently loading: 
Loading: 2 packages loaded
    currently loading: 
Loading: 2 packages loaded
    currently loading: 
Analyzing: target //:license-check (3 packages loaded, 0 targets configured)
Analyzing: target //:license-check (3 packages loaded, 0 targets configured)

Analyzing: target //:license-check (27 packages loaded, 9 targets configured)

Analyzing: target //:license-check (73 packages loaded, 9 targets configured)

Analyzing: target //:license-check (88 packages loaded, 9 targets configured)

Analyzing: target //:license-check (91 packages loaded, 9 targets configured)

Analyzing: target //:license-check (148 packages loaded, 2654 targets configured)

Analyzing: target //:license-check (157 packages loaded, 7615 targets configured)

Analyzing: target //:license-check (169 packages loaded, 8037 targets configured)

Analyzing: target //:license-check (169 packages loaded, 8049 targets configured)

Analyzing: target //:license-check (169 packages loaded, 8049 targets configured)

Analyzing: target //:license-check (172 packages loaded, 9937 targets configured)

INFO: Analyzed target //:license-check (174 packages loaded, 10184 targets configured).
[1 / 1] no actions running
[12 / 16] checking cached actions
INFO: From Generating Dash formatted dependency file ...:
INFO: Successfully converted 2 packages from Cargo.lock to bazel-out/k8-fastbuild/bin/formatted.txt
[13 / 16] JavaToolchainCompileClasses external/rules_java+/toolchains/platformclasspath_classes; 0s disk-cache, processwrapper-sandbox
[14 / 16] checking cached actions
[14 / 16] [Prepa] JavaToolchainCompileBootClasspath external/rules_java+/toolchains/platformclasspath.jar
[15 / 16] Building license.check.license_check.jar (); 0s disk-cache, multiplex-worker
INFO: Found 1 target...
Target //:license.check.license_check up-to-date:
  bazel-bin/license.check.license_check
  bazel-bin/license.check.license_check.jar
INFO: Elapsed time: 38.652s, Critical Path: 2.34s
INFO: 16 processes: 12 internal, 3 processwrapper-sandbox, 1 worker.
INFO: Build completed successfully, 16 total actions
INFO: Running command line: bazel-bin/license.check.license_check ./formatted.txt <args omitted>
usage: org.eclipse.dash.licenses.cli.Main [-batch <int>] [-cd <url>]
       [-confidence <int>] [-ef <url>] [-excludeSources <sources>] [-help] [-lic
       <url>] [-project <shortname>] [-repo <url>] [-review] [-summary <file>]
       [-timeout <seconds>] [-token <token>]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant