summaryrefslogtreecommitdiff
path: root/src/journal
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-11-27 01:54:25 +0100
committerLennart Poettering <lennart@poettering.net>2013-11-27 02:39:19 +0100
commitfbb634117d0b0ebd5b105e65b141e75ae9af7f8f (patch)
treed8026f0611673ee010019dd74f1211317f26ca7e /src/journal
parenteda4b58b50509dc8ad0428a46e20f6c5cf516d58 (diff)
journald: mention how long we needed to flush to /var in the logs
Diffstat (limited to 'src/journal')
-rw-r--r--src/journal/journald-server.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
index ce419d48d8..01e75b6629 100644
--- a/src/journal/journald-server.c
+++ b/src/journal/journald-server.c
@@ -970,9 +970,12 @@ static int system_journal_open(Server *s) {
}
int server_flush_to_var(Server *s) {
- int r;
sd_id128_t machine;
sd_journal *j = NULL;
+ char ts[FORMAT_TIMESPAN_MAX];
+ usec_t start;
+ unsigned n = 0;
+ int r;
assert(s);
@@ -990,6 +993,8 @@ int server_flush_to_var(Server *s) {
log_debug("Flushing to /var...");
+ start = now(CLOCK_MONOTONIC);
+
r = sd_id128_get_machine(&machine);
if (r < 0)
return r;
@@ -1009,6 +1014,8 @@ int server_flush_to_var(Server *s) {
f = j->current_file;
assert(f && f->current_offset > 0);
+ n++;
+
r = journal_file_move_to_object(f, OBJECT_ENTRY, f->current_offset, &o);
if (r < 0) {
log_error("Can't read entry: %s", strerror(-r));
@@ -1052,6 +1059,8 @@ finish:
sd_journal_close(j);
+ server_driver_message(s, SD_ID128_NULL, "Time spent on flushing to /var is %s for %u entries.", format_timespan(ts, sizeof(ts), now(CLOCK_MONOTONIC) - start, 0), n);
+
return r;
}