My ftrace log shows that kdbus_meta_append(), is one of dominant functions in sending a message, while the other is kdbus_conn_queue_alloc(). This patch adds an extra argument to kdbus_hello() utility function and allows us to explicitly specify meta information attached to a message for performance evaluation.
Signed-off-by: AKASHI Takahiro <takahiro.aka...@linaro.org> --- test/kdbus-util.c | 35 +++++++++++++++++++++-------------- test/kdbus-util.h | 2 ++ 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/test/kdbus-util.c b/test/kdbus-util.c index 2cac8be..ef5e0b7 100644 --- a/test/kdbus-util.c +++ b/test/kdbus-util.c @@ -31,7 +31,7 @@ int lib_verbose = 0; #define POOL_SIZE (16 * 1024LU * 1024LU) static struct conn * -__kdbus_hello(const char *path, uint64_t flags, +__kdbus_hello(const char *path, uint64_t flags, uint64_t attach_flags, const struct kdbus_item *item, size_t item_size) { int fd, ret; @@ -58,17 +58,7 @@ __kdbus_hello(const char *path, uint64_t flags, h.hello.conn_flags = flags | KDBUS_HELLO_ACCEPT_FD; - h.hello.attach_flags = KDBUS_ATTACH_TIMESTAMP | - KDBUS_ATTACH_CREDS | - KDBUS_ATTACH_NAMES | - KDBUS_ATTACH_COMM | - KDBUS_ATTACH_EXE | - KDBUS_ATTACH_CMDLINE | - KDBUS_ATTACH_CAPS | - KDBUS_ATTACH_CGROUP | - KDBUS_ATTACH_SECLABEL | - KDBUS_ATTACH_AUDIT | - KDBUS_ATTACH_CONN_NAME; + h.hello.attach_flags = attach_flags; h.type = KDBUS_ITEM_CONN_NAME; h.size = KDBUS_ITEM_HEADER_SIZE + sizeof(h.comm); @@ -109,7 +99,24 @@ __kdbus_hello(const char *path, uint64_t flags, struct conn *kdbus_hello(const char *path, uint64_t flags) { - return __kdbus_hello(path, flags, NULL, 0); + uint64_t attach_flags = (KDBUS_ATTACH_TIMESTAMP | + KDBUS_ATTACH_CREDS | + KDBUS_ATTACH_NAMES | + KDBUS_ATTACH_COMM | + KDBUS_ATTACH_EXE | + KDBUS_ATTACH_CMDLINE | + KDBUS_ATTACH_CAPS | + KDBUS_ATTACH_CGROUP | + KDBUS_ATTACH_SECLABEL | + KDBUS_ATTACH_AUDIT | + KDBUS_ATTACH_CONN_NAME); + return __kdbus_hello(path, flags, attach_flags, NULL, 0); +} + +struct conn *kdbus_hello2(const char *path, uint64_t flags, + uint64_t attach_flags) +{ + return __kdbus_hello(path, flags, attach_flags, NULL, 0); } static struct conn * @@ -144,7 +151,7 @@ kdbus_hello_registrar(const char *path, const char *name, item = KDBUS_ITEM_NEXT(item); } - return __kdbus_hello(path, flags, items, size); + return __kdbus_hello(path, flags, 0 /*FIXME*/, items, size); } struct conn *kdbus_hello_activator(const char *path, const char *name, diff --git a/test/kdbus-util.h b/test/kdbus-util.h index be6ccab..3f9ff78 100644 --- a/test/kdbus-util.h +++ b/test/kdbus-util.h @@ -49,6 +49,8 @@ char *msg_id(uint64_t id, char *buf); int msg_send(const struct conn *conn, const char *name, uint64_t cookie, uint64_t flags, uint64_t timeout, int64_t priority, uint64_t dst_id); struct conn *kdbus_hello(const char *path, uint64_t hello_flags); +struct conn *kdbus_hello2(const char *path, uint64_t hello_flags, + uint64_t attach_flags); struct conn *kdbus_hello_activator(const char *path, const char *name, const struct kdbus_policy_access *access, size_t num_access); -- 1.7.9.5 _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel