From 67f2321060321a87082e297151692ed9b36de2c0 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Sun, 22 Oct 2023 14:47:38 -0700 Subject: [PATCH] delete clocksd (#30252) --- README.md | 1 - SConstruct | 1 - release/files_common | 4 -- selfdrive/manager/process_config.py | 1 - selfdrive/test/test_onroad.py | 1 - system/clocksd/.gitignore | 1 - system/clocksd/SConscript | 2 - system/clocksd/clocksd.cc | 73 ----------------------------- 8 files changed, 84 deletions(-) delete mode 100644 system/clocksd/.gitignore delete mode 100644 system/clocksd/SConscript delete mode 100644 system/clocksd/clocksd.cc diff --git a/README.md b/README.md index 523f459f3b7dc4..7d051ada1472f2 100644 --- a/README.md +++ b/README.md @@ -109,7 +109,6 @@ Directory Structure ├── third_party # External libraries └── system # Generic services ├── camerad # Driver to capture images from the camera sensors - ├── clocksd # Broadcasts current time ├── hardware # Hardware abstraction classes ├── logcatd # systemd journal as a service ├── loggerd # Logger and uploader of car data diff --git a/SConstruct b/SConstruct index a086f8448a93cb..c0f1a070b258a2 100644 --- a/SConstruct +++ b/SConstruct @@ -382,7 +382,6 @@ SConscript(['rednose/SConscript']) # Build system services SConscript([ - 'system/clocksd/SConscript', 'system/proclogd/SConscript', 'system/ubloxd/SConscript', 'system/loggerd/SConscript', diff --git a/release/files_common b/release/files_common index 05bd463463c8dd..58585c95b40939 100644 --- a/release/files_common +++ b/release/files_common @@ -132,10 +132,6 @@ selfdrive/car/tesla/*.py selfdrive/car/toyota/*.py selfdrive/car/volkswagen/*.py -system/clocksd/.gitignore -system/clocksd/SConscript -system/clocksd/clocksd.cc - selfdrive/debug/can_printer.py selfdrive/debug/check_freq.py selfdrive/debug/dump.py diff --git a/selfdrive/manager/process_config.py b/selfdrive/manager/process_config.py index aee4748a26a157..883351cdbc6308 100644 --- a/selfdrive/manager/process_config.py +++ b/selfdrive/manager/process_config.py @@ -45,7 +45,6 @@ def only_offroad(started, params, CP: car.CarParams) -> bool: DaemonProcess("manage_athenad", "selfdrive.athena.manage_athenad", "AthenadPid"), NativeProcess("camerad", "system/camerad", ["./camerad"], driverview), - NativeProcess("clocksd", "system/clocksd", ["./clocksd"], only_onroad), NativeProcess("logcatd", "system/logcatd", ["./logcatd"], only_onroad), NativeProcess("proclogd", "system/proclogd", ["./proclogd"], only_onroad), PythonProcess("logmessaged", "system.logmessaged", always_run), diff --git a/selfdrive/test/test_onroad.py b/selfdrive/test/test_onroad.py index 4a9fc85d2ea006..0e1293ebc3386e 100755 --- a/selfdrive/test/test_onroad.py +++ b/selfdrive/test/test_onroad.py @@ -47,7 +47,6 @@ "selfdrive.monitoring.dmonitoringd": 4.0, "./proclogd": 1.54, "system.logmessaged": 0.2, - "./clocksd": 0.02, "selfdrive.tombstoned": 0, "./logcatd": 0, "system.micd": 10.0, diff --git a/system/clocksd/.gitignore b/system/clocksd/.gitignore deleted file mode 100644 index a6d841d65ea4f0..00000000000000 --- a/system/clocksd/.gitignore +++ /dev/null @@ -1 +0,0 @@ -clocksd diff --git a/system/clocksd/SConscript b/system/clocksd/SConscript deleted file mode 100644 index d1cf13e9e8428a..00000000000000 --- a/system/clocksd/SConscript +++ /dev/null @@ -1,2 +0,0 @@ -Import('env', 'common', 'cereal', 'messaging') -env.Program('clocksd.cc', LIBS=[common, cereal, messaging, 'capnp', 'zmq', 'kj']) diff --git a/system/clocksd/clocksd.cc b/system/clocksd/clocksd.cc deleted file mode 100644 index a5912cf51a0e14..00000000000000 --- a/system/clocksd/clocksd.cc +++ /dev/null @@ -1,73 +0,0 @@ -#include -#include -#include - -#include -#include - -// Apple doesn't have timerfd -#ifdef __APPLE__ -#include -#else -#include -#endif - -#include -#include - -#include "cereal/messaging/messaging.h" -#include "common/timing.h" -#include "common/util.h" - -ExitHandler do_exit; - -int main() { - setpriority(PRIO_PROCESS, 0, -13); - PubMaster pm({"clocks"}); - -#ifndef __APPLE__ - int timerfd = timerfd_create(CLOCK_BOOTTIME, 0); - assert(timerfd >= 0); - - struct itimerspec spec = {0}; - spec.it_interval.tv_sec = 1; - spec.it_interval.tv_nsec = 0; - spec.it_value.tv_sec = 1; - spec.it_value.tv_nsec = 0; - - int err = timerfd_settime(timerfd, 0, &spec, 0); - assert(err == 0); - - uint64_t expirations = 0; - while (!do_exit && (err = read(timerfd, &expirations, sizeof(expirations)))) { - if (err < 0) { - if (errno == EINTR) continue; - break; - } -#else - // Just run at 1Hz on apple - while (!do_exit) { - util::sleep_for(1000); -#endif - - uint64_t boottime = nanos_since_boot(); - uint64_t monotonic = nanos_monotonic(); - uint64_t monotonic_raw = nanos_monotonic_raw(); - uint64_t wall_time = nanos_since_epoch(); - - MessageBuilder msg; - auto clocks = msg.initEvent().initClocks(); - - clocks.setBootTimeNanos(boottime); - clocks.setMonotonicNanos(monotonic); - clocks.setMonotonicRawNanos(monotonic_raw); - clocks.setWallTimeNanos(wall_time); - - pm.send("clocks", msg); - } - -#ifndef __APPLE__ - close(timerfd); -#endif - return 0; -}