[lttng-dev] hi,I have some question about lttng
Mathieu Desnoyers
mathieu.desnoyers at efficios.com
Wed Aug 22 07:53:08 EDT 2012
* Francis Giraldeau (francis.giraldeau at 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 at 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
More information about the lttng-dev
mailing list