Received: by 10.223.176.5 with SMTP id f5csp380059wra; Sat, 27 Jan 2018 01:43:32 -0800 (PST) X-Google-Smtp-Source: AH8x227RWQErGdby4M5VDO7l1P227FJ2Zo41jJDhMiB66WQ2MCFrAAT0/ku+31L2pHs0y+cIzk0f X-Received: by 10.99.161.26 with SMTP id b26mr8608031pgf.322.1517046212226; Sat, 27 Jan 2018 01:43:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517046212; cv=none; d=google.com; s=arc-20160816; b=BogP0URjBIwHKA1CYqNLhuLjw82JpWpegCOwnKBHwpnTw7+MLioz6McnLYm/1fcTAt GMRNjeZX1rY3hoSd5cJygz6OCH81mWH6Uf6wnOPvOZ1om9rBiWtgL70yaid9WeBW5TGb q9mUtdDjtDC7IMoRCujQ7A4cMQrFZE5KS1HQxmOyPumhFLqU2kA2WAU48dKuBC1IpjUK Bf4WqU7XLZttXaaTG8Rjx1ltkY393jvG8DQCwMPcsFRr+PrnbN4XO62UDSkzruJS3xt1 YZpEzjPPaj89huWVFu2HsuvnF3yQ59KnJW/L7V1w7NpD/KNRFY4Yk439QEX/QWsJ96HI bdHA== 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:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject:arc-authentication-results; bh=PydMKhZPCJVdM1Cq++0uaD83THz0gZmBoB69UUMdz5s=; b=Hzyp6kjelGnbvPNkV4unmgdInEVB8GMRKlpuXyJ1UtdUHAUMmkd8GO6l2WI+Cblzmp oK7LBa8DlS5rhKQ6I+SuuoScRo8ghXXZ/x9YKgO/x9Buu5RGp0AigV8+R8hhbqnNMiJA Z78khTgOv4gXGPRkWuqWCeGLUCwaUHOb0XtyIxzAIw+3ct0wN8o5pl2bHhC3257DUEjO kcokVw/AkaUmi9VFcsCZ+alIQIA7O0oWEvyzV1BVNpo61m23/49yuuIDcNxoCX1oRywD zvy8lpCVb4wGuCf3vgGYC7WRHQQ/wbbMggPHRalGJXgkGD3hosjATwfdAgQBv2FbIx3J QFFg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 67-v6si5164360ple.609.2018.01.27.01.43.17; Sat, 27 Jan 2018 01:43:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752377AbeA0Jmv (ORCPT + 99 others); Sat, 27 Jan 2018 04:42:51 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:34553 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752048AbeA0Jms (ORCPT ); Sat, 27 Jan 2018 04:42:48 -0500 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 0001BB6F60406; Sat, 27 Jan 2018 17:42:32 +0800 (CST) Received: from [127.0.0.1] (10.177.219.85) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.361.1; Sat, 27 Jan 2018 17:42:28 +0800 Subject: Re: [PATCH v3] perf/trace : Fix repetitious traces of perf on tracepoint To: Milian Wolff CC: , , , , , , , , , , Li Bin , "Xiexiuqi (Xie XiuQi)" , "chengjian (D)" References: <1516106438-4143-1-git-send-email-cj.chengjian@huawei.com> <8597218.ZhpRet0H89@milian-kdab2> From: "chengjian (D)" Message-ID: <3e594e1d-55aa-ee68-0563-f03c22cea6fd@huawei.com> Date: Sat, 27 Jan 2018 17:42:19 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <8597218.ZhpRet0H89@milian-kdab2> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.219.85] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Milian On 2018/1/16 22:33, Milian Wolff wrote: >> perf script print the same wakeup_new event multiple times. >> >> These events which trigger this issue all specify a target process. >> commit e6dab5ffab59 ("perf/trace: Add ability to set a target task >> for events") has designed a method to trace these events. For >> example, the sched_wakeup and sched_wakeup_new tracepoint will be >> caught when the current task wakeup a target task. >> >> the sched_stat_* tracepoint also specify a target process, so it will be reported nrcpus times too. for example sched_stat_sleep swapper 0 [002] 188.752870: sched:sched_stat_sleep: comm=bug_fork_loop pid=1051 delay=2133649486 [ns] | | | | current task > Oh, this sounds awesome. I don't have the setup available to compile a kernel > with this patch applied, but I think from the description it solves a long- > standing issue with perf's sleep-time profiling. > > Can someone try this please: > https://perf.wiki.kernel.org/index.php/Tutorial#Profiling_sleep_times > when current != task. #echo 1 > /proc/sys/kernel/sched_schedstats #./perf-bin/perf record -e sched:sched_stat_sleep ./test_fork_loop before this patch: :1050 1050 [000] 186.597339: sched:sched_stat_sleep: comm=perf pid=1051 delay=22955314 [ns] :1050 1050 [000] 186.597397: sched:sched_stat_sleep: comm=perf pid=1051 delay=22955314 [ns] :1050 1050 [000] 186.597406: sched:sched_stat_sleep: comm=perf pid=1051 delay=22955314 [ns] :1050 1050 [000] 186.597415: sched:sched_stat_sleep: comm=perf pid=1051 delay=22955314 [ns] swapper 0 [002] 188.752870: sched:sched_stat_sleep: comm=bug_fork_loop pid=1051 delay=2133649486 [ns] swapper 0 [002] 188.752899: sched:sched_stat_sleep: comm=bug_fork_loop pid=1051 delay=2133649486 [ns] swapper 0 [002] 188.752952: sched:sched_stat_sleep: comm=bug_fork_loop pid=1051 delay=2133649486 [ns] swapper 0 [002] 188.752965: sched:sched_stat_sleep: comm=bug_fork_loop pid=1051 delay=2133649486 [ns] after this patch: :1041 1041 [001] 62.447062: sched:sched_stat_sleep: comm=perf pid=1042 delay=43035826 [ns] swapper 0 [001] 62.704644: sched:sched_stat_sleep: comm=bug_fork_loop pid=1042 delay=234613068 [ns] > > I believe your patch also fixes the sched_stat_* tracepoints to be only > emitted once per CPU. Can you verify this? I.e. is the period finally > correctly calculated and we get a value of roughly 1E9ns == 1s? > Yeah, this patch fix it. Thanks. CHENG Jian