All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Stefan Seefeld <stefan_seefeld@mentor.com>
Cc: lttng-dev@lists.lttng.org
Subject: Re: [PATCH lttng-ust] Add trace support for calloc and	realloc.
Date: Wed, 7 Aug 2013 14:35:43 -0400	[thread overview]
Message-ID: <20130807183543.GA2517__12829.7005584047$1375900602$gmane$org@Krystal> (raw)
In-Reply-To: <52027EE6.60704@mentor.com>

* Stefan Seefeld (stefan_seefeld@mentor.com) wrote:
> On 08/07/2013 11:50 AM, Mathieu Desnoyers wrote:
> 
> > I notice that memalign and posix_memalign are missing. Do you have plans
> > to add them ?
> 
> Here is a patch adding those two.

merged, thanks!

By the way, we usually don't put "dots" at the end of the patch title.
No biggie, I removed it from the changelog.

Thanks,

Mathieu

> 
> 	Stefan
> 
> 
> -- 
> Stefan Seefeld
> CodeSourcery / Mentor Graphics
> http://www.mentor.com/embedded-software/

> From 10b4f91ea710b484a7e31fca68f55a2b58d026cd Mon Sep 17 00:00:00 2001
> From: Stefan Seefeld <stefan_seefeld@mentor.com>
> Date: Wed, 7 Aug 2013 13:05:34 -0400
> Subject: [PATCH] Add trace support for memalign and posix_memalign.
> 
> Signed-off-by: Stefan Seefeld <stefan_seefeld@mentor.com>
> ---
>  liblttng-ust-libc-wrapper/lttng-ust-malloc.c | 34 ++++++++++++++++++++++++++++
>  liblttng-ust-libc-wrapper/ust_libc.h         | 19 ++++++++++++++++
>  2 files changed, 53 insertions(+)
> 
> diff --git a/liblttng-ust-libc-wrapper/lttng-ust-malloc.c b/liblttng-ust-libc-wrapper/lttng-ust-malloc.c
> index 4fe8fa9..33ed18b 100644
> --- a/liblttng-ust-libc-wrapper/lttng-ust-malloc.c
> +++ b/liblttng-ust-libc-wrapper/lttng-ust-malloc.c
> @@ -133,3 +133,37 @@ void *realloc(void *ptr, size_t size)
>  	tracepoint(ust_libc, realloc, ptr, size, retval);
>  	return retval;
>  }
> +
> +void *memalign(size_t alignment, size_t size)
> +{
> +	static void *(*plibc_memalign)(size_t alignment, size_t size);
> +	void *retval;
> +
> +	if (plibc_memalign == NULL) {
> +		plibc_memalign = dlsym(RTLD_NEXT, "memalign");
> +		if (plibc_memalign == NULL) {
> +			fprintf(stderr, "memalignwrap: unable to find memalign\n");
> +			return NULL;
> +		}
> +	}
> +	retval = plibc_memalign(alignment, size);
> +	tracepoint(ust_libc, memalign, alignment, size, retval);
> +	return retval;
> +}
> +
> +int posix_memalign(void **memptr, size_t alignment, size_t size)
> +{
> +	static int(*plibc_posix_memalign)(void **memptr, size_t alignment, size_t size);
> +	int retval;
> +
> +	if (plibc_posix_memalign == NULL) {
> +		plibc_posix_memalign = dlsym(RTLD_NEXT, "posix_memalign");
> +		if (plibc_posix_memalign == NULL) {
> +			fprintf(stderr, "posix_memalignwrap: unable to find posix_memalign\n");
> +			return ENOMEM;
> +		}
> +	}
> +	retval = plibc_posix_memalign(memptr, alignment, size);
> +	tracepoint(ust_libc, posix_memalign, *memptr, alignment, size, retval);
> +	return retval;
> +}
> diff --git a/liblttng-ust-libc-wrapper/ust_libc.h b/liblttng-ust-libc-wrapper/ust_libc.h
> index d2096a3..a8ff9c6 100644
> --- a/liblttng-ust-libc-wrapper/ust_libc.h
> +++ b/liblttng-ust-libc-wrapper/ust_libc.h
> @@ -65,6 +65,25 @@ TRACEPOINT_EVENT(ust_libc, realloc,
>  	)
>  )
>  
> +TRACEPOINT_EVENT(ust_libc, memalign,
> +	TP_ARGS(size_t, alignment, size_t, size, void *, ptr),
> +	TP_FIELDS(
> +		ctf_integer(size_t, alignment, alignment)
> +		ctf_integer(size_t, size, size)
> +		ctf_integer_hex(void *, ptr, ptr)
> +	)
> +)
> +
> +TRACEPOINT_EVENT(ust_libc, posix_memalign,
> +	TP_ARGS(void *, out_ptr, size_t, alignment, size_t, size, int, result),
> +	TP_FIELDS(
> +		ctf_integer_hex(void *, out_ptr, out_ptr)
> +		ctf_integer(size_t, alignment, alignment)
> +		ctf_integer(size_t, size, size)
> +		ctf_integer(int, result, result)
> +	)
> +)
> +
>  #endif /* _TRACEPOINT_UST_LIBC_H */
>  
>  #undef TRACEPOINT_INCLUDE
> -- 
> 1.8.3.1
> 


-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

  parent reply	other threads:[~2013-08-07 18:35 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <51F3585E.20705@mentor.com>
2013-07-29 23:19 ` [PATCH lttng-ust] Add trace support for calloc and realloc Jérémie Galarneau
     [not found] ` <CA+jJMxtn-DsBjzunLNE3_7KS4RCqAFLJfPL7fVkH3z62r0jPxw@mail.gmail.com>
2013-07-30 21:12   ` Stefan Seefeld
     [not found]   ` <51F82C45.6020502@mentor.com>
2013-07-31  2:14     ` Jérémie Galarneau
     [not found]     ` <CA+jJMxtMH5Ajgoszg8pO8dq-KsrTg9NwS2YcYOz=FbLr0ijaEQ@mail.gmail.com>
2013-08-01 16:26       ` Alexander Monakov
     [not found]       ` <alpine.LNX.2.00.1308012013380.9574@monopod.intra.ispras.ru>
2013-08-01 16:32         ` Stefan Seefeld
     [not found]         ` <51FA8DAE.3070409@mentor.com>
2013-08-01 17:08           ` Alexander Monakov
     [not found]           ` <alpine.LNX.2.00.1308012045570.9574@monopod.intra.ispras.ru>
2013-08-01 17:19             ` Alexander Monakov
     [not found]             ` <alpine.LNX.2.00.1308012115300.9574@monopod.intra.ispras.ru>
2013-08-01 17:28               ` Stefan Seefeld
     [not found]               ` <51FA9AD8.4010502@mentor.com>
2013-08-01 17:57                 ` Alexander Monakov
     [not found]                 ` <CABtfrpDg_NOi+yP5GABmjBv6G9Zj+rvTwc1OdQ1s_9DM7uzeZg@mail.gmail.com>
2013-08-03  1:18                   ` Mathieu Desnoyers
     [not found]                   ` <20130803011841.GE9033@Krystal>
2013-08-05 14:57                     ` Stefan Seefeld
2013-08-05 15:29                     ` Stefan Seefeld
     [not found]                     ` <51FFBD46.5030105@mentor.com>
2013-08-07  1:42                       ` Mathieu Desnoyers
     [not found]                       ` <20130807014241.GH19407@Krystal>
2013-08-07 13:37                         ` Stefan Seefeld
     [not found]                         ` <52024D88.8090409@seefeld.name>
2013-08-07 13:57                           ` Mathieu Desnoyers
     [not found]                           ` <20130807135757.GA32387@Krystal>
2013-08-07 14:01                             ` Stefan Seefeld
     [not found]                     ` <51FFC4DB.7080905@mentor.com>
2013-08-07 14:47                       ` Stefan Seefeld
     [not found]                       ` <52025E03.7090201@mentor.com>
2013-08-07 15:50                         ` Mathieu Desnoyers
     [not found]                         ` <20130807155057.GB1035@Krystal>
2013-08-07 15:56                           ` Stefan Seefeld
2013-08-07 17:07                           ` Stefan Seefeld
     [not found]                           ` <52027EE6.60704@mentor.com>
2013-08-07 18:35                             ` Mathieu Desnoyers [this message]
2013-07-27  5:19 Stefan Seefeld

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='20130807183543.GA2517__12829.7005584047$1375900602$gmane$org@Krystal' \
    --to=mathieu.desnoyers@efficios.com \
    --cc=lttng-dev@lists.lttng.org \
    --cc=stefan_seefeld@mentor.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 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.