Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: kosaki.motohiro@jp.fujitsu.com (KOSAKI Motohiro)
Subject: [ltt-dev] [PATCH] LTTng optimize write to page function
Date: Wed,  4 Feb 2009 17:09:59 +0900 (JST)	[thread overview]
Message-ID: <20090204155207.ECC6.KOSAKI.MOTOHIRO@jp.fujitsu.com> (raw)
In-Reply-To: <20090204054422.GD8231@Krystal>

> 
> void testfct_memcpy(void)
> {
>         asm ("/* begin */");
>         memcpy(dataout, datain, sizea);
>         asm ("/* end */");
> }
> 
> Turns into a function call because the size is not statically known :
> 
>         movslq  sizea(%rip),%rdx
>         movq    $datain, %rsi
>         movq    $dataout, %rdi
>         call    memcpy
> 
> 
> Below, when a constant is passed, both behave similarly :
> 
> void testfct_ltt_const(void)
> {
>         asm ("/* begin */");
>         ltt_relay_do_copy(dataout, datain, 8);
>         asm ("/* end*/");
> }
> 
>         movq    datain(%rip), %rax
>         movq    %rax, dataout(%rip)
> 
> 
> void testfct_memcpy_const(void)
> {
>         asm ("/* begin */");
>         memcpy(dataout, datain, 8);
>         asm ("/* end */");
> }
> 
>         movq    datain(%rip), %rax
>         movq    %rax, dataout(%rip)
> 
> 
> Therefore, I agree that when memcpy is passed a constant, it will do
> the same as my ltt_relay_do_copy. However, when we know we usually
> expect sizes of 1, 2, 4 and 8 bytes (unknown at compile-time), the jump
> table saves the costly function call to memcpy.

Thank you for good clarification!!

So, I hope to this result append to patch description.
I guess many lkml guys like this interesting analysis and result :)







  reply	other threads:[~2009-02-04  8:09 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-03 17:10 Mathieu Desnoyers
2009-02-03 17:47 ` [ltt-dev] [PATCH] LTTng optimize write to page function (v2) Mathieu Desnoyers
2009-02-04  1:12 ` [ltt-dev] [PATCH] LTTng optimize write to page function Lai Jiangshan
2009-02-04  2:35   ` Mathieu Desnoyers
2009-02-04  3:53     ` Mathieu Desnoyers
2009-02-04  4:07     ` Zhaolei
2009-02-04  4:53       ` Mathieu Desnoyers
2009-02-04  4:34 ` KOSAKI Motohiro
2009-02-04  5:44   ` Mathieu Desnoyers
2009-02-04  8:09     ` KOSAKI Motohiro [this message]
2009-02-04 17:54       ` Mathieu Desnoyers

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=20090204155207.ECC6.KOSAKI.MOTOHIRO@jp.fujitsu.com \
    --to=kosaki.motohiro@jp.fujitsu.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