All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC patch 00/32] TRACE_EVENT: cleanup for code-size reduction
@ 2011-05-02 21:11 Mathieu Desnoyers
  2011-05-02 21:11 ` [RFC patch 02/32] trace event sample remove semicolons, specify need for ifdef around declarations Mathieu Desnoyers
                   ` (31 more replies)
  0 siblings, 32 replies; 57+ messages in thread
From: Mathieu Desnoyers @ 2011-05-02 21:11 UTC (permalink / raw)
  To: LKML, Steven Rostedt; +Cc: Ingo Molnar, Thomas Gleixner, Frederic Weisbecker

Hi,

I implemented the TRACE_EVENT macros as arrays of fields and arrays of
events in LTTng, and realised that it could benefit Ftrace too by
cutting down its code size. As I know that code size footprint is an
issue Steven has been wanting to tackle for a while, I am sending this
"semicolon removal" patchset, which is a prerequisite to be able to
generate arrays of events.

The main difference between the approaches Ftrace and LTTng have taken
is that Ftrace creates a "ftrace_define_fields_##call" function for each
event which calls trace_define_field for each field of each event. In
LTTng, I did the following (code snippet from [1]):

struct lttng_event_field {
        const char *name;
        const struct lttng_type type;
};

struct lttng_event_desc {
        const struct lttng_event_field *fields;
        const char *name;
        unsigned int nr_fields;
};

#undef DEFINE_EVENT
#define DEFINE_EVENT(_template, _name, _proto, _args)                          \
                {                                                              \
                        .fields = __event_fields___##_template,                \
                        .name = #_name,                                        \
                        .nr_fields = ARRAY_SIZE(__event_fields___##_template), \
                },

#define TP_ID1(_token, _system) _token##_system
#define TP_ID(_token, _system)  TP_ID1(_token, _system)

static const struct lttng_event_desc TP_ID(__event_desc___, TRACE_SYSTEM)[] = {
#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
};

And for creation of __event_fields___##_template, which allows to keep
all fields in another array (which should be defined in a phase prior to
the event array definition), I did:

#undef __field
#define __field(_type, _item)                                   \
        { .name = #_item, .type = { .atype = atype_integer, .name = #_type} },

(similar for __field_ext, __array, __dynamic_array, __string)

#undef TP_STRUCT__entry
#define TP_STRUCT__entry(args...) args  /* Only one used in this phase */

#undef DECLARE_EVENT_CLASS
#define DECLARE_EVENT_CLASS(_name, _proto, _args, _tstruct, _assign, _print) \
        static const struct lttng_event_field __event_fields___##_name[] = { \
                _tstruct \
        };

For the declaration of struct lttng_type, which contains the field type
information in a union, see [2].

Best regards,

Mathieu

[1] http://git.lttng.org/?p=lttng-modules.git;a=blob;f=probes/lttng-events.h;h=a05c29d56771b89807ffef035b7cd6df34a0b97f;hb=HEAD
[2] http://git.lttng.org/?p=lttng-modules.git;a=blob;f=probes/lttng-types.h;h=0192bffaf2f321f446f71a13901e2ab09fd69663;hb=HEAD
-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com

^ permalink raw reply	[flat|nested] 57+ messages in thread
* [RFC patch 00/32] TRACE_EVENT: cleanup for code-size reduction (v2)
@ 2011-05-03 23:10 Mathieu Desnoyers
  2011-05-03 23:10 ` [RFC patch 14/32] trace event power remove semicolons Mathieu Desnoyers
  0 siblings, 1 reply; 57+ messages in thread
From: Mathieu Desnoyers @ 2011-05-03 23:10 UTC (permalink / raw)
  To: LKML, Steven Rostedt; +Cc: Thomas Gleixner, Frederic Weisbecker, Ingo Molnar

Hi,

I implemented the TRACE_EVENT macros as arrays of fields and arrays of
events in LTTng, and realised that it could benefit Ftrace too by
cutting down its code size. As I know that code size footprint is an
issue Steven has been wanting to tackle for a while, I am sending this
"semicolon removal" patchset, which is a prerequisite to be able to
generate arrays of events.

* Changelog since v1
  - Removed all ifdefs around declarations (it is now _only_ a semicolon
    removal patchset).

The main difference between the approaches Ftrace and LTTng have taken
is that Ftrace creates a "ftrace_define_fields_##call" function for each
event which calls trace_define_field for each field of each event. In
LTTng, I did the following (code snippet from [1]):

struct lttng_event_field {
        const char *name;
        const struct lttng_type type;
};
struct lttng_event_desc {
        const struct lttng_event_field *fields;
        const char *name;
        unsigned int nr_fields;
};
#undef DEFINE_EVENT
#define DEFINE_EVENT(_template, _name, _proto, _args)                          \
                {                                                              \
                        .fields = __event_fields___##_template,                \
                        .name = #_name,                                        \
                        .nr_fields = ARRAY_SIZE(__event_fields___##_template), \
                },
#define TP_ID1(_token, _system) _token##_system
#define TP_ID(_token, _system)  TP_ID1(_token, _system)

static const struct lttng_event_desc TP_ID(__event_desc___, TRACE_SYSTEM)[] = {
#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
};
And for creation of __event_fields___##_template, which allows to keep
all fields in another array (which should be defined in a phase prior to
the event array definition), I did:

#undef __field
#define __field(_type, _item)                                   \
        { .name = #_item, .type = { .atype = atype_integer, .name = #_type} },
(similar for __field_ext, __array, __dynamic_array, __string)

#undef TP_STRUCT__entry
#define TP_STRUCT__entry(args...) args  /* Only one used in this phase */
#undef DECLARE_EVENT_CLASS
#define DECLARE_EVENT_CLASS(_name, _proto, _args, _tstruct, _assign, _print) \
        static const struct lttng_event_field __event_fields___##_name[] = { \
                _tstruct \
        };
For the declaration of struct lttng_type, which contains the field type
information in a union, see [2].

Best regards,

Mathieu

[1] http://git.lttng.org/?p=lttng-modules.git;a=blob;f=probes/lttng-events.h;h=a05c29d56771b89807ffef035b7cd6df34a0b97f;hb=HEAD
[2] http://git.lttng.org/?p=lttng-modules.git;a=blob;f=probes/lttng-types.h;h=0192bffaf2f321f446f71a13901e2ab09fd69663;hb=HEAD

-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com

^ permalink raw reply	[flat|nested] 57+ messages in thread

end of thread, other threads:[~2011-05-03 23:18 UTC | newest]

Thread overview: 57+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-02 21:11 [RFC patch 00/32] TRACE_EVENT: cleanup for code-size reduction Mathieu Desnoyers
2011-05-02 21:11 ` [RFC patch 02/32] trace event sample remove semicolons, specify need for ifdef around declarations Mathieu Desnoyers
2011-05-03 14:31   ` Steven Rostedt
2011-05-02 21:11 ` [RFC patch 03/32] trace event block remove semicolumns Mathieu Desnoyers
2011-05-02 21:11 ` [RFC patch 04/32] trace event ext4 remove semicolons Mathieu Desnoyers
2011-05-02 21:11 ` [RFC patch 05/32] trace event irq " Mathieu Desnoyers
2011-05-02 21:11 ` [RFC patch 06/32] trace event jbd2 " Mathieu Desnoyers
2011-05-02 21:11 ` [RFC patch 07/32] trace event kmem " Mathieu Desnoyers
2011-05-02 21:11 ` [RFC patch 08/32] trace event kvm " Mathieu Desnoyers
2011-05-02 21:11 ` [RFC patch 09/32] trace event lock " Mathieu Desnoyers
2011-05-02 21:11 ` [RFC patch 10/32] trace event mce " Mathieu Desnoyers
2011-05-02 21:11 ` [RFC patch 11/32] trace event module " Mathieu Desnoyers
2011-05-02 21:11 ` [RFC patch 12/32] trace event napi " Mathieu Desnoyers
2011-05-03 12:26   ` Neil Horman
2011-05-02 21:11 ` [RFC patch 13/32] trace event net " Mathieu Desnoyers
2011-05-03 12:27   ` Neil Horman
2011-05-02 21:11 ` [RFC patch 14/32] trace event power " Mathieu Desnoyers
2011-05-03 12:59   ` Pihet-XID, Jean
2011-05-02 21:11 ` [RFC patch 15/32] trace event sched remove trailing semicolon Mathieu Desnoyers
2011-05-02 21:11 ` [RFC patch 16/32] trace event scsi remove semicolons Mathieu Desnoyers
2011-05-02 21:11 ` [RFC patch 17/32] trace event signal " Mathieu Desnoyers
2011-05-02 21:11 ` [RFC patch 18/32] trace event skb " Mathieu Desnoyers
2011-05-03 12:27   ` Neil Horman
2011-05-02 21:11 ` [RFC patch 19/32] trace event syscalls " Mathieu Desnoyers
2011-05-02 21:11 ` [RFC patch 20/32] trace event timer " Mathieu Desnoyers
2011-05-02 21:11 ` [RFC patch 21/32] trace event vmscan " Mathieu Desnoyers
2011-05-02 21:11 ` [RFC patch 22/32] trace event workqueue " Mathieu Desnoyers
2011-05-03  8:25   ` Tejun Heo
2011-05-02 21:11 ` [RFC patch 23/32] trace event writeback " Mathieu Desnoyers
2011-05-02 21:11 ` [RFC patch 24/32] trace event wireless " Mathieu Desnoyers
2011-05-02 21:11 ` [RFC patch 25/32] trace event video gpu " Mathieu Desnoyers
2011-05-02 21:11 ` [RFC patch 26/32] trace event gfs2 " Mathieu Desnoyers
2011-05-03 10:14   ` Steven Whitehouse
2011-05-03 21:13     ` Mathieu Desnoyers
2011-05-02 21:11 ` [RFC patch 27/32] trace event xfs " Mathieu Desnoyers
2011-05-02 21:11 ` [RFC patch 28/32] trace event powerpc " Mathieu Desnoyers
2011-05-02 21:11 ` [RFC patch 29/32] trace event asoc " Mathieu Desnoyers
2011-05-03 13:21   ` Mark Brown
2011-05-03 14:06     ` Mathieu Desnoyers
2011-05-03 14:14       ` Mark Brown
2011-05-03 14:24         ` Mark Brown
2011-05-03 14:34           ` Steven Rostedt
2011-05-03 21:29             ` Mathieu Desnoyers
2011-05-03 20:57           ` Mathieu Desnoyers
2011-05-03 21:30             ` Mathieu Desnoyers
2011-05-03 14:30       ` Steven Rostedt
2011-05-03 14:29   ` Mark Brown
2011-05-02 21:11 ` [RFC patch 30/32] trace event compaction " Mathieu Desnoyers
2011-05-02 21:11 ` [RFC patch 31/32] trace event regulator " Mathieu Desnoyers
2011-05-03 14:30   ` Mark Brown
2011-05-02 21:11 ` [RFC patch 32/32] trace event btrfs " Mathieu Desnoyers
     [not found] ` <20110502213211.250108074@efficios.com>
2011-05-03 14:07   ` [RFC patch 01/32] TRACE_EVENT: gradual semicolon removal Mathieu Desnoyers
2011-05-03 14:37     ` Steven Rostedt
2011-05-03 14:53       ` Mark Brown
     [not found]   ` <1304422337.25414.2382.camel@gandalf.stny.rr.com>
2011-05-03 21:26     ` Mathieu Desnoyers
2011-05-03 22:01       ` Frederic Weisbecker
  -- strict thread matches above, loose matches on Subject: below --
2011-05-03 23:10 [RFC patch 00/32] TRACE_EVENT: cleanup for code-size reduction (v2) Mathieu Desnoyers
2011-05-03 23:10 ` [RFC patch 14/32] trace event power remove semicolons Mathieu Desnoyers

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.