Re: [RFC PATCH 2/3] Generic Trace Setup and Control (GTSC) code
On Fri, Jun 29, 2007 at 10:24:32PM -0500, Tom Zanussi wrote: > The Generic Tracing and Control Interface (GTSC) code. The code looks fine to me from a first look, but the the name is just dumb. Given that all your internal identifiers are trace_* or TRACE_ go all the way and make it CONFIG_TRACE and lib/trace.c aswell. Long term we probably want more complex tracing based on lttng, but I'm a big fan of starting out simple and doing incremental changes. So my 1c for merging this in 2.6.23 with the exports ripped out until we actually grow modular users (which will probably come with the blktrace markers conversion later on) > +static inline struct trace_info *trace_setup(const char *root, > + const char *name, > + u32 buf_size, > + u32 buf_nr, > + u32 flags) static inline struct trace_info *trace_setup(const char *root, const char *name, u32 buf_size, u32 buf_nr, u32 flags) > + * Based on blktrace code, Copyright (C) 2006 Jens Axboe <[EMAIL PROTECTED]> > + * Moved to utt.c by Tom Zanussi <[EMAIL PROTECTED]>, 2006 It's gstc.c now and should be trace.c, nevermind that filename doesn't really belong here anyway :) > +unsigned long long trace_timestamp(void) > +{ > + return sched_clock(); > +} > +EXPORT_SYMBOL_GPL(trace_timestamp); Using sched_clock is quite dangerous. And just adding a wrapper to get it exported is not nice either :) - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC PATCH 2/3] Generic Trace Setup and Control (GTSC) code
On Fri, Jun 29, 2007 at 10:24:32PM -0500, Tom Zanussi wrote: The Generic Tracing and Control Interface (GTSC) code. The code looks fine to me from a first look, but the the name is just dumb. Given that all your internal identifiers are trace_* or TRACE_ go all the way and make it CONFIG_TRACE and lib/trace.c aswell. Long term we probably want more complex tracing based on lttng, but I'm a big fan of starting out simple and doing incremental changes. So my 1c for merging this in 2.6.23 with the exports ripped out until we actually grow modular users (which will probably come with the blktrace markers conversion later on) +static inline struct trace_info *trace_setup(const char *root, + const char *name, + u32 buf_size, + u32 buf_nr, + u32 flags) static inline struct trace_info *trace_setup(const char *root, const char *name, u32 buf_size, u32 buf_nr, u32 flags) + * Based on blktrace code, Copyright (C) 2006 Jens Axboe [EMAIL PROTECTED] + * Moved to utt.c by Tom Zanussi [EMAIL PROTECTED], 2006 It's gstc.c now and should be trace.c, nevermind that filename doesn't really belong here anyway :) +unsigned long long trace_timestamp(void) +{ + return sched_clock(); +} +EXPORT_SYMBOL_GPL(trace_timestamp); Using sched_clock is quite dangerous. And just adding a wrapper to get it exported is not nice either :) - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC PATCH 2/3] Generic Trace Setup and Control (GTSC) code
* Tom Zanussi ([EMAIL PROTECTED]) wrote: > The Generic Tracing and Control Interface (GTSC) code. > > Signed-off-by: Tom Zanussi <[EMAIL PROTECTED]> > Signed-off-by: David Wilder <[EMAIL PROTECTED]> > --- > include/linux/gtsc.h | 104 + > lib/Kconfig | 10 > lib/Makefile |2 > lib/gtsc.c | 558 > +++ > 4 files changed, 674 insertions(+) > > +static ssize_t reset_consumed_write(struct file *filp, > + const char __user *buffer, > + size_t count, > + loff_t *ppos) > +{ > + struct trace_info *trace = filp->private_data; > + > + relay_reset_consumed(trace->rchan); > + > + return count; > +} > + > +struct file_operations reset_consumed_fops = { > + .owner = THIS_MODULE, > + .open = reset_consumed_open, > + .write = reset_consumed_write > +}; > + Quoting the header of relay_reset_consumed: + * NOTE: Care should be taken that the channel isn't actually + * being used by anything when this call is made. I can imagine relay saying "locking is not my problem", while GTSC whistle and looks away... ;) -- Mathieu Desnoyers Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC PATCH 2/3] Generic Trace Setup and Control (GTSC) code
Please see comments below, * Tom Zanussi ([EMAIL PROTECTED]) wrote: > The Generic Tracing and Control Interface (GTSC) code. > > Signed-off-by: Tom Zanussi <[EMAIL PROTECTED]> > Signed-off-by: David Wilder <[EMAIL PROTECTED]> > --- > include/linux/gtsc.h | 104 + > lib/Kconfig | 10 > lib/Makefile |2 > lib/gtsc.c | 558 > +++ > 4 files changed, 674 insertions(+) > > diff --git a/include/linux/gtsc.h b/include/linux/gtsc.h > new file mode 100644 > index 000..cbb2601 > --- /dev/null > +++ b/include/linux/gtsc.h > @@ -0,0 +1,104 @@ > +/* > + * GTSC defines and function prototypes > + * > + * Copyright (C) 2006 IBM Inc. > + * > + * Tom Zanussi <[EMAIL PROTECTED]> > + * Martin Hunt <[EMAIL PROTECTED]> > + * David Wilder <[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 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 St, Fifth Floor, Boston, MA 02110-1301 USA > + * > + */ > +#ifndef _LINUX_GTSC_H > +#define _LINUX_GTSC_H > + > +#include > + > +/* > + * GTSC channel flags > + */ > +#define TRACE_GLOBAL_CHANNEL 0x01 > +#define TRACE_FLIGHT_CHANNEL 0x02 > +#define TRACE_DISABLE_STATE 0x04 > + > +enum trace_state { > + TRACE_SETUP, > + TRACE_RUNNING, > + TRACE_STOPPED, > +}; > + > +#define TRACE_ROOT_NAME_SIZE 64 /* Max root dir identifier */ > +#define TRACE_NAME_SIZE 64 /* Max trace identifier */ > + > +/* > + * Global root user information > + */ > +struct trace_root { > + struct list_head list; > + char name[TRACE_ROOT_NAME_SIZE]; > + struct dentry *root; > + unsigned int users; > +}; > + > +/* > + * Client information > + */ > +struct trace_info { > + enum trace_state state; > + struct dentry *state_file; > + struct rchan *rchan; > + struct dentry *dir; > + struct dentry *dropped_file; > + struct dentry *reset_consumed_file; > + struct dentry *nr_sub_file; > + struct dentry *sub_size_file; > + atomic_t dropped; > + struct trace_root *root; > + void *private_data; > + unsigned int flags; > + unsigned int buf_size; > + unsigned int buf_nr; > +}; > + > +#ifdef CONFIG_GTSC > +static inline int trace_running(struct trace_info *trace) > +{ > + return trace->state == TRACE_RUNNING; > +} > +struct trace_info *trace_setup(const char *root, const char *name, > +u32 buf_size, u32 buf_nr, u32 flags); > +int trace_start(struct trace_info *trace); > +int trace_stop(struct trace_info *trace); > +void trace_cleanup_channel(struct trace_info *gt); > +void trace_cleanup(struct trace_info *gt); > +unsigned long long trace_timestamp(void); > +#else > +static inline struct trace_info *trace_setup(const char *root, > + const char *name, > + u32 buf_size, > + u32 buf_nr, > + u32 flags) > +{ > + return NULL; > +} > +static inline int trace_running(struct trace_info *trace) { return 0; } > +static inline int trace_start(struct trace_info *trace) { return -EINVAL; } > +static inline int trace_stop(struct trace_info *trace) {} > +static inline void trace_cleanup_channel(struct trace_info *trace) {} > +static inline void trace_cleanup(struct trace_info *trace) {} > +static inline unsigned long long trace_timestamp(void) { return 0; } > +#endif > + I don't see any correct case where functions such as trace_start or trace_stop should be declared empty. Correct dependencies on CONFIG_GTSC should probably be used. > +#endif > diff --git a/lib/Kconfig b/lib/Kconfig > index 2e7ae6b..b3931f3 100644 > --- a/lib/Kconfig > +++ b/lib/Kconfig > @@ -124,4 +124,14 @@ config HAS_DMA > depends on !NO_DMA > default y > > +config GTSC > + bool "Generic Trace Setup and Control" > + select RELAY > + select DEBUG_FS > + help > + This option provides support for the setup, teardown and control > + of tracing channels from kernel code. It also provides trace > + information and control to userspace via a set of debugfs control > + files. If unsure, say N. > + > endmenu > diff --git a/lib/Makefile b/lib/Makefile > index c8c8e20..d9e68fa 100644 > --- a/lib/Makefile > +++ b/lib/Makefile > @@ -62,6 +62,8 @@ obj-$(CONFIG_FAULT_INJECTION)
Re: [RFC PATCH 2/3] Generic Trace Setup and Control (GTSC) code
Please see comments below, * Tom Zanussi ([EMAIL PROTECTED]) wrote: The Generic Tracing and Control Interface (GTSC) code. Signed-off-by: Tom Zanussi [EMAIL PROTECTED] Signed-off-by: David Wilder [EMAIL PROTECTED] --- include/linux/gtsc.h | 104 + lib/Kconfig | 10 lib/Makefile |2 lib/gtsc.c | 558 +++ 4 files changed, 674 insertions(+) diff --git a/include/linux/gtsc.h b/include/linux/gtsc.h new file mode 100644 index 000..cbb2601 --- /dev/null +++ b/include/linux/gtsc.h @@ -0,0 +1,104 @@ +/* + * GTSC defines and function prototypes + * + * Copyright (C) 2006 IBM Inc. + * + * Tom Zanussi [EMAIL PROTECTED] + * Martin Hunt [EMAIL PROTECTED] + * David Wilder [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 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 St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ +#ifndef _LINUX_GTSC_H +#define _LINUX_GTSC_H + +#include linux/relay.h + +/* + * GTSC channel flags + */ +#define TRACE_GLOBAL_CHANNEL 0x01 +#define TRACE_FLIGHT_CHANNEL 0x02 +#define TRACE_DISABLE_STATE 0x04 + +enum trace_state { + TRACE_SETUP, + TRACE_RUNNING, + TRACE_STOPPED, +}; + +#define TRACE_ROOT_NAME_SIZE 64 /* Max root dir identifier */ +#define TRACE_NAME_SIZE 64 /* Max trace identifier */ + +/* + * Global root user information + */ +struct trace_root { + struct list_head list; + char name[TRACE_ROOT_NAME_SIZE]; + struct dentry *root; + unsigned int users; +}; + +/* + * Client information + */ +struct trace_info { + enum trace_state state; + struct dentry *state_file; + struct rchan *rchan; + struct dentry *dir; + struct dentry *dropped_file; + struct dentry *reset_consumed_file; + struct dentry *nr_sub_file; + struct dentry *sub_size_file; + atomic_t dropped; + struct trace_root *root; + void *private_data; + unsigned int flags; + unsigned int buf_size; + unsigned int buf_nr; +}; + +#ifdef CONFIG_GTSC +static inline int trace_running(struct trace_info *trace) +{ + return trace-state == TRACE_RUNNING; +} +struct trace_info *trace_setup(const char *root, const char *name, +u32 buf_size, u32 buf_nr, u32 flags); +int trace_start(struct trace_info *trace); +int trace_stop(struct trace_info *trace); +void trace_cleanup_channel(struct trace_info *gt); +void trace_cleanup(struct trace_info *gt); +unsigned long long trace_timestamp(void); +#else +static inline struct trace_info *trace_setup(const char *root, + const char *name, + u32 buf_size, + u32 buf_nr, + u32 flags) +{ + return NULL; +} +static inline int trace_running(struct trace_info *trace) { return 0; } +static inline int trace_start(struct trace_info *trace) { return -EINVAL; } +static inline int trace_stop(struct trace_info *trace) {} +static inline void trace_cleanup_channel(struct trace_info *trace) {} +static inline void trace_cleanup(struct trace_info *trace) {} +static inline unsigned long long trace_timestamp(void) { return 0; } +#endif + I don't see any correct case where functions such as trace_start or trace_stop should be declared empty. Correct dependencies on CONFIG_GTSC should probably be used. +#endif diff --git a/lib/Kconfig b/lib/Kconfig index 2e7ae6b..b3931f3 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -124,4 +124,14 @@ config HAS_DMA depends on !NO_DMA default y +config GTSC + bool Generic Trace Setup and Control + select RELAY + select DEBUG_FS + help + This option provides support for the setup, teardown and control + of tracing channels from kernel code. It also provides trace + information and control to userspace via a set of debugfs control + files. If unsure, say N. + endmenu diff --git a/lib/Makefile b/lib/Makefile index c8c8e20..d9e68fa 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -62,6 +62,8 @@ obj-$(CONFIG_FAULT_INJECTION) += fault-inject.o lib-$(CONFIG_GENERIC_BUG) += bug.o +obj-$(CONFIG_GTSC) += gtsc.o + hostprogs-y := gen_crc32table clean-files :=
Re: [RFC PATCH 2/3] Generic Trace Setup and Control (GTSC) code
* Tom Zanussi ([EMAIL PROTECTED]) wrote: The Generic Tracing and Control Interface (GTSC) code. Signed-off-by: Tom Zanussi [EMAIL PROTECTED] Signed-off-by: David Wilder [EMAIL PROTECTED] --- include/linux/gtsc.h | 104 + lib/Kconfig | 10 lib/Makefile |2 lib/gtsc.c | 558 +++ 4 files changed, 674 insertions(+) +static ssize_t reset_consumed_write(struct file *filp, + const char __user *buffer, + size_t count, + loff_t *ppos) +{ + struct trace_info *trace = filp-private_data; + + relay_reset_consumed(trace-rchan); + + return count; +} + +struct file_operations reset_consumed_fops = { + .owner = THIS_MODULE, + .open = reset_consumed_open, + .write = reset_consumed_write +}; + Quoting the header of relay_reset_consumed: + * NOTE: Care should be taken that the channel isn't actually + * being used by anything when this call is made. I can imagine relay saying locking is not my problem, while GTSC whistle and looks away... ;) -- Mathieu Desnoyers Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[RFC PATCH 2/3] Generic Trace Setup and Control (GTSC) code
The Generic Tracing and Control Interface (GTSC) code. Signed-off-by: Tom Zanussi <[EMAIL PROTECTED]> Signed-off-by: David Wilder <[EMAIL PROTECTED]> --- include/linux/gtsc.h | 104 + lib/Kconfig | 10 lib/Makefile |2 lib/gtsc.c | 558 +++ 4 files changed, 674 insertions(+) diff --git a/include/linux/gtsc.h b/include/linux/gtsc.h new file mode 100644 index 000..cbb2601 --- /dev/null +++ b/include/linux/gtsc.h @@ -0,0 +1,104 @@ +/* + * GTSC defines and function prototypes + * + * Copyright (C) 2006 IBM Inc. + * + * Tom Zanussi <[EMAIL PROTECTED]> + * Martin Hunt <[EMAIL PROTECTED]> + * David Wilder <[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 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 St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ +#ifndef _LINUX_GTSC_H +#define _LINUX_GTSC_H + +#include + +/* + * GTSC channel flags + */ +#define TRACE_GLOBAL_CHANNEL 0x01 +#define TRACE_FLIGHT_CHANNEL 0x02 +#define TRACE_DISABLE_STATE0x04 + +enum trace_state { + TRACE_SETUP, + TRACE_RUNNING, + TRACE_STOPPED, +}; + +#define TRACE_ROOT_NAME_SIZE 64 /* Max root dir identifier */ +#define TRACE_NAME_SIZE64 /* Max trace identifier */ + +/* + * Global root user information + */ +struct trace_root { + struct list_head list; + char name[TRACE_ROOT_NAME_SIZE]; + struct dentry *root; + unsigned int users; +}; + +/* + * Client information + */ +struct trace_info { + enum trace_state state; + struct dentry *state_file; + struct rchan *rchan; + struct dentry *dir; + struct dentry *dropped_file; + struct dentry *reset_consumed_file; + struct dentry *nr_sub_file; + struct dentry *sub_size_file; + atomic_t dropped; + struct trace_root *root; + void *private_data; + unsigned int flags; + unsigned int buf_size; + unsigned int buf_nr; +}; + +#ifdef CONFIG_GTSC +static inline int trace_running(struct trace_info *trace) +{ + return trace->state == TRACE_RUNNING; +} +struct trace_info *trace_setup(const char *root, const char *name, + u32 buf_size, u32 buf_nr, u32 flags); +int trace_start(struct trace_info *trace); +int trace_stop(struct trace_info *trace); +void trace_cleanup_channel(struct trace_info *gt); +void trace_cleanup(struct trace_info *gt); +unsigned long long trace_timestamp(void); +#else +static inline struct trace_info *trace_setup(const char *root, +const char *name, +u32 buf_size, +u32 buf_nr, +u32 flags) +{ + return NULL; +} +static inline int trace_running(struct trace_info *trace) { return 0; } +static inline int trace_start(struct trace_info *trace) { return -EINVAL; } +static inline int trace_stop(struct trace_info *trace) {} +static inline void trace_cleanup_channel(struct trace_info *trace) {} +static inline void trace_cleanup(struct trace_info *trace) {} +static inline unsigned long long trace_timestamp(void) { return 0; } +#endif + +#endif diff --git a/lib/Kconfig b/lib/Kconfig index 2e7ae6b..b3931f3 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -124,4 +124,14 @@ config HAS_DMA depends on !NO_DMA default y +config GTSC + bool "Generic Trace Setup and Control" + select RELAY + select DEBUG_FS + help + This option provides support for the setup, teardown and control + of tracing channels from kernel code. It also provides trace + information and control to userspace via a set of debugfs control + files. If unsure, say N. + endmenu diff --git a/lib/Makefile b/lib/Makefile index c8c8e20..d9e68fa 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -62,6 +62,8 @@ obj-$(CONFIG_FAULT_INJECTION) += fault-inject.o lib-$(CONFIG_GENERIC_BUG) += bug.o +obj-$(CONFIG_GTSC) += gtsc.o + hostprogs-y:= gen_crc32table clean-files:= crc32table.h diff --git a/lib/gtsc.c b/lib/gtsc.c new file mode 100644 index 000..ecd0ddf --- /dev/null +++ b/lib/gtsc.c @@ -0,0 +1,558 @@ +/* + * Based on blktrace code, Copyright (C) 2006 Jens Axboe <[EMAIL PROTECTED]> + * Moved to utt.c by Tom Zanussi <[EMAIL PROTECTED]>, 2006 + *
[RFC PATCH 2/3] Generic Trace Setup and Control (GTSC) code
The Generic Tracing and Control Interface (GTSC) code. Signed-off-by: Tom Zanussi [EMAIL PROTECTED] Signed-off-by: David Wilder [EMAIL PROTECTED] --- include/linux/gtsc.h | 104 + lib/Kconfig | 10 lib/Makefile |2 lib/gtsc.c | 558 +++ 4 files changed, 674 insertions(+) diff --git a/include/linux/gtsc.h b/include/linux/gtsc.h new file mode 100644 index 000..cbb2601 --- /dev/null +++ b/include/linux/gtsc.h @@ -0,0 +1,104 @@ +/* + * GTSC defines and function prototypes + * + * Copyright (C) 2006 IBM Inc. + * + * Tom Zanussi [EMAIL PROTECTED] + * Martin Hunt [EMAIL PROTECTED] + * David Wilder [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 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 St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ +#ifndef _LINUX_GTSC_H +#define _LINUX_GTSC_H + +#include linux/relay.h + +/* + * GTSC channel flags + */ +#define TRACE_GLOBAL_CHANNEL 0x01 +#define TRACE_FLIGHT_CHANNEL 0x02 +#define TRACE_DISABLE_STATE0x04 + +enum trace_state { + TRACE_SETUP, + TRACE_RUNNING, + TRACE_STOPPED, +}; + +#define TRACE_ROOT_NAME_SIZE 64 /* Max root dir identifier */ +#define TRACE_NAME_SIZE64 /* Max trace identifier */ + +/* + * Global root user information + */ +struct trace_root { + struct list_head list; + char name[TRACE_ROOT_NAME_SIZE]; + struct dentry *root; + unsigned int users; +}; + +/* + * Client information + */ +struct trace_info { + enum trace_state state; + struct dentry *state_file; + struct rchan *rchan; + struct dentry *dir; + struct dentry *dropped_file; + struct dentry *reset_consumed_file; + struct dentry *nr_sub_file; + struct dentry *sub_size_file; + atomic_t dropped; + struct trace_root *root; + void *private_data; + unsigned int flags; + unsigned int buf_size; + unsigned int buf_nr; +}; + +#ifdef CONFIG_GTSC +static inline int trace_running(struct trace_info *trace) +{ + return trace-state == TRACE_RUNNING; +} +struct trace_info *trace_setup(const char *root, const char *name, + u32 buf_size, u32 buf_nr, u32 flags); +int trace_start(struct trace_info *trace); +int trace_stop(struct trace_info *trace); +void trace_cleanup_channel(struct trace_info *gt); +void trace_cleanup(struct trace_info *gt); +unsigned long long trace_timestamp(void); +#else +static inline struct trace_info *trace_setup(const char *root, +const char *name, +u32 buf_size, +u32 buf_nr, +u32 flags) +{ + return NULL; +} +static inline int trace_running(struct trace_info *trace) { return 0; } +static inline int trace_start(struct trace_info *trace) { return -EINVAL; } +static inline int trace_stop(struct trace_info *trace) {} +static inline void trace_cleanup_channel(struct trace_info *trace) {} +static inline void trace_cleanup(struct trace_info *trace) {} +static inline unsigned long long trace_timestamp(void) { return 0; } +#endif + +#endif diff --git a/lib/Kconfig b/lib/Kconfig index 2e7ae6b..b3931f3 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -124,4 +124,14 @@ config HAS_DMA depends on !NO_DMA default y +config GTSC + bool Generic Trace Setup and Control + select RELAY + select DEBUG_FS + help + This option provides support for the setup, teardown and control + of tracing channels from kernel code. It also provides trace + information and control to userspace via a set of debugfs control + files. If unsure, say N. + endmenu diff --git a/lib/Makefile b/lib/Makefile index c8c8e20..d9e68fa 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -62,6 +62,8 @@ obj-$(CONFIG_FAULT_INJECTION) += fault-inject.o lib-$(CONFIG_GENERIC_BUG) += bug.o +obj-$(CONFIG_GTSC) += gtsc.o + hostprogs-y:= gen_crc32table clean-files:= crc32table.h diff --git a/lib/gtsc.c b/lib/gtsc.c new file mode 100644 index 000..ecd0ddf --- /dev/null +++ b/lib/gtsc.c @@ -0,0 +1,558 @@ +/* + * Based on blktrace code, Copyright (C) 2006 Jens Axboe [EMAIL PROTECTED] + * Moved to utt.c by Tom Zanussi [EMAIL PROTECTED], 2006 + *