#define ZERO_COPY_DEVICE_NAME "/dev/zlogger"
+static inline uint64_t to_zlog_clock(struct timespec *t)
+{
+ return (uint64_t)t->tv_nsec + (uint64_t)t->tv_sec * NSEC_PER_SEC;
+}
+
static inline uint64_t get_zlog_clock(void)
{
struct timespec begin;
clock_gettime(CLOCK_MONOTONIC, &begin);
- return (uint64_t)begin.tv_nsec + (uint64_t)begin.tv_sec * NSEC_PER_SEC;
+ return to_zlog_clock(&begin);
}
-
static int zero_copy_write(log_id_t log_id, log_priority prio, const char *tag, const char *msg, struct timespec *tp_mono)
{
- // TODO: log_id and tp_mono ignored for now
+ // TODO: log_id ignored for now
/* TODO: drop zlogger_entry and just write
* dlogutil_entry directly. Needs kernel support
* for stdout logs though. */
- uint64_t ts = get_zlog_clock();
+ uint64_t ts = tp_mono ? to_zlog_clock(tp_mono) : get_zlog_clock();
const int tid = gettid();
size_t hd_size = sizeof(struct zlogger_entry);
size_t prio_size = 1;