Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1649715

Re: [PATCH v2 13/13] perf tools: add feature header record to pipe-mode

Path csiph.com!news.redatomik.org!aioe.org!bofh.it!news.nic.it!robomod
From Namhyung Kim <namhyung@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH v2 13/13] perf tools: add feature header record to pipe-mode
Date Wed, 24 May 2017 17:50:01 +0200
Message-ID <tKGHT-49Y-3@gated-at.bofh.it> (permalink)
References <tKcTv-a4-3@gated-at.bofh.it> <tKcTw-a4-23@gated-at.bofh.it>
X-Original-To David Carrillo-Cisneros <davidcc@google.com>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Z5ApEyhOQszRpcn1W+9ffEbrr909d0FkdDehUSZTnwQ=; b=djQE4clNi97tl7E+KBXaNu4GcH2lyqdY0NMaadSODMDNpj4PQTvHKCm1OKgYiQ3wX2 c6z3XAltsXlpM8wTXJuTzRln9FAx4l/AH4N7iUR306pA52CVfO+z/mUfapcDWLEHLybf V9/v0KijKunTPrqCENQtj0qCuC/t6IvurirDiZeWoArawM9yYUtr6GVigCR6ifHH7euH C7zPmYVHHkz3YyZc615NCtao3CuVJqFMMZ54+e5YKfjQSE2H8JP85Pm/ZgenCx8e+9Ov wrUHXX2wkl8R6jjhjwMCFz4PXQ5lVc3R7gfJiMEcQ0lZ8DtoVXSC8xZDV+IC+NLhLFlq NSRQ==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=Z5ApEyhOQszRpcn1W+9ffEbrr909d0FkdDehUSZTnwQ=; b=b26jMGHJo5crrBvpByuVLPCfk4jC5zOSYYX7R4EjdbIjuD8Xu2i4Fp2/TsSlfEThL+ PAWxHssjontulqJBqmtKac5G1GZY04aerjpTmfoFzb+Y/ZOX+P2sJxGfTA6//XtHaRoa PNu5H5bsyH5wWAZVAU5hjZblwzPClM6NJm6fEmM9ixFUc3jr+XuAoZvvvSEiSRkCKCq5 BlJQm2H69de2nYxNUlIc5OOPsToxJGZJKm0ffkbBDCd+CpsRCzT6ODMvqLWvL2qzxUar z6aRfn7x2k5OZN7UVdOGjpL6uoUyAd0Ke2AY7NhxPZPipDnh6IM36bhOTUmk4Rn2sNKR zavA==
X-Gm-Message-State AODbwcAE4OG94VlmxpAhvQahE3rtskP+g69fwOpAYQjy/Uu9p9EBKREK UO6VNLGmhRC4/Upn
X-Received by 10.99.126.20 with SMTP id z20mr38311355pgc.158.1495640443148; Wed, 24 May 2017 08:40:43 -0700 (PDT)
MIME-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Disposition inline
User-Agent Mutt/1.8.2 (2017-04-18)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 117
Organization linux.* mail to news gateway
X-Original-Cc linux-kernel@vger.kernel.org, Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@redhat.com>, Arnaldo Carvalho de Melo <acme@kernel.org>, Alexander Shishkin <alexander.shishkin@linux.intel.com>, Andi Kleen <ak@linux.intel.com>, Simon Que <sque@chromium.org>, Wang Nan <wangnan0@huawei.com>, Jiri Olsa <jolsa@kernel.org>, He Kuang <hekuang@huawei.com>, Masami Hiramatsu <mhiramat@kernel.org>, David Ahern <dsa@cumulusnetworks.com>, Stephane Eranian <eranian@google.com>, Paul Turner <pjt@google.com>, kernel-team@lge.com
X-Original-Date Thu, 25 May 2017 00:40:24 +0900
X-Original-Message-ID <20170524154024.GC27760@danjae.aot.lge.com>
X-Original-References <20170523074853.54892-1-davidcc@google.com> <20170523074853.54892-14-davidcc@google.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1649715

Show key headers only | View raw


On Tue, May 23, 2017 at 12:48:53AM -0700, David Carrillo-Cisneros wrote:
> Add header record types to pipe-mode, reusing the functions
> used in file-mode and leveraging the new struct feat_fd.
> 
> Add the perf_event__synthesize_feature event call back to
> process the new header records.
> 
> Before this patch:
> 
>   $ perf record -o - -e cycles sleep 1 | perf report --stdio --header
>   [ perf record: Woken up 1 times to write data ]
>   [ perf record: Captured and wrote 0.000 MB - ]
>   ...
> 
> After this patch:
>   $ perf record -o - -e cycles sleep 1 | perf report --stdio --header
>   # ========
>   # captured on: Mon May 22 16:33:43 2017
>   # ========
>   #
>   # hostname : my_hostname
>   # os release : 4.11.0-dbx-up_perf
>   # perf version : 4.11.rc6.g6277c80
>   # arch : x86_64
>   # nrcpus online : 72
>   # nrcpus avail : 72
>   # cpudesc : Intel(R) Xeon(R) CPU E5-2696 v3 @ 2.30GHz
>   # cpuid : GenuineIntel,6,63,2
>   # total memory : 263457192 kB
>   # cmdline : /root/perf record -o - -e cycles -c 100000 sleep 1
>   # HEADER_CPU_TOPOLOGY info available, use -I to display
>   # HEADER_NUMA_TOPOLOGY info available, use -I to display
>   # pmu mappings: intel_bts = 6, uncore_imc_4 = 22, uncore_sbox_1 = 47, uncore_cbox_5 = 33, uncore_ha_0 = 16, uncore_cbox
>   [ perf record: Woken up 1 times to write data ]
>   [ perf record: Captured and wrote 0.000 MB - ]
>   ...
> 
> Support added for the subcommands: report, inject, annotate and script.
> 
> Signed-off-by: David Carrillo-Cisneros <davidcc@google.com>
> ---

[SNIP]
> +struct feature_event {
> +	struct perf_event_header header;
> +	u64 header_id;

s/header_id/feat_id/ ?


> +	char data[]; /* size bytes of raw data specific to the feature */
> +};
> +
>  union perf_event {
>  	struct perf_event_header	header;
>  	struct mmap_event		mmap;

[SNIP]
> +int perf_event__process_feature(struct perf_tool *tool,
> +				union perf_event *event,
> +				struct perf_session *session __maybe_unused)
> +{
> +	struct feat_fd fd = { .fd = 0 };
> +	struct feature_event *fe = (struct feature_event *)event;
> +	int type = fe->header.type;
> +	u64 feat = fe->header_id;
> +
> +	if (type < 0 || type >= PERF_RECORD_HEADER_MAX) {
> +		pr_warning("invalid record type %d\n", type);
> +		return 0;
> +	}
> +	if (feat == HEADER_RESERVED)
> +		return -1;
> +
> +	if (feat > HEADER_LAST_FEATURE)
> +		return 0;
> +
> +	if (!feat_ops[feat].process)
> +		return 0;

Checking here..

> +
> +	/*
> +	 * no print routine
> +	 */
> +	if (!feat_ops[feat].print)
> +		return 0;
> +
> +	fd.buf  = (void *)fe->data;
> +	fd.size = event->header.size - sizeof(event->header);
> +	fd.ph = &session->header;
> +
> +	if (!tool->show_feat_hdr)
> +		return 0;
> +
> +	if (!feat_ops[feat].full_only ||
> +	    tool->show_feat_hdr >= SHOW_FEAT_HEADER_FULL_INFO) {
> +		if (feat_ops[feat].process) {

.. and here again.

Thanks,
Namhyung


> +			if (feat_ops[feat].process(&fd, NULL))
> +				return -1;
> +		}
> +		feat_ops[feat].print(&fd, stdout);
> +	} else {
> +		fprintf(stdout, "# %s info available, use -I to display\n",
> +			feat_ops[feat].name);
> +	}
> +
> +	return 0;
> +}

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 13/13] perf tools: add feature header record to pipe-mode David Carrillo-Cisneros <davidcc@google.com> - 2017-05-23 10:00 +0200
  Re: [PATCH v2 13/13] perf tools: add feature header record to  pipe-mode Namhyung Kim <namhyung@kernel.org> - 2017-05-24 17:50 +0200
  Re: [PATCH v2 13/13] perf tools: add feature header record to  pipe-mode Jiri Olsa <jolsa@redhat.com> - 2017-05-25 10:10 +0200
  Re: [PATCH v2 13/13] perf tools: add feature header record to  pipe-mode Jiri Olsa <jolsa@redhat.com> - 2017-05-25 10:20 +0200
    Re: [PATCH v2 13/13] perf tools: add feature header record to pipe-mode David Carrillo-Cisneros <davidcc@google.com> - 2017-06-06 03:40 +0200
      Re: [PATCH v2 13/13] perf tools: add feature header record to  pipe-mode Jiri Olsa <jolsa@redhat.com> - 2017-06-06 13:10 +0200
        Re: [PATCH v2 13/13] perf tools: add feature header record to pipe-mode David Carrillo-Cisneros <davidcc@google.com> - 2017-06-06 20:20 +0200
  Re: [PATCH v2 13/13] perf tools: add feature header record to  pipe-mode Jiri Olsa <jolsa@redhat.com> - 2017-05-25 10:20 +0200
  Re: [PATCH v2 13/13] perf tools: add feature header record to  pipe-mode Jiri Olsa <jolsa@redhat.com> - 2017-05-25 10:20 +0200
    Re: [PATCH v2 13/13] perf tools: add feature header record to  pipe-mode Jiri Olsa <jolsa@redhat.com> - 2017-06-06 13:10 +0200
  Re: [PATCH v2 13/13] perf tools: add feature header record to  pipe-mode Jiri Olsa <jolsa@redhat.com> - 2017-05-25 10:20 +0200
  Re: [PATCH v2 13/13] perf tools: add feature header record to  pipe-mode Jiri Olsa <jolsa@redhat.com> - 2017-05-25 10:20 +0200

csiph-web