From: pierre-marc.fournier@polymtl.ca (Pierre-Marc Fournier)
Subject: [ltt-dev] ltt channel thread safe?
Date: Tue, 10 Aug 2010 00:28:50 -0400 [thread overview]
Message-ID: <4C60D582.4090802@polymtl.ca> (raw)
In-Reply-To: <AANLkTi=Ar2TBEhDb9n4xBiqnW14BJ9A4oA4O=PMPkg=x@mail.gmail.com>
On 08/04/2010 02:12 AM, chris meyers wrote:
> To give a bit of context to the problem. I am using user space ltt to
> help profile code. I have created two events, time_begin and time_end.
> The goal is to allow for logging the runtime of specific code blocks
> via start() stop() insertions.
>
> I am having some issues with traces not coming out "correct" on the
> other "end". Let me further explain what I mean by correct and end.
>
> correct
> trace_mark(ust, time_begin, "thread %d func %s depth %d extra %s", 0,
> __FUNCTION__, 1, __FUNCTION__)
> trace_mark(ust, time_end, "thread %d func %s depth %d extra %s", 0,
> __FUNCTION__, 1, __FUNCTION__)
>
> end
> ust.time_begin: 30208.932264102
> (/home/meyers/.usttraces/lappy-20100804020140730811027/28367_5501430910891543571/ust_0),
> 0, 0, , , 0, 0x0, MODE_UNKNOWN { thread = 1, func =
> "memloc_request_response_decider", depth = 1, extra =
> "memloc_request_response_decider" }
> ust.time_end: 30208.932267455
> (/home/meyers/.usttraces/lappy-20100804020140730811027/28367_5501430910891543571/ust_0),
> 0, 0, , , 0, 0x0, MODE_UNKNOWN { thread = 1, func =
> "memloc_request_response_decider", depth = 1, extra =
> "memloc_request_response_decider" }
>
> Later on the output looks like this:
> ust.time_begin: 30198.142843837
> (/home/meyers/.usttraces/lappy-20100804020140730811027/28367_5501430910891543571/ust_0),
> 0, 0, , , 0, 0x0, MODE_UNKNOWN { thread = 1, func = "ne_worker_thread",
> depth = 560296821, extra = "" }
>
> Notice that in the trace_mark() code above I hard coded depth to be 0
> and _str is always __FUNCTION__.
>
> Possible reasons:
> * Buffer is being overrun. I changed the buffer size using the -N and
> -S options in usttrace to something > 2 MB (plenty large).
> * Channels are not thread-safe? I have 3 threads of execution in this
> example. All using the ust channel.
Channels are supposed to be thread-safe.
If there is an overrun, it will be printed in the console output from
lttv. Overruns are always possible if the rate at which the application
produces events is higher than the rate at which they can be flushed to
the disk. The solution may be to increase buffer size to counter
temporary event rate peaks. However if the sustained rate is too high,
an overrun will still eventually happen. One way to avoid this would be
to add a synchronous mode where the application may block on a marker to
prevent overruns.
> * My code is crappy and I am overwriting the lust library buffer?
>
>
> Also, I am having trouble using any channel other than ust. Is ust the
> only channel available in user space?
From the ust manual:
"Note: Although this example uses mychannel as the channel, the only
channel name currently supported with early tracing is ust. The usttrace
tool always uses the early tracing mode. When using manual mode without
early tracing, any channel name may be used."
pmf
prev parent reply other threads:[~2010-08-10 4:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-04 6:12 chris meyers
2010-08-04 6:12 ` chris meyers
2010-08-04 6:12 ` chris meyers
2010-08-06 20:55 ` chris meyers
2010-08-06 20:55 ` chris meyers
2010-08-06 20:55 ` chris meyers
2010-08-06 21:02 ` Mathieu Desnoyers
2010-08-10 4:29 ` Pierre-Marc Fournier
2010-08-10 4:28 ` Pierre-Marc Fournier [this message]
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=4C60D582.4090802@polymtl.ca \
--to=pierre-marc.fournier@polymtl.ca \
/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