Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933303AbbHLDmh (ORCPT ); Tue, 11 Aug 2015 23:42:37 -0400 Received: from mail-ob0-f179.google.com ([209.85.214.179]:36094 "EHLO mail-ob0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753620AbbHLDmg (ORCPT ); Tue, 11 Aug 2015 23:42:36 -0400 MIME-Version: 1.0 In-Reply-To: References: <7a0446748785048b03318202f2d6c99a@imap.eng.utah.edu> Date: Wed, 12 Aug 2015 11:42:35 +0800 Message-ID: Subject: Re: [ftrace] possible to implement user-space tracers? From: Kun Huang To: Scotty Bauer Cc: linux-kernel@vger.kernel.org Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2966 Lines: 89 Hi Scotty I have read your links. I found the read from 'trace' and the write to 'trace_marker' are normal read&write which works like proc system. I have questions that what's more difference between ftrace and proc? I just know I could read data as pipeline from ftrace. On Wed, Aug 12, 2015 at 10:25 AM, Kun Huang wrote: > Thank you for your help Scotty :) I'm reading it. > > On Wed, Aug 12, 2015 at 2:34 AM, Scotty Bauer wrote: >> 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/ -- 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 Please read the FAQ at http://www.tux.org/lkml/