common: remove statlog (#30774)

* common: remove statlog

* fix release
This commit is contained in:
Adeeb Shihadeh 2023-12-16 23:33:55 -08:00 committed by GitHub
parent 4b54c0b3cd
commit a07060b24b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 2 additions and 82 deletions

View File

@ -2,7 +2,6 @@ Import('env', 'envCython', 'arch')
common_libs = [
'params.cc',
'statlog.cc',
'swaglog.cc',
'util.cc',
'i2c.cc',

View File

@ -1,47 +0,0 @@
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include "common/statlog.h"
#include "common/util.h"
#include <cstdarg>
#include <stdio.h>
#include <mutex>
#include <zmq.h>
class StatlogState : public LogState {
public:
StatlogState() : LogState("ipc:///tmp/stats") {}
};
static StatlogState s = {};
static void log(const char* metric_type, const char* metric, const char* fmt, ...) {
std::lock_guard lk(s.lock);
if (!s.initialized) s.initialize();
char* value_buf = nullptr;
va_list args;
va_start(args, fmt);
int ret = vasprintf(&value_buf, fmt, args);
va_end(args);
if (ret > 0 && value_buf) {
char* line_buf = nullptr;
ret = asprintf(&line_buf, "%s:%s|%s", metric, value_buf, metric_type);
if (ret > 0 && line_buf) {
zmq_send(s.sock, line_buf, ret, ZMQ_NOBLOCK);
free(line_buf);
}
free(value_buf);
}
}
void statlog_log(const char* metric_type, const char* metric, int value) {
log(metric_type, metric, "%d", value);
}
void statlog_log(const char* metric_type, const char* metric, float value) {
log(metric_type, metric, "%f", value);
}

View File

@ -1,10 +0,0 @@
#pragma once
#define STATLOG_GAUGE "g"
#define STATLOG_SAMPLE "sa"
void statlog_log(const char* metric_type, const char* metric, int value);
void statlog_log(const char* metric_type, const char* metric, float value);
#define statlog_gauge(metric, value) statlog_log(STATLOG_GAUGE, metric, value)
#define statlog_sample(metric, value) statlog_log(STATLOG_SAMPLE, metric, value)

View File

@ -127,30 +127,8 @@ selfdrive/debug/vw_mqb_config.py
common/SConscript
common/version.h
common/prefix.h
common/swaglog.h
common/swaglog.cc
common/statlog.h
common/statlog.cc
common/util.cc
common/util.h
common/queue.h
common/clutil.cc
common/clutil.h
common/params.h
common/params.cc
common/ratekeeper.cc
common/ratekeeper.h
common/watchdog.cc
common/watchdog.h
common/mat.h
common/timing.h
common/gpio.cc
common/gpio.h
common/i2c.cc
common/i2c.h
common/*.h
common/*.cc
selfdrive/controls/__init__.py
selfdrive/controls/controlsd.py