mirror of https://github.com/1okko/openpilot.git
delete clocksd (#30252)
This commit is contained in:
parent
964460c0c3
commit
67f2321060
|
@ -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
|
||||
|
|
|
@ -382,7 +382,6 @@ SConscript(['rednose/SConscript'])
|
|||
|
||||
# Build system services
|
||||
SConscript([
|
||||
'system/clocksd/SConscript',
|
||||
'system/proclogd/SConscript',
|
||||
'system/ubloxd/SConscript',
|
||||
'system/loggerd/SConscript',
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -45,7 +45,6 @@ procs = [
|
|||
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),
|
||||
|
|
|
@ -47,7 +47,6 @@ PROCS = {
|
|||
"selfdrive.monitoring.dmonitoringd": 4.0,
|
||||
"./proclogd": 1.54,
|
||||
"system.logmessaged": 0.2,
|
||||
"./clocksd": 0.02,
|
||||
"selfdrive.tombstoned": 0,
|
||||
"./logcatd": 0,
|
||||
"system.micd": 10.0,
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
clocksd
|
|
@ -1,2 +0,0 @@
|
|||
Import('env', 'common', 'cereal', 'messaging')
|
||||
env.Program('clocksd.cc', LIBS=[common, cereal, messaging, 'capnp', 'zmq', 'kj'])
|
|
@ -1,73 +0,0 @@
|
|||
#include <sys/resource.h>
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
|
||||
// Apple doesn't have timerfd
|
||||
#ifdef __APPLE__
|
||||
#include <thread>
|
||||
#else
|
||||
#include <sys/timerfd.h>
|
||||
#endif
|
||||
|
||||
#include <cassert>
|
||||
#include <chrono>
|
||||
|
||||
#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;
|
||||
}
|
Loading…
Reference in New Issue