Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp2028148ybh; Fri, 17 Jul 2020 07:37:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxoaJ0SA6F3nrnwp0m7CtjBvxJr30gnephoPisOfSp0xJ+zqtjH3mHgRA9YBEtYudZ4yQPk X-Received: by 2002:a17:906:5909:: with SMTP id h9mr9215046ejq.501.1594996647267; Fri, 17 Jul 2020 07:37:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594996647; cv=none; d=google.com; s=arc-20160816; b=lOyEdBQrQD4FmNleStPdkJnkiNXhXZAaqmBxPdIVxI33QvFMo7tJHH+VdrcsjoBPYq M/dogEAr2MypscNH0EaP2l9RfC/fPzirFdVzJTUNcN9TnUMLcnJ8ceAlbo1EblSfMkEq Liu9NsGNkxqBnwZdCtY/si/roIJpCqyWIwH0FxTpUr8punixRYuUeD5tckfIthcidpaD xHVeRbpUNN5o5bJwkQQpZD3QdnVe+bRzANgFlLBu/GiF+TQN+5g2vbC0pGkLd7enBslD 7wwcKVac6LTNUNQ/PTBd3OgOPtzoFNOJf5snOh/rgALOMvnKxwyHofjrcfTX3hak63Kn z7rA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=G133bjyWU6YxjxNXSltSpNAZBCuWwbhnSWFi85dFkXY=; b=ZHwrBEuFSbe5tvPS4ednMff4Cq96OdCm49TBvoVYNogkGkdUTX9RGxNIp43/ye8vzw gFlUk1DPvhOVgcJJLmF+Kx71fCvxybo7s7VtLknMw+snikHcXbrmx6XF9PsBQkClqddU skn4Lq6vfVb2TnJ4WAyAsiv4G2Qh/KKWEfN57jWGKEPuwY+qmGHpS7BGKm/mr9c95AHT GJ3CIqm9CSaVTrNw/LXvnxC2SXbLlmxXb2tQlmf3RPBHKL8s7KUszn9qmRGz8jaa3NjQ eTT0F97E1HVBIFSGyJf/JV8c/nV30KC766vrqoWYBSifeIOk2FQs2VV6HJWOqAVZlWdh QaRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fnwSyrQY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i26si5392686edv.525.2020.07.17.07.37.04; Fri, 17 Jul 2020 07:37:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fnwSyrQY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726512AbgGQOgy (ORCPT + 99 others); Fri, 17 Jul 2020 10:36:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726205AbgGQOgx (ORCPT ); Fri, 17 Jul 2020 10:36:53 -0400 Received: from mail-pj1-x1041.google.com (mail-pj1-x1041.google.com [IPv6:2607:f8b0:4864:20::1041]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 492DCC0619D2 for ; Fri, 17 Jul 2020 07:36:53 -0700 (PDT) Received: by mail-pj1-x1041.google.com with SMTP id t15so6447270pjq.5 for ; Fri, 17 Jul 2020 07:36:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=G133bjyWU6YxjxNXSltSpNAZBCuWwbhnSWFi85dFkXY=; b=fnwSyrQY+Nyqz/ftG4DyW43NnzpA5Zlkt/MopQheXlGi8EcOCW6aQWB6XMZHQ0hUFP O1xAsh6MpL5ELYOFozc6w28OI4Cq/Oa4GU0fe8hpYNfOXHgkqHG7C9ZdV8R1FbHBJGsZ i4XCf6S7QUDhH3ESN2KE+PuC2Jnf7axxy6QreTd8VrnhAZ/kOuju10ptTMz3ANExEdmp oQxumnxDtb18J/k7Vno7VJam6LdKj4ADxpLlgriupdJK9FTtwRX/G+gwLEY1X7I5smzg kQIHdFEc4vVU74PshlT5zw2To+T056CWVzwrNFtIxm7GZeM6MwrGqQ0hm29Q4i0hJyqI Be5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=G133bjyWU6YxjxNXSltSpNAZBCuWwbhnSWFi85dFkXY=; b=Dw5ojf6IzGxCRQllATV+Kl5lVwyn8VcvxpfgfkgXeVVrcIBTzXUT2FZIhTPFDpta3X /QlHB+lWCVgC+40si4BuKZs2iSCT9HLGJrsgB+zSUHio+P8LiuRraosLEXxwfM8XhSyx M97NUX6mLOSInD7EZZrPdf3RonDoIhHkFzoM3dth+eraYD/M5OSc2UfmabHc2Fneovax 37SZRQfkJG8U84jiI+4RL23yl0i/+CyQgme6PS7NiKDguNgTMamVw4iE6mAFNyXo41Rs xnRibqNvsODp2Jt2yc7DyEYIHwWv0HLXqlzoc+x2wZJMy/EBYC3CQuBvwJH8QFqATE/i ftNQ== X-Gm-Message-State: AOAM530It2+315pnG4XrHucUsGDASF9rYYxAm9P8kEZJBUPHms6di4sX E0egncWXerQI+viJAqa8RD0= X-Received: by 2002:a17:902:8349:: with SMTP id z9mr5881710pln.46.1594996612743; Fri, 17 Jul 2020 07:36:52 -0700 (PDT) Received: from vultr.guest ([149.248.10.52]) by smtp.gmail.com with ESMTPSA id a68sm3214689pje.35.2020.07.17.07.36.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jul 2020 07:36:52 -0700 (PDT) From: Changbin Du To: Jiri Olsa , Arnaldo Carvalho de Melo Cc: Peter Zijlstra , Ingo Molnar , Namhyung Kim , Steven Rostedt , linux-kernel@vger.kernel.org, Changbin Du Subject: [PATCH v6 00/17] perf: ftrace enhancement Date: Fri, 17 Jul 2020 22:36:11 +0800 Message-Id: <20200717143628.47721-1-changbin.du@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The perf has basic kernel ftrace support but lack support of most tracing options. This serias is target to enhance the perf ftrace functionality so that we can make full use of kernel ftrace with perf. In general, this serias be cataloged into two main changes: 1) Improve usability of existing functions. For example, we don't need to type extra option to select the tracer. 2) Add new options to support all other ftrace functions. Here is a glance of all ftrace functions with this serias: $ sudo perf ftrace -h Usage: perf ftrace [] [] or: perf ftrace [] -- [] -a, --all-cpus system-wide collection from all CPUs -C, --cpu list of cpus to monitor -D, --delay ms to wait before starting tracing after program start -F, --funcs Show available functions to filter -G, --graph-funcs trace given functions using function_graph tracer -g, --nograph-funcs Set nograph filter on given functions -m, --buffer-size size of per cpu buffer -N, --notrace-funcs do not trace given functions -p, --pid trace on existing process id -T, --trace-funcs trace given functions using function tracer -t, --tracer tracer to use: function or function_graph (This option is deprecated) -v, --verbose be more verbose --func-opts function tracer options, available options: call-graph,irq-info --graph-opts graph tracer options, available options: nosleep-time,noirqs,verbose,thresh=,depth= --inherit trace children processes v6: o fix return value of read_tracing_file_to_stdout(). o make __cmd_ftrace() shorter. o remove option '-t, --tid '. v5: o trivial fixes. v4: o add util/parse-sublevel-options.c O remove -D/--graph-depth v3: o add --func-opts and --graph-opts to set tracer specific options. o support units as a suffix for option '-m/--buffer-size'. v2: o patches for option '-u/--userstacktrace' and '--no-pager' are dropped. o update all related perf documentation. o rename some options. Now all funcgraph tracer options are prefixed with '--graph-', while all function tracer options are prefixed with '--func-'. o mark old options deprecated instead of removing them. Changbin Du (17): perf ftrace: select function/function_graph tracer automatically perf ftrace: add option '-F/--funcs' to list available functions perf ftrace: factor out function write_tracing_file_int() perf ftrace: add option '-m/--buffer-size' to set per-cpu buffer size perf ftrace: show trace column header perf ftrace: add option '--inherit' to trace children processes perf: util: add general function to parse sublevel options perf ftrace: add support for tracing option 'func_stack_trace' perf ftrace: add support for trace option sleep-time perf ftrace: add support for trace option funcgraph-irqs perf ftrace: add support for tracing option 'irq-info' perf ftrace: add option 'verbose' to show more info for graph tracer perf ftrace: add support for trace option tracing_thresh perf: ftrace: allow set graph depth by '--graph-opts' perf ftrace: add option -D/--delay to delay tracing perf: ftrace: Add set_tracing_options() to set all trace options perf ftrace: add change log tools/perf/Documentation/perf-config.txt | 5 - tools/perf/Documentation/perf-ftrace.txt | 33 +- tools/perf/builtin-ftrace.c | 412 +++++++++++++++++++++-- tools/perf/util/Build | 1 + tools/perf/util/debug.c | 61 +--- tools/perf/util/parse-sublevel-options.c | 70 ++++ tools/perf/util/parse-sublevel-options.h | 11 + 7 files changed, 507 insertions(+), 86 deletions(-) create mode 100644 tools/perf/util/parse-sublevel-options.c create mode 100644 tools/perf/util/parse-sublevel-options.h -- 2.25.1