public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
To: Ingo Molnar <mingo@elte.hu>
Cc: "Frank Ch. Eigler" <fche@redhat.com>,
	Paul Mundt <lethal@linux-sh.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Jes Sorensen <jes@sgi.com>, Andrew Morton <akpm@osdl.org>,
	Tom Zanussi <zanussi@us.ibm.com>,
	Richard J Moore <richardj_moore@uk.ibm.com>,
	Michel Dagenais <michel.dagenais@polymtl.ca>,
	Christoph Hellwig <hch@infradead.org>,
	Greg Kroah-Hartman <gregkh@suse.de>,
	Thomas Gleixner <tglx@linutronix.de>,
	William Cohen <wcohen@redhat.com>,
	"Martin J. Bligh" <mbligh@mbligh.org>
Subject: MARKER mechanism, try 2
Date: Mon, 18 Sep 2006 12:30:42 -0400	[thread overview]
Message-ID: <20060918163042.GA15192@Krystal> (raw)
In-Reply-To: <20060918150231.GA8197@elte.hu>

Hi Ingo,

I played a bit with my marker proof of concept, it now makes a lot more sense.
Here it is. Comments are welcome.

It supports 5 modes :

- marker becomes nothing
- marker calls printk
- marker calls a tracer
- marker puts a symbol (for kprobe)
- marker puts a symbol and 5 NOPS for a jump probe.


Mathieu

-----BEGIN-----


/* Macro example for instrumentation
 *
 * Version 0.0.2
 * 
 * Mathieu Desnoyers mathieu.desnoyers@polymtl.ca
 *
 * This is released under the GPL v2 (or better) license.
 */

#include <stdio.h>

/* This is an example of noop, get this from the current arch header */
#define GENERIC_NOP1    ".byte 0x90\n"


/* PUT THIS IN A INCLUDE/LINUX HEADER */

#define __stringify_1(x) #x //see include/linux/stringify.h
#define __stringify(x) __stringify_1(x)

#define KBUILD_BASENAME basename
#define KBUILD_MODNAME modulename

#define MARK_SYM(event)	\
  __asm__ ( "__mark_"__stringify(KBUILD_MODNAME)"_"__stringify(KBUILD_BASENAME)"_"#event":" )

/* With config menu mutual exclusion of choice */
#ifdef CONFIG_NOLOG
#define MARK(event, format, args...)
#endif

#ifdef CONFIG_PRINTLOG
#define MARK(event, format, args...) \
	printf(format, ##args);
#endif

#ifdef CONFIG_TRACELOG
#define MARK(event, format, args...) \
	trace_##event( args );
#endif

#ifdef CONFIG_KPROBELOG
#define MARK(event, format, args...) \
  { \
    MARK_SYM(event); \
  }
#endif

#ifdef CONFIG_JUMPPROBELOG
#define MARK(event, format, args...) \
  { \
    MARK_SYM(event); \
	  __asm__ ( GENERIC_NOP1 GENERIC_NOP1 GENERIC_NOP1 GENERIC_NOP1 GENERIC_NOP1 ); \
  }
#endif



/* PUT THIS IN A HEADER NEAR THE .C FILE */
#ifdef CONFIG_TRACELOG
static inline void trace_eventname(int a, char *b)
{
	/* log.... */
	printf("Tracing event : first arg %d, second arg %s", a, b);
}
#endif

/* PUT THIS IN THE .C FILE */

int main()
{
	int myint = 55;
	char * mystring = "blah";
	
	MARK(eventname, "%d %s", myint, mystring);
	
	printf("\n");

	return 0;
}





-----END-----



OpenPGP public key:              http://krystal.dyndns.org:8080/key/compudj.gpg
Key fingerprint:     8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68 

  parent reply	other threads:[~2006-09-18 16:30 UTC|newest]

Thread overview: 82+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-17  9:40 The emperor is naked: why *comprehensive* static markup belongs in mainline Karim Yaghmour
2006-09-17 11:21 ` Paul Mundt
2006-09-17 14:36   ` tracepoint maintainance models Ingo Molnar
2006-09-17 15:02     ` Roman Zippel
2006-09-17 15:09       ` Ingo Molnar
2006-09-17 17:18         ` Roman Zippel
2006-09-17 23:27           ` Ingo Molnar
2006-09-17 23:41           ` Ingo Molnar
2006-09-18  0:17             ` Roman Zippel
2006-09-18  9:01               ` Jes Sorensen
2006-09-17 20:37         ` Roman Zippel
2006-09-17 22:34           ` Ingo Molnar
2006-09-17 15:36     ` Mathieu Desnoyers
2006-09-18  0:07       ` Ingo Molnar
2006-09-18  1:12         ` Karim Yaghmour
2006-09-18  1:13           ` Ingo Molnar
2006-09-18  2:32             ` Karim Yaghmour
2006-09-18  2:57               ` Ingo Molnar
2006-09-18  3:54                 ` Karim Yaghmour
2006-09-18  4:09                   ` Ingo Molnar
2006-09-18  4:43                     ` Karim Yaghmour
2006-09-18  2:43             ` Mathieu Desnoyers
2006-09-18  3:21               ` Ingo Molnar
2006-09-18  4:26                 ` Mathieu Desnoyers
2006-09-18  5:08                   ` Ingo Molnar
2006-09-18 12:25             ` Frank Ch. Eigler
2006-09-18 15:02               ` Ingo Molnar
2006-09-18 15:45                 ` Mathieu Desnoyers
2006-09-18 15:48                 ` Alan Cox
2006-09-18 15:22                   ` Ingo Molnar
2006-09-18 16:19                     ` Alan Cox
2006-09-18 16:15                       ` Ingo Molnar
2006-09-18 17:02                         ` Alan Cox
2006-09-18 16:15                       ` Frank Ch. Eigler
2006-09-18 17:02                         ` Alan Cox
2006-09-18 17:27                           ` Frank Ch. Eigler
2006-09-18 18:04                             ` Alan Cox
2006-09-18 17:54                               ` Martin Bligh
2006-09-18 18:05                               ` Frank Ch. Eigler
2006-09-18 19:10                           ` Vara Prasad
2006-09-18 19:49                             ` Alan Cox
2006-09-18 19:39                               ` Frank Ch. Eigler
2006-09-18 20:28                               ` Vara Prasad
2006-10-06  5:33                                 ` Steven Rostedt
2006-10-06 13:01                                   ` Frank Ch. Eigler
2006-10-06 14:23                                     ` Steven Rostedt
2006-10-06 23:17                                   ` Jeremy Fitzhardinge
2006-09-18 15:47                   ` Frank Ch. Eigler
2006-09-18 15:42                     ` Ingo Molnar
2006-09-18 16:30                 ` Mathieu Desnoyers [this message]
2006-09-18 16:28                   ` MARKER mechanism, try 2 Ingo Molnar
2006-09-18 17:47                     ` Mathieu Desnoyers
2006-09-18 19:39                       ` Alan Cox
2006-09-17 20:19     ` tracepoint maintainance models Nicholas Miell
2006-09-17 23:06       ` Ingo Molnar
2006-09-18  0:05         ` Roman Zippel
2006-09-18  1:52           ` Theodore Tso
2006-09-19 12:58           ` tracing - consensus building insteat of dogfights Christoph Hellwig
2006-09-19 13:25             ` Roman Zippel
2006-09-19 13:45             ` Karim Yaghmour
2006-09-19 14:25               ` Karim Yaghmour
2006-09-18  0:10         ` tracepoint maintainance models Nicholas Miell
2006-09-18  0:43           ` Roman Zippel
2006-09-18  0:56         ` Karim Yaghmour
2006-09-18  0:56           ` Ingo Molnar
2006-09-18  2:09             ` Karim Yaghmour
2006-09-18  3:30               ` Ingo Molnar
2006-09-18  3:52                 ` Theodore Tso
2006-09-18  4:11                   ` Ingo Molnar
2006-09-18  4:24                   ` Karim Yaghmour
2006-09-18  4:32                     ` Ingo Molnar
2006-09-18  5:03                       ` LTTng and SystemTAP (Everyone who is scared to read this huge thread, skip to here) Mathieu Desnoyers
2006-09-18 15:11                         ` Ingo Molnar
2006-09-23 15:50                           ` Mathieu Desnoyers
2006-09-18  5:37                       ` tracepoint maintainance models Karim Yaghmour
2006-09-18 20:12                   ` Michel Dagenais
2006-09-18  4:14                 ` Karim Yaghmour
2006-09-18  4:09                   ` Ingo Molnar
2006-09-18  4:57                     ` Karim Yaghmour
2006-09-18  1:03   ` The emperor is naked: why *comprehensive* static markup belongs in mainline Karim Yaghmour
2006-09-18 15:53 ` Jose R. Santos
2006-09-18 17:28   ` Karim Yaghmour

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060918163042.GA15192@Krystal \
    --to=mathieu.desnoyers@polymtl.ca \
    --cc=akpm@osdl.org \
    --cc=fche@redhat.com \
    --cc=gregkh@suse.de \
    --cc=hch@infradead.org \
    --cc=jes@sgi.com \
    --cc=lethal@linux-sh.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mbligh@mbligh.org \
    --cc=michel.dagenais@polymtl.ca \
    --cc=mingo@elte.hu \
    --cc=richardj_moore@uk.ibm.com \
    --cc=tglx@linutronix.de \
    --cc=wcohen@redhat.com \
    --cc=zanussi@us.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox