mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Scotty Bauer <sbauer@eng.utah.edu>
To: Kun Huang <gareth@openstacker.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [ftrace] possible to implement user-space tracers?
Date: Tue, 11 Aug 2015 11:34:48 -0700	[thread overview]
Message-ID: <7a0446748785048b03318202f2d6c99a@imap.eng.utah.edu> (raw)
In-Reply-To: <CA+oqSwTDaeg85-tJmejwKv4Hmsd5ndx=5aHN-8pH640wqeRcxA@mail.gmail.com>

It is possible to trace from userland, Android does it.

Essentially you need to write your data into 
/sys/kernel/debug/tracing/trace_marker

then read it out of /sys/kernel/debug/tracing/trace


If you care how the implementation works you can read it in 
/kernel/tracing/trace.c 
(http://lxr.free-electrons.com/source/kernel/trace/trace.c) search for 
tracing_mark_fops and tracing_fops.


In Android here are the relevant files you will need to see how it's 
used in userland:
Atrace (for reading data out + setting things up):
https://android.googlesource.com/platform/frameworks/native/+/master/cmds/atrace/atrace.cpp
https://android.googlesource.com/platform/external/chromium-trace/+/master 
(host side setup of the device)

trace-dev (for writing data in):
https://android.googlesource.com/platform/system/core/+/master/libcutils/trace-dev.c

Once we have all the data we usually run it through trace-viewer, 
(https://github.com/catapult-project/catapult)

Cheers.


> On 2015-08-11 06:53, Kun Huang wrote:
>> Hi ftrace developers
>> 
>> I'm developing a huge python based programs and facing performance
>> issue everyday. I like the ftrace system and hope there could be a
>> tracer to trace&report my python codes. Is it possible or is it
> worthy
>> to do this?
>> 
>> ---
>> 
>> Kun
>> --
>> To unsubscribe from this list: send the line "unsubscribe
> linux-kernel" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> [6]
>> Please read the FAQ at  http://www.tux.org/lkml/ [7]
> 
> Links:
> ------
> [1] http://lxr.free-electrons.com/source/kernel/trace/trace.c
> [2]
> https://android.googlesource.com/platform/frameworks/native/+/master/cmds/atrace/atrace.cpp
> [3] 
> https://android.googlesource.com/platform/external/chromium-trace/+/master
> [4]
> https://android.googlesource.com/platform/system/core/+/master/libcutils/trace-dev.c
> [5] https://github.com/catapult-project/catapult
> [6] http://vger.kernel.org/majordomo-info.html
> [7] http://www.tux.org/lkml/

       reply	other threads:[~2015-08-11 19:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CA+oqSwTDaeg85-tJmejwKv4Hmsd5ndx=5aHN-8pH640wqeRcxA@mail.gmail.com>
2015-08-11 18:34 ` Scotty Bauer [this message]
2015-08-12  2:25   ` Kun Huang
2015-08-12  3:42     ` Kun Huang
2015-08-12  3:58       ` Scotty
2015-08-12  6:29         ` Kun Huang
2015-08-11 13:53 Kun Huang

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=7a0446748785048b03318202f2d6c99a@imap.eng.utah.edu \
    --to=sbauer@eng.utah.edu \
    --cc=gareth@openstacker.org \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®