summaryrefslogtreecommitdiff
path: root/src/basic/log.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2017-09-21 14:05:35 +0200
committerLennart Poettering <lennart@poettering.net>2017-09-22 15:28:05 +0200
commit915b1d0174af808dd4cbea1357490febfba7cdc0 (patch)
tree36dcaa7d3ab4b2ea4f12c7153f00475446eb10ce /src/basic/log.h
parent8e5430c4bd9d39a5e405794f9c883f48de5205d9 (diff)
downloadsystemd-915b1d0174af808dd4cbea1357490febfba7cdc0.tar.gz
core: whenever a unit terminates, log its consumed resources to the journal
This adds a new recognizable log message for each unit invocation that contains structured information about consumed resources of the unit as a whole after it terminated. This is particular useful for apps that want to figure out what the resource consumption of a unit given a specific invocation ID was. The log message is only generated for units that have at least one XyzAccounting= property turned on, and currently only covers IP traffic and CPU time metrics.
Diffstat (limited to 'src/basic/log.h')
-rw-r--r--src/basic/log.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/basic/log.h b/src/basic/log.h
index 186747ff8e..e3fd3203d0 100644
--- a/src/basic/log.h
+++ b/src/basic/log.h
@@ -187,6 +187,15 @@ int log_format_iovec(
const char *format,
va_list ap) _printf_(6, 0);
+int log_struct_iovec_internal(
+ int level,
+ int error,
+ const char *file,
+ int line,
+ const char *func,
+ const struct iovec input_iovec[],
+ size_t n_input_iovec);
+
/* This modifies the buffer passed! */
int log_dump_internal(
int level,
@@ -270,6 +279,11 @@ void log_assert_failed_return_realm(
error, __FILE__, __LINE__, __func__, __VA_ARGS__)
#define log_struct(level, ...) log_struct_errno(level, 0, __VA_ARGS__)
+#define log_struct_iovec_errno(level, error, iovec, n_iovec) \
+ log_struct_iovec_internal(LOG_REALM_PLUS_LEVEL(LOG_REALM, level), \
+ error, __FILE__, __LINE__, __func__, iovec, n_iovec)
+#define log_struct_iovec(level, iovec, n_iovec) log_struct_iovec_errno(level, 0, iovec, n_iovec)
+
/* This modifies the buffer passed! */
#define log_dump(level, buffer) \
log_dump_internal(LOG_REALM_PLUS_LEVEL(LOG_REALM, level), \