Add default subbuf sizes getter functions
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 2/3 Add default subbuf sizes getter functions
This patch adds functions to retrieve defaults subbuf sizes. It uses the DEFAULT_*_SUBBUF_SIZE defines from defaults.h but also make sure that the values are at least as big as the page size.
The functions are defined as static inline in defaults.h.
--- src/common/Makefile.am | 2 +- src/common/defaults.c | 50 +++++++++++++++++++++++++++++++++++++++++++ src/common/defaults.h | 55 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 106 insertions(+), 1 deletions(-) create mode 100644 src/common/defaults.c
src/common/Makefile.am +1 -1
@@ -12,7 +12,7 @@ noinst_HEADERS = lttng-kernel.h defaults.h macros.h error.h futex.h \ noinst_LTLIBRARIES = libcommon.la libcommon_la_SOURCES = error.h error.c utils.c utils.h runas.c runas.h \ - common.h futex.c futex.h uri.c uri.h + common.h futex.c futex.h uri.c uri.h defaults.c # Consumer library noinst_LTLIBRARIES += libconsumer.la
src/common/defaults.c new file +50 -0
50 lines not on this page · raw message
src/common/defaults.h +55 -0
59 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH 3/3 Use the new functions for default subbuf sizes
In reply to a message not in the archiveUse the functions added by the previous commit. All the occurences of the previous defines were replaced.
--- src/bin/lttng-sessiond/channel.c | 5 +++-- src/bin/lttng-sessiond/trace-kernel.c | 2 +- src/bin/lttng-sessiond/trace-ust.c | 2 +- src/bin/lttng/commands/enable_channels.c | 6 +++--- src/lib/lttng-ctl/lttng-ctl.c | 4 ++-- tests/tools/Makefile.am | 2 +- tests/tools/test_kernel_data_trace.c | 2 +- tests/tools/test_ust_data_trace.c | 2 +- 8 files changed, 13 insertions(+), 12 deletions(-)
src/bin/lttng-sessiond/channel.c +3 -2
@@ -54,7 +54,8 @@ struct lttng_channel *channel_new_default_attr(int dom)switch (dom) {case LTTNG_DOMAIN_KERNEL : - chan->attr.subbuf_size =DEFAULT_KERNEL_CHANNEL_SUBBUF_SIZE ; + chan->attr.subbuf_size = +default_get_kernel_channel_subbuf_size (); chan->attr.num_subbuf =DEFAULT_KERNEL_CHANNEL_SUBBUF_NUM ; chan->attr.output =DEFAULT_KERNEL_CHANNEL_OUTPUT ;break ;
@@ -64,7 +65,7 @@ struct lttng_channel *channel_new_default_attr(int dom)case LTTNG_DOMAIN_UST_PID_FOLLOW_CHILDREN :case LTTNG_DOMAIN_UST_EXEC_NAME :#endif - chan->attr.subbuf_size =DEFAULT_UST_CHANNEL_SUBBUF_SIZE ; + chan->attr.subbuf_size =default_get_ust_channel_subbuf_size (); chan->attr.num_subbuf =DEFAULT_UST_CHANNEL_SUBBUF_NUM ; chan->attr.output =DEFAULT_UST_CHANNEL_OUTPUT ;break ;
src/bin/lttng-sessiond/trace-kernel.c +1 -1
@@ -272,7 +272,7 @@ struct ltt_kernel_metadata *trace_kernel_create_metadata(void)/* Set default attributes */ chan->attr.overwrite =DEFAULT_CHANNEL_OVERWRITE ; - chan->attr.subbuf_size =DEFAULT_METADATA_SUBBUF_SIZE ; + chan->attr.subbuf_size =default_get_metadata_subbuf_size (); chan->attr.num_subbuf =DEFAULT_METADATA_SUBBUF_NUM ; chan->attr.switch_timer_interval =DEFAULT_CHANNEL_SWITCH_TIMER ; chan->attr.read_timer_interval =DEFAULT_CHANNEL_READ_TIMER ;
src/bin/lttng-sessiond/trace-ust.c +1 -1
@@ -311,7 +311,7 @@ struct ltt_ust_metadata *trace_ust_create_metadata(char *path)/* Set default attributes */ lum->attr.overwrite =DEFAULT_CHANNEL_OVERWRITE ; - lum->attr.subbuf_size =DEFAULT_METADATA_SUBBUF_SIZE ; + lum->attr.subbuf_size =default_get_metadata_subbuf_size (); lum->attr.num_subbuf =DEFAULT_METADATA_SUBBUF_NUM ; lum->attr.switch_timer_interval =DEFAULT_CHANNEL_SWITCH_TIMER ; lum->attr.read_timer_interval =DEFAULT_CHANNEL_READ_TIMER ;
src/bin/lttng/commands/enable_channels.c +3 -3
@@ -101,9 +101,9 @@ static void usage(FILE *ofp)fprintf (ofp," --overwrite Flight recorder mode%s\n" ,DEFAULT_CHANNEL_OVERWRITE ?" (default)" :"" );fprintf (ofp," --subbuf-size SIZE Subbuffer size in bytes\n" ); -fprintf (ofp," (default: %u, kernel default: %u)\n" , -DEFAULT_CHANNEL_SUBBUF_SIZE , -DEFAULT_KERNEL_CHANNEL_SUBBUF_SIZE ); +fprintf (ofp," (default: %zu, kernel default: %zu)\n" , +default_get_channel_subbuf_size (), +default_get_kernel_channel_subbuf_size ());fprintf (ofp," Needs to be a power of 2 for\n" );fprintf (ofp," kernel and ust tracers\n" );fprintf (ofp," --num-subbuf NUM Number of subbufers\n" );
src/lib/lttng-ctl/lttng-ctl.c +2 -2
@@ -1344,7 +1344,7 @@ void lttng_channel_set_default_attr(struct lttng_domain *domain, attr->switch_timer_interval =DEFAULT_CHANNEL_SWITCH_TIMER ; attr->read_timer_interval =DEFAULT_CHANNEL_READ_TIMER ; - attr->subbuf_size =DEFAULT_KERNEL_CHANNEL_SUBBUF_SIZE ; + attr->subbuf_size =default_get_kernel_channel_subbuf_size (); attr->num_subbuf =DEFAULT_KERNEL_CHANNEL_SUBBUF_NUM ; attr->output =DEFAULT_KERNEL_CHANNEL_OUTPUT ;break ;
@@ -1358,7 +1358,7 @@ void lttng_channel_set_default_attr(struct lttng_domain *domain, attr->switch_timer_interval =DEFAULT_CHANNEL_SWITCH_TIMER ; attr->read_timer_interval =DEFAULT_CHANNEL_READ_TIMER ; - attr->subbuf_size =DEFAULT_UST_CHANNEL_SUBBUF_SIZE ; + attr->subbuf_size =default_get_ust_channel_subbuf_size (); attr->num_subbuf =DEFAULT_UST_CHANNEL_SUBBUF_NUM ; attr->output =DEFAULT_UST_CHANNEL_OUTPUT ;break ;
tests/tools/Makefile.am +1 -1
@@ -27,7 +27,7 @@ test_sessions_LDADD = $(COMMON) $(HASHTABLE) $(SESSIOND_COMM) # Kernel trace data unit tests test_kernel_data_trace_SOURCES = test_kernel_data_trace.c $(UTILS) $(KERN_DATA_TRACE) -test_kernel_data_trace_LDADD = $(SESSIOND_COMM) $(HASHTABLE) +test_kernel_data_trace_LDADD = $(COMMON) $(SESSIOND_COMM) $(HASHTABLE) if HAVE_LIBLTTNG_UST_CTL noinst_PROGRAMS += test_ust_data_trace
tests/tools/test_kernel_data_trace.c +1 -1
@@ -99,7 +99,7 @@ static void create_kernel_metadata(void)assert (kern->metadata->conf->attr.overwrite ==DEFAULT_CHANNEL_OVERWRITE );assert (kern->metadata->conf->attr.subbuf_size - ==DEFAULT_METADATA_SUBBUF_SIZE ); + ==default_get_metadata_subbuf_size ());assert (kern->metadata->conf->attr.num_subbuf ==DEFAULT_METADATA_SUBBUF_NUM ); assert(kern->metadata->conf->attr.switch_timer_interval
tests/tools/test_ust_data_trace.c +1 -1
@@ -107,7 +107,7 @@ static void create_ust_metadata(void)assert (metadata->attr.overwrite ==DEFAULT_CHANNEL_OVERWRITE );assert (metadata->attr.subbuf_size - ==DEFAULT_METADATA_SUBBUF_SIZE ); + ==default_get_metadata_subbuf_size ());assert (metadata->attr.num_subbuf ==DEFAULT_METADATA_SUBBUF_NUM ); assert(metadata->attr.switch_timer_interval
Signature · 1 line
1.7.1
Re: [PATCH lttng-tools 1/3] Add max() and min() macro in common
In reply to a message not in the archiveAll three patches are now upstream!
Cheers
David
Simon Marchi:
Quoted 22 lines
Signed-off-by Simon Marchi <[email protected]>--- src/common/macros.h | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)src/common/macros.h +8
-0@@ -52,4 +52,12 @@#define ARRAY_SIZE (array) (sizeof(array) / (sizeof((array)[0])))#endif +#ifndef max +#define max (a, b) ((a) > (b) ? (a) : (b)) +#endif + +#ifndef min +#define min (a, b) ((a) < (b) ? (a) : (b)) +#endif +#endif /* _MACROS_H */