Simple program to send a lot log messages to journald.
On my PC, it runs at about 35000 log entries per second.
Signed-off-by: 胡玮文 <huww98@outlook.com>
target_link_libraries(ceph_bench_log rt)
endif()
+add_executable(ceph_bench_journald_logger
+ bench_journald_logger.cc
+ )
+target_link_libraries(ceph_bench_journald_logger ceph-common)
+
# ceph_test_mutate
add_executable(ceph_test_mutate
test_mutate.cc
--- /dev/null
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
+#include "common/Journald.h"
+#include "log/Entry.h"
+#include "log/SubsystemMap.h"
+
+using namespace ceph::logging;
+
+int main()
+{
+ SubsystemMap subs;
+ JournaldLogger journald(&subs);
+
+ for (int i = 0; i < 100000; i++) {
+ MutableEntry entry(0, 0);
+ entry.get_ostream() << "This is log message " << i << ", which is a little bit looooooooo********ooooooooog and may contains multiple\nlines.";
+ journald.log_entry(entry);
+ }
+}