All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: hi,I have some question about lttng
       [not found] <CAH3R=oerQZg1p-C-ERF73k6OHUNN49gcdcAwHescHryfcGVMvQ@mail.gmail.com>
@ 2012-08-21  8:54 ` Francis Giraldeau
       [not found] ` <50334CAD.70605@gmail.com>
  1 sibling, 0 replies; 4+ messages in thread
From: Francis Giraldeau @ 2012-08-21  8:54 UTC (permalink / raw)
  To: lttng-dev


[-- Attachment #1.1: Type: text/plain, Size: 1371 bytes --]

Le 2012-08-21 08:42, 寇晓晖 a écrit :
> Hi all:
> now my work need lttng ,and why lttng use macro like
> this:TRACEPOINT_EVENT(tracepoint_provider,event_name,…)?
> Except I can use any primitive C-type i want,is there any other
> adavantage about this macro type?

The macro is used as a way to generate the tracepoint code and data
structure. Once this is done once, you can insert as many tracepoint
call in your code. Have a look into lttng-ust/doc/examples.

> And how lttng improve performance
> compare other log system(specially efficiency ).I need detail
> information about this mechanism.Can anyone help me?

On my system (i5-540M) it takes about 250 nano second to write a simple
event. In comparison, the logging framework Poco::Logger for a similar
tracepoint requires about 12 micro second per event, roughtly 50x
slower. The performance of such a loggin framework is likely to drop
while increasing the number of concurrent threads, because the file is
locked to prevent race at each event, while LTTng uses per-CPU buffers
and has a lockless data structure and will scale perfectly.

So, if you want to log few error messages once in a while, a logging
library is fine. If you want trace requests or other high frequency
events in the system and have precise timestamps, then LTTng is better
suited.

BR,

Francis



[-- Attachment #1.2: Signature cryptographique S/MIME --]
[-- Type: application/pkcs7-signature, Size: 4489 bytes --]

[-- Attachment #2: Type: text/plain, Size: 155 bytes --]

_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

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

* Re: hi,I have some question about lttng
       [not found]   ` <CAH3R=odEeNo4N1=ei3LY1_fkJuhabEmyn9bMFZWE74XD0Qmqjg@mail.gmail.com>
@ 2012-08-22 11:12     ` Francis Giraldeau
       [not found]     ` <5034BE81.30701@gmail.com>
  1 sibling, 0 replies; 4+ messages in thread
From: Francis Giraldeau @ 2012-08-22 11:12 UTC (permalink / raw)
  To: 寇晓晖; +Cc: lttng-dev


[-- Attachment #1.1: Type: text/plain, Size: 2345 bytes --]

Le 2012-08-22 09:56, 寇晓晖 a écrit :
> 1.I already use this macro TRACEPOINT_EVENT(I have finished some
> program)in my code,but except these  usage your mentioned before,but
> When i need a new tracepoint() formation,i must define a corresponding
> macro TRACEPOINT_EVENT in header file.I need to change Argument Listing:
> TP_ARGS(...),and Fields Listing TP_FIELDS(...).Compare to Variadic
> Function like printf(...),it's too complicated and inconvenience.Is
> there any reason lttng chose this method?

Yes. First, it's typesafe. The compiler will tell you if arguments do
not match the signature. Also, the macro is used as a way to generates
metadata in the trace that describe the format and length of each
fields. It's less convenient than having varargs, but it's the most
performant and reliable.

> 2.Now we have a clusters environment,So company chose lttng as default
> log system.Is this sentence (while LTTng uses per-CPU buffers and has a
> lockless data structure and will scale perfectly.) your mentioned
> primary cause?If it is ,would you please explain me the detail about
> these.And if not,how lttng improve the performance.I want to know
> why,not comparison results.Thanks again for resolving my questions.

The details are very complicated, but to make a summary, mention that
you have a shared resource (like a buffer or a file) to write into, then
you need to protect it by locks. To avoid that, LTTng uses per-CPU
buffers. Let's say on a two cores system there are at most 2 threads
running concurrently at any time. Then, if they got each their own
buffer, they will not fight because they have their own buffer. The
other major aspect is about RCU data structure used, that is itself
lockless, is capable to allow concurrent read and write access to a data
structure and produces much less cache-line replication and misses than
normal lock. Please look at the LWN article on this for more details.

http://lwn.net/Articles/263130/

> And how did lttng consumerd work?

In a sentence, it's using splice system call to write blocks of memory
to disk.

> Why we need a macro
> TRACEPOINT_CREATE_PROBES in a new .c file.

It's just a way to compile the tracepoint code. It's boilerplate code
and the macro is taking care of generating this code.

Cheers,

Francis


[-- Attachment #1.2: Signature cryptographique S/MIME --]
[-- Type: application/pkcs7-signature, Size: 4489 bytes --]

[-- Attachment #2: Type: text/plain, Size: 155 bytes --]

_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

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

* Re: hi,I have some question about lttng
       [not found]     ` <5034BE81.30701@gmail.com>
@ 2012-08-22 11:53       ` Mathieu Desnoyers
  0 siblings, 0 replies; 4+ messages in thread
From: Mathieu Desnoyers @ 2012-08-22 11:53 UTC (permalink / raw)
  To: Francis Giraldeau; +Cc: lttng-dev

* Francis Giraldeau (francis.giraldeau@gmail.com) wrote:
> Le 2012-08-22 09:56, 寇晓晖 a écrit :
> > 1.I already use this macro TRACEPOINT_EVENT(I have finished some
> > program)in my code,but except these  usage your mentioned before,but
> > When i need a new tracepoint() formation,i must define a corresponding
> > macro TRACEPOINT_EVENT in header file.I need to change Argument Listing:
> > TP_ARGS(...),and Fields Listing TP_FIELDS(...).Compare to Variadic
> > Function like printf(...),it's too complicated and inconvenience.Is
> > there any reason lttng chose this method?
> 
> Yes. First, it's typesafe. The compiler will tell you if arguments do
> not match the signature. Also, the macro is used as a way to generates
> metadata in the trace that describe the format and length of each
> fields. It's less convenient than having varargs, but it's the most
> performant and reliable.
> 
> > 2.Now we have a clusters environment,So company chose lttng as default
> > log system.Is this sentence (while LTTng uses per-CPU buffers and has a
> > lockless data structure and will scale perfectly.) your mentioned
> > primary cause?If it is ,would you please explain me the detail about
> > these.And if not,how lttng improve the performance.I want to know
> > why,not comparison results.Thanks again for resolving my questions.
> 
> The details are very complicated, but to make a summary, mention that
> you have a shared resource (like a buffer or a file) to write into, then
> you need to protect it by locks. To avoid that, LTTng uses per-CPU
> buffers. Let's say on a two cores system there are at most 2 threads
> running concurrently at any time. Then, if they got each their own
> buffer, they will not fight because they have their own buffer. The
> other major aspect is about RCU data structure used, that is itself
> lockless, is capable to allow concurrent read and write access to a data
> structure and produces much less cache-line replication and misses than
> normal lock. Please look at the LWN article on this for more details.
> 
> http://lwn.net/Articles/263130/
> 
> > And how did lttng consumerd work?
> 
> In a sentence, it's using splice system call to write blocks of memory
> to disk.

FYI, lttng-modules (the kernel tracer) uses splice by default to
transport data from the buffers to file or to the network. lttng-ust
(userspace tracer) writes from memory mapped buffers to a file/network
socket.

Thanks,

Mathieu

> 
> > Why we need a macro
> > TRACEPOINT_CREATE_PROBES in a new .c file.
> 
> It's just a way to compile the tracepoint code. It's boilerplate code
> and the macro is taking care of generating this code.
> 
> Cheers,
> 
> Francis
> 



> _______________________________________________
> lttng-dev mailing list
> lttng-dev@lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


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

_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

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

* hi,I have some question about lttng
@ 2012-08-21  6:42 寇晓晖
  0 siblings, 0 replies; 4+ messages in thread
From: 寇晓晖 @ 2012-08-21  6:42 UTC (permalink / raw)
  To: lttng-dev


[-- Attachment #1.1: Type: text/plain, Size: 387 bytes --]

Hi all:
now my work need lttng ,and why lttng use macro like
this:TRACEPOINT_EVENT(tracepoint_provider,event_name,…)?
Except I can use any primitive C-type i want,is there any other adavantage
about this macro type?And how lttng improve performance compare other log
system(specially efficiency ).I need detail information about this
mechanism.Can anyone help me?

Best regard.

[-- Attachment #1.2: Type: text/html, Size: 558 bytes --]

[-- Attachment #2: Type: text/plain, Size: 155 bytes --]

_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

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

end of thread, other threads:[~2012-08-22 11:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CAH3R=oerQZg1p-C-ERF73k6OHUNN49gcdcAwHescHryfcGVMvQ@mail.gmail.com>
2012-08-21  8:54 ` hi,I have some question about lttng Francis Giraldeau
     [not found] ` <50334CAD.70605@gmail.com>
     [not found]   ` <CAH3R=odEeNo4N1=ei3LY1_fkJuhabEmyn9bMFZWE74XD0Qmqjg@mail.gmail.com>
2012-08-22 11:12     ` Francis Giraldeau
     [not found]     ` <5034BE81.30701@gmail.com>
2012-08-22 11:53       ` Mathieu Desnoyers
2012-08-21  6:42 寇晓晖

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.