Use the new functions for default subbuf sizes.
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 2/3 Use the new functions for default subbuf sizes.
Use the functions added by the previous commit. All the occurences of the previous defines were replaced.
--- src/bin/lttng-sessiond/channel.c | 4 ++-- 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, 12 insertions(+), 12 deletions(-)
src/bin/lttng-sessiond/channel.c +2 -2
@@ -54,7 +54,7 @@ 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 =get_default_kernel_channel_subbuf_size (); chan->attr.num_subbuf =DEFAULT_KERNEL_CHANNEL_SUBBUF_NUM ; chan->attr.output =DEFAULT_KERNEL_CHANNEL_OUTPUT ;break ;
@@ -64,7 +64,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 =get_default_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 =get_default_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 =get_default_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" , +get_default_channel_subbuf_size (), +get_default_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 =get_default_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 =get_default_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 ); + ==get_default_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 ); + ==get_default_metadata_subbuf_size ());assert (metadata->attr.num_subbuf ==DEFAULT_METADATA_SUBBUF_NUM ); assert(metadata->attr.switch_timer_interval
Signature · 1 line
1.7.1
PATCH 3/3 Remove previous default subbuf sizes definitions.
In reply to a message not in the archiveThis commit removes defines that are now unused.
--- src/common/defaults.h | 5 ----- 1 files changed, 0 insertions(+), 5 deletions(-)
src/common/defaults.h +0 -5
@@ -98,15 +98,12 @@/* Default channel attributes */ #define DEFAULT_CHANNEL_NAME "channel0"#define DEFAULT_CHANNEL_OVERWRITE 0/* usec */ -/* DEFAULT_CHANNEL_SUBBUF_SIZE must always be a power of 2 */ -#define DEFAULT_CHANNEL_SUBBUF_SIZE 4096/* bytes */ /* DEFAULT_CHANNEL_SUBBUF_NUM must always be a power of 2 */ #define DEFAULT_CHANNEL_SUBBUF_NUM 4#define DEFAULT_CHANNEL_SWITCH_TIMER 0/* usec */ #define DEFAULT_CHANNEL_READ_TIMER 200/* usec */ #define DEFAULT_CHANNEL_OUTPUT LTTNG_EVENT_MMAP -#define DEFAULT_METADATA_SUBBUF_SIZE 4096#define DEFAULT_METADATA_SUBBUF_NUM 2size_t get_default_channel_subbuf_size (void );
@@ -128,8 +125,6 @@ size_t get_default_kernel_channel_subbuf_size(void);/* User space defaults */ -/* Must be a power of 2 */ -#define DEFAULT_UST_CHANNEL_SUBBUF_SIZE 4096/* bytes */ /* Must be a power of 2. Update help manuall if override. */ #define DEFAULT_UST_CHANNEL_SUBBUF_NUM DEFAULT_CHANNEL_SUBBUF_NUM/* See lttng-ust.h enum lttng_ust_output */
Signature · 1 line
1.7.1
Re: [PATCH 1/3] Add default subbuf sizes getter functions.
In reply to a message not in the archiveHi Simon,
Can you please rename the get_default_* function family to default_get_* in order to respect the name spacing of files.
Comment below:
Simon Marchi:
Quoted 50 lines
This patch adds
src/common/defaults.cfile. It contains functions to retrieve defaults subbuf sizes based on the architecture page size.Signed-off-by Simon Marchi <[email protected]>--- src/common/Makefile.am | 2 +- src/common/defaults.c | 86 ++++++++++++++++++++++++++++++++++++++++++++++++ src/common/defaults.h | 7 ++++ 3 files changed, 94 insertions(+), 1 deletions(-) create mode 100644 src/common/defaults.csrc/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.lasrc/common/defaults.c new file +20
-0@@ -0,0 +1,86 @@ +/* +* Copyright (C) 2012 - Simon Marchi <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License, version 2 only, +* as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, write to the Free Software Foundation, Inc., +* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +#include <stddef.h> +#include <unistd.h> +
src/common/defaults.c line 30
Quoted 10 lines
src/common/defaults.c new file +10
-0+#include "defaults.h" + +static size_t default_channel_subbuf_size; +static size_t default_metadata_subbuf_size; +static size_t default_kernel_channel_subbuf_size; +static size_t default_ust_channel_subbuf_size; + +static void __attribute__((constructor))init_defaults (void ) +{ + default_kernel_channel_subbuf_size =DEFAULT_KERNEL_CHANNEL_SUBBUF_SIZE ;
Why is the kernel getting a default value and not a page size ?
src/common/defaults.c line 40
Quoted 10 lines
src/common/defaults.c new file +10
-0+ +long page_size =sysconf (_SC_PAGESIZE); +if (page_size >0 ) { + default_channel_subbuf_size = page_size; + default_metadata_subbuf_size = page_size; + default_ust_channel_subbuf_size = page_size; + }else { + default_channel_subbuf_size =4096 ; + default_metadata_subbuf_size =4096 ; + default_ust_channel_subbuf_size =4096 ;
Should we use a default value for this 4096 size here with a DEFINE_*_SUBBUF_SIZE or... ?
Seems a bit odd that the kernel got a default define value but not UST and metadata.
Quoted 36 lines
src/common/defaults.c new file +36
-0+ } +} + +/* +* Returns the default subbuf size. +* +* This function depends on a value that is set at constructor time, so it is +* unsafe to call it from another constructor. +*/ +size_t get_default_channel_subbuf_size (void ) +{ +return default_channel_subbuf_size; +} + +/* +* Returns the default metadata subbuf size. +* +* This function depends on a value that is set at constructor time, so it is +* unsafe to call it from another constructor. +*/ +size_t get_default_metadata_subbuf_size (void ) +{ +return default_metadata_subbuf_size; +} + +/* +* Returns the default subbuf size for the kernel domain. +* +* This function depends on a value that is set at constructor time, so it is +* unsafe to call it from another constructor. +*/ +size_t get_default_kernel_channel_subbuf_size (void ) +{ +return default_kernel_channel_subbuf_size; +} +
src/common/defaults.c line 86
Quoted 10 lines
src/common/defaults.c new file +10
-0+/* +* Returns the default subbuf size for the UST domain. +* +* This function depends on a value that is set at constructor time, so it is +* unsafe to call it from another constructor. +*/ +size_t get_default_ust_channel_subbuf_size (void ) +{ +return default_ust_channel_subbuf_size; +}
I'm wondering if all these functions should be static inline in the default.h...
Thoughts?
Otherwise, the patch looks good!
Thanks
David
Quoted 32 lines
src/common/defaults.h +7
-0@@ -109,6 +109,9 @@#define DEFAULT_METADATA_SUBBUF_SIZE 4096#define DEFAULT_METADATA_SUBBUF_NUM 2 +size_t get_default_channel_subbuf_size (void ); +size_t get_default_metadata_subbuf_size (void ); +/* Kernel has different defaults */ /* DEFAULT_KERNEL_CHANNEL_SUBBUF_SIZE must always be a power of 2 */ @@ -121,6 +124,8 @@/* See lttng-kernel.h enum lttng_kernel_output for channel output */ #define DEFAULT_KERNEL_CHANNEL_OUTPUT LTTNG_EVENT_SPLICE +size_t get_default_kernel_channel_subbuf_size (void ); +/* User space defaults */ /* Must be a power of 2 */ @@ -130,6 +135,8 @@/* See lttng-ust.h enum lttng_ust_output */ #define DEFAULT_UST_CHANNEL_OUTPUT LTTNG_EVENT_MMAP +size_t get_default_ust_channel_subbuf_size (void ); +/* * Default timeout value for the sem_timedwait() call. Blocking forever is not * wanted so a timeout is used to control the data flow and not freeze the
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH 1/3] Add default subbuf sizes getter functions.
Quoted 4 lines · * David Goulet ([email protected]) wrote:
Hi Simon,
Can you please rename the get_default_* function family to default_get_* in order to respect the name spacing of files.
Also, Simon, please remove the "dot" at the end of the Title line of your patch.
Thanks,
Mathieu
Quoted 178 lines
Comment below:
Simon Marchi:
Quoted 50 lines
This patch adds
src/common/defaults.cfile. It contains functions to retrieve defaults subbuf sizes based on the architecture page size.Signed-off-by Simon Marchi <[email protected]>--- src/common/Makefile.am | 2 +- src/common/defaults.c | 86 ++++++++++++++++++++++++++++++++++++++++++++++++ src/common/defaults.h | 7 ++++ 3 files changed, 94 insertions(+), 1 deletions(-) create mode 100644 src/common/defaults.csrc/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.lasrc/common/defaults.c new file +20
-0@@ -0,0 +1,86 @@ +/* +* Copyright (C) 2012 - Simon Marchi <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License, version 2 only, +* as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, write to the Free Software Foundation, Inc., +* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +#include <stddef.h> +#include <unistd.h> +src/common/defaults.c line 30
Quoted 10 lines
src/common/defaults.c new file +10
-0+#include "defaults.h" + +static size_t default_channel_subbuf_size; +static size_t default_metadata_subbuf_size; +static size_t default_kernel_channel_subbuf_size; +static size_t default_ust_channel_subbuf_size; + +static void __attribute__((constructor))init_defaults (void ) +{ + default_kernel_channel_subbuf_size =DEFAULT_KERNEL_CHANNEL_SUBBUF_SIZE ;Why is the kernel getting a default value and not a page size ?
src/common/defaults.c line 40
Quoted 10 lines
src/common/defaults.c new file +10
-0+ +long page_size =sysconf (_SC_PAGESIZE); +if (page_size >0 ) { + default_channel_subbuf_size = page_size; + default_metadata_subbuf_size = page_size; + default_ust_channel_subbuf_size = page_size; + }else { + default_channel_subbuf_size =4096 ; + default_metadata_subbuf_size =4096 ; + default_ust_channel_subbuf_size =4096 ;Should we use a default value for this 4096 size here with a DEFINE_*_SUBBUF_SIZE or... ?
Seems a bit odd that the kernel got a default define value but not UST and metadata.
Quoted 36 lines
src/common/defaults.c new file +36
-0+ } +} + +/* +* Returns the default subbuf size. +* +* This function depends on a value that is set at constructor time, so it is +* unsafe to call it from another constructor. +*/ +size_t get_default_channel_subbuf_size (void ) +{ +return default_channel_subbuf_size; +} + +/* +* Returns the default metadata subbuf size. +* +* This function depends on a value that is set at constructor time, so it is +* unsafe to call it from another constructor. +*/ +size_t get_default_metadata_subbuf_size (void ) +{ +return default_metadata_subbuf_size; +} + +/* +* Returns the default subbuf size for the kernel domain. +* +* This function depends on a value that is set at constructor time, so it is +* unsafe to call it from another constructor. +*/ +size_t get_default_kernel_channel_subbuf_size (void ) +{ +return default_kernel_channel_subbuf_size; +} +src/common/defaults.c line 86
Quoted 10 lines
src/common/defaults.c new file +10
-0+/* +* Returns the default subbuf size for the UST domain. +* +* This function depends on a value that is set at constructor time, so it is +* unsafe to call it from another constructor. +*/ +size_t get_default_ust_channel_subbuf_size (void ) +{ +return default_ust_channel_subbuf_size; +}I'm wondering if all these functions should be static inline in the
default.h...Thoughts?
Otherwise, the patch looks good!
Thanks
DavidQuoted 24 lines
src/common/defaults.h +5
-0@@ -109,6 +109,9 @@#define DEFAULT_METADATA_SUBBUF_SIZE 4096#define DEFAULT_METADATA_SUBBUF_NUM 2 +size_t get_default_channel_subbuf_size (void ); +size_t get_default_metadata_subbuf_size (void ); +/* Kernel has different defaults */ /* DEFAULT_KERNEL_CHANNEL_SUBBUF_SIZE must always be a power of 2 */ @@ -121,6 +124,8 @@/* See lttng-kernel.h enum lttng_kernel_output for channel output */ #define DEFAULT_KERNEL_CHANNEL_OUTPUT LTTNG_EVENT_SPLICE +size_t get_default_kernel_channel_subbuf_size (void ); +/* User space defaults */ /* Must be a power of 2 */ src/common/defaults.h line 142
Quoted 8 lines
src/common/defaults.h +2
-0@@ -130,6 +135,8 @@/* See lttng-ust.h enum lttng_ust_output */ #define DEFAULT_UST_CHANNEL_OUTPUT LTTNG_EVENT_MMAP +size_t get_default_ust_channel_subbuf_size (void ); +/* * Default timeout value for the sem_timedwait() call. Blocking forever is not * wanted so a timeout is used to control the data flow and not freeze the _______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Signature · 4 lines
Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com
Re: [PATCH 1/3] Add default subbuf sizes getter functions.
In reply to a message not in the archiveHi David,
I just sent my v2 for this patch. I changed the logic so that it still uses the DEFAULT_*_SUBBUF_SIZE defines, but check that it is >= page size. It should answer your first two comments/questions.
I don't think it would help to put these inline, since they are only called in slow paths.
Simon
Quoted 182 lines
Hi Simon,
Can you please rename the get_default_* function family to default_get_* in order to respect the name spacing of files.
Comment below:
Simon Marchi:
Quoted 50 lines
This patch adds
src/common/defaults.cfile. It contains functions to retrieve defaults subbuf sizes based on the architecture page size.Signed-off-by Simon Marchi <[email protected]>--- src/common/Makefile.am | 2 +- src/common/defaults.c | 86 ++++++++++++++++++++++++++++++++++++++++++++++++ src/common/defaults.h | 7 ++++ 3 files changed, 94 insertions(+), 1 deletions(-) create mode 100644 src/common/defaults.csrc/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.lasrc/common/defaults.c new file +20
-0@@ -0,0 +1,86 @@ +/* +* Copyright (C) 2012 - Simon Marchi <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License, version 2 only, +* as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, write to the Free Software Foundation, Inc., +* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +#include <stddef.h> +#include <unistd.h> +src/common/defaults.c line 30
Quoted 10 lines
src/common/defaults.c new file +10
-0+#include "defaults.h" + +static size_t default_channel_subbuf_size; +static size_t default_metadata_subbuf_size; +static size_t default_kernel_channel_subbuf_size; +static size_t default_ust_channel_subbuf_size; + +static void __attribute__((constructor))init_defaults (void ) +{ + default_kernel_channel_subbuf_size =DEFAULT_KERNEL_CHANNEL_SUBBUF_SIZE ;Why is the kernel getting a default value and not a page size ?
src/common/defaults.c line 40
Quoted 10 lines
src/common/defaults.c new file +10
-0+ +long page_size =sysconf (_SC_PAGESIZE); +if (page_size >0 ) { + default_channel_subbuf_size = page_size; + default_metadata_subbuf_size = page_size; + default_ust_channel_subbuf_size = page_size; + }else { + default_channel_subbuf_size =4096 ; + default_metadata_subbuf_size =4096 ; + default_ust_channel_subbuf_size =4096 ;Should we use a default value for this 4096 size here with a DEFINE_*_SUBBUF_SIZE or... ?
Seems a bit odd that the kernel got a default define value but not UST and metadata.
Quoted 36 lines
src/common/defaults.c new file +36
-0+ } +} + +/* +* Returns the default subbuf size. +* +* This function depends on a value that is set at constructor time, so it is +* unsafe to call it from another constructor. +*/ +size_t get_default_channel_subbuf_size (void ) +{ +return default_channel_subbuf_size; +} + +/* +* Returns the default metadata subbuf size. +* +* This function depends on a value that is set at constructor time, so it is +* unsafe to call it from another constructor. +*/ +size_t get_default_metadata_subbuf_size (void ) +{ +return default_metadata_subbuf_size; +} + +/* +* Returns the default subbuf size for the kernel domain. +* +* This function depends on a value that is set at constructor time, so it is +* unsafe to call it from another constructor. +*/ +size_t get_default_kernel_channel_subbuf_size (void ) +{ +return default_kernel_channel_subbuf_size; +} +src/common/defaults.c line 86
Quoted 10 lines
src/common/defaults.c new file +10
-0+/* +* Returns the default subbuf size for the UST domain. +* +* This function depends on a value that is set at constructor time, so it is +* unsafe to call it from another constructor. +*/ +size_t get_default_ust_channel_subbuf_size (void ) +{ +return default_ust_channel_subbuf_size; +}I'm wondering if all these functions should be static inline in the
default.h...Thoughts?
Otherwise, the patch looks good!
Thanks
DavidQuoted 24 lines
src/common/defaults.h +5
-0@@ -109,6 +109,9 @@#define DEFAULT_METADATA_SUBBUF_SIZE 4096#define DEFAULT_METADATA_SUBBUF_NUM 2 +size_t get_default_channel_subbuf_size (void ); +size_t get_default_metadata_subbuf_size (void ); +/* Kernel has different defaults */ /* DEFAULT_KERNEL_CHANNEL_SUBBUF_SIZE must always be a power of 2 */ @@ -121,6 +124,8 @@/* See lttng-kernel.h enum lttng_kernel_output for channel output */ #define DEFAULT_KERNEL_CHANNEL_OUTPUT LTTNG_EVENT_SPLICE +size_t get_default_kernel_channel_subbuf_size (void ); +/* User space defaults */ /* Must be a power of 2 */ src/common/defaults.h line 142
Quoted 8 lines
src/common/defaults.h +2
-0@@ -130,6 +135,8 @@/* See lttng-ust.h enum lttng_ust_output */ #define DEFAULT_UST_CHANNEL_OUTPUT LTTNG_EVENT_MMAP +size_t get_default_ust_channel_subbuf_size (void ); +/* * Default timeout value for the sem_timedwait() call. Blocking forever is not * wanted so a timeout is used to control the data flow and not freeze the _______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
A message that is not in the archive (sent off-list or not yet received): CAFXXi0n6BWh=RF+vY_GXK2+Y=s8ZmJyqEH=Y_3D9DdyQztAyUQ@mail.gmail.com
Re: [PATCH 1/3] Add default subbuf sizes getter functions.
Quoted 8 lines · * Simon Marchi ([email protected]) wrote:
Hi David,
I just sent my v2 for this patch. I changed the logic so that it still uses the DEFAULT_*_SUBBUF_SIZE defines, but check that it is >= page size. It should answer your first two comments/questions.
I don't think it would help to put these inline, since they are only called in slow paths.
Even though those are slow paths, adding a symbol and function call just to fetch a variable seems overkill. I agree with David: those should be made static inline.
Thanks,
Mathieu
Quoted 190 lines
Simon
Quoted 172 lines
Hi Simon,
Can you please rename the get_default_* function family to default_get_* in order to respect the name spacing of files.
Comment below:
Simon Marchi:
Quoted 50 lines
This patch adds
src/common/defaults.cfile. It contains functions to retrieve defaults subbuf sizes based on the architecture page size.Signed-off-by Simon Marchi <[email protected]>--- src/common/Makefile.am | 2 +- src/common/defaults.c | 86 ++++++++++++++++++++++++++++++++++++++++++++++++ src/common/defaults.h | 7 ++++ 3 files changed, 94 insertions(+), 1 deletions(-) create mode 100644 src/common/defaults.csrc/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.lasrc/common/defaults.c new file +20
-0@@ -0,0 +1,86 @@ +/* +* Copyright (C) 2012 - Simon Marchi <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License, version 2 only, +* as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, write to the Free Software Foundation, Inc., +* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +#include <stddef.h> +#include <unistd.h> +src/common/defaults.c line 30
Quoted 10 lines
src/common/defaults.c new file +10
-0+#include "defaults.h" + +static size_t default_channel_subbuf_size; +static size_t default_metadata_subbuf_size; +static size_t default_kernel_channel_subbuf_size; +static size_t default_ust_channel_subbuf_size; + +static void __attribute__((constructor))init_defaults (void ) +{ + default_kernel_channel_subbuf_size =DEFAULT_KERNEL_CHANNEL_SUBBUF_SIZE ;Why is the kernel getting a default value and not a page size ?
src/common/defaults.c line 40
Quoted 10 lines
src/common/defaults.c new file +10
-0+ +long page_size =sysconf (_SC_PAGESIZE); +if (page_size >0 ) { + default_channel_subbuf_size = page_size; + default_metadata_subbuf_size = page_size; + default_ust_channel_subbuf_size = page_size; + }else { + default_channel_subbuf_size =4096 ; + default_metadata_subbuf_size =4096 ; + default_ust_channel_subbuf_size =4096 ;Should we use a default value for this 4096 size here with a DEFINE_*_SUBBUF_SIZE or... ?
Seems a bit odd that the kernel got a default define value but not UST and metadata.
Quoted 36 lines
src/common/defaults.c new file +36
-0+ } +} + +/* +* Returns the default subbuf size. +* +* This function depends on a value that is set at constructor time, so it is +* unsafe to call it from another constructor. +*/ +size_t get_default_channel_subbuf_size (void ) +{ +return default_channel_subbuf_size; +} + +/* +* Returns the default metadata subbuf size. +* +* This function depends on a value that is set at constructor time, so it is +* unsafe to call it from another constructor. +*/ +size_t get_default_metadata_subbuf_size (void ) +{ +return default_metadata_subbuf_size; +} + +/* +* Returns the default subbuf size for the kernel domain. +* +* This function depends on a value that is set at constructor time, so it is +* unsafe to call it from another constructor. +*/ +size_t get_default_kernel_channel_subbuf_size (void ) +{ +return default_kernel_channel_subbuf_size; +} +src/common/defaults.c line 86
Quoted 10 lines
src/common/defaults.c new file +10
-0+/* +* Returns the default subbuf size for the UST domain. +* +* This function depends on a value that is set at constructor time, so it is +* unsafe to call it from another constructor. +*/ +size_t get_default_ust_channel_subbuf_size (void ) +{ +return default_ust_channel_subbuf_size; +}I'm wondering if all these functions should be static inline in the
default.h...Thoughts?
Otherwise, the patch looks good!
Thanks
DavidQuoted 27 lines
src/common/defaults.h +5
-0@@ -109,6 +109,9 @@#define DEFAULT_METADATA_SUBBUF_SIZE 4096#define DEFAULT_METADATA_SUBBUF_NUM 2 +size_t get_default_channel_subbuf_size (void ); +size_t get_default_metadata_subbuf_size (void ); +/* Kernel has different defaults */ /* DEFAULT_KERNEL_CHANNEL_SUBBUF_SIZE must always be a power of 2 */ @@ -121,6 +124,8 @@/* See lttng-kernel.h enum lttng_kernel_output for channel output */ #define DEFAULT_KERNEL_CHANNEL_OUTPUT LTTNG_EVENT_SPLICE +size_t get_default_kernel_channel_subbuf_size (void ); +/* User space defaults */ /* Must be a power of 2 */ @@ -130,6 +135,8 @@/* See lttng-ust.h enum lttng_ust_output */ #define DEFAULT_UST_CHANNEL_OUTPUT LTTNG_EVENT_MMAPQuoted 10 lines
src/common/defaults.h line 142
Quoted 5 lines
src/common/defaults.h +2
-0+size_t get_default_ust_channel_subbuf_size (void ); +/* * Default timeout value for the sem_timedwait() call. Blocking forever is not * wanted so a timeout is used to control the data flow and not freeze the _______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Signature · 4 lines
Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com