libsysprof-capture: Add sysprof_collector_mark_{v,}printf() methods

These are just like `sysprof_collector_mark()`, but do the printf
formatting of the message internally, and only once the collector has
been fetched — so there is no overhead from the printf if sysprof is not
enabled at runtime.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
Philip Withnall
2020-07-02 20:30:41 +01:00
parent e8790bc3d6
commit 6fde9c5ce6
2 changed files with 83 additions and 0 deletions

View File

@ -56,6 +56,8 @@
#pragma once
#include <stdarg.h>
#include "sysprof-capture-types.h"
#include "sysprof-macros.h"
@ -77,6 +79,20 @@ void sysprof_collector_mark (int64_t time,
const char *group,
const char *mark,
const char *message);
SYSPROF_AVAILABLE_IN_3_38
void sysprof_collector_mark_printf (int64_t time,
int64_t duration,
const char *group,
const char *mark,
const char *message_format,
...) SYSPROF_PRINTF(5, 6);
SYSPROF_AVAILABLE_IN_3_38
void sysprof_collector_mark_vprintf (int64_t time,
int64_t duration,
const char *group,
const char *mark,
const char *message_format,
va_list args) SYSPROF_PRINTF(5, 0);
SYSPROF_AVAILABLE_IN_3_36
void sysprof_collector_log (int severity,
const char *domain,