Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3295994pxk; Tue, 15 Sep 2020 15:43:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyR0le4UbM1AqcoJNLHHnLIo32hYA7tP35oC5dzJOakML2NX9YYol+h+SP+YPOIvtIDc4y2 X-Received: by 2002:a05:6402:393:: with SMTP id o19mr24877335edv.34.1600209815640; Tue, 15 Sep 2020 15:43:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600209815; cv=none; d=google.com; s=arc-20160816; b=fVNnrDgKd3sB9aSpBUUAGzI3lNhemim7yTtBW1+AGVuAV6tRt0yRJqR36LOZnihwmy lBwCWlQhZ9lDYZC9CFvVbfYvx/hnH7nuhgYXnZFKXbbmC9U63sYnwrZvly0uuY3P/4fg opjbKvVKs/IQUPstPZux6OBVCOCZa7PQYKuIu19iT5uvDF8zNAj4C2OoeaHeQGgKiTkO QuaOr7VR/peiW1h3BwG/RRgddWHk9WXgrqsG/msMyHP/FH/lHU+sDYMkvLnoHeiatlmx DRrji1VqO6JD3dSqS9TczGyyVtnOhzGn6qTxPbu/WzaMM2gP87Db9AobteZLkxhCF/n6 8ieA== 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 :references:in-reply-to:message-id:subject:cc:to:from:date; bh=Y/YbzDo2PGeYl7dye/Vi1PkhZY+Er3EtSRKivOY44lM=; b=QK8/54PlaKPbzJQTi+SIB4HhzE7tKFgvpgq9KEkMjNCp8JEavb8mZ8qsRORZ4YFFVp +W24hRfG1ITr8Yh+U+iWupTMQD1H0TPXm+6PjKZIataQA5gPUUDwRkRrWqupFYwp+GMd C89eFYlrGjgi2T781dmAySrVZaK5gZO3GHItIx5p11bfwkagtCjXzkxkc1XPOfC80ITK 72kwDpu11rmF3892Aetk6em5gOQQJdeT9qfT78E4NypGmNqIthQBIuOg+IItB3XW6V0x vGd/uRwvAy6DbCMbYtKsur6i9jlZZ33ZJ+9dok8KIHSEMGXGrvbIiVK2S3UIyT+0vi8J 0MNA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ha21si10214413ejb.147.2020.09.15.15.43.13; Tue, 15 Sep 2020 15:43:35 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727634AbgIOWmV (ORCPT + 99 others); Tue, 15 Sep 2020 18:42:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:38706 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727544AbgIOWlW (ORCPT ); Tue, 15 Sep 2020 18:41:22 -0400 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6534B20770; Tue, 15 Sep 2020 22:41:20 +0000 (UTC) Date: Tue, 15 Sep 2020 18:41:18 -0400 From: Steven Rostedt To: Mel Gorman Cc: peterz@infradead.org, gengdongjiu , "mingo@redhat.com" , "juri.lelli@redhat.com" , "vincent.guittot@linaro.org" , "dietmar.eggemann@arm.com" , "bsegall@google.com" , "thara.gopinath@linaro.org" , "pauld@redhat.com" , "vincent.donnefort@arm.com" , "rdunlap@infradead.org" , "linux-kernel@vger.kernel.org" Subject: Re: RE???[PATCH] sched: Add trace for task wake up latency and leave running time Message-ID: <20200915184118.211214b6@gandalf.local.home> In-Reply-To: <20200903084925.GB3117@suse.de> References: <6995260be2ca4fd18bc773fe9f50f420@huawei.com> <20200903074232.GW1362448@hirez.programming.kicks-ass.net> <20200903084925.GB3117@suse.de> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 3 Sep 2020 09:49:25 +0100 Mel Gorman wrote: > If state is to be accumulated between multiple tracepoints then the > primary options are BPF, systemtap, trace-cmd for offline analysis or Note, ftrace now has histograms which use the "synthetic events" that Peter mentioned, which can give you state between two different trace points. For example: # cd /sys/kernel/tracing # echo latency u64 lat pid_t pid int prio > synthetic_events # echo 'hist:keys=pid:ts0=common_timestamp.usecs' > events/sched/sched_waking/trigger # echo 'hist:keys=next_pid:lat=common_timestamp.usecs-$ts0:onmatch(sched.sched_waking).trace(latency,$lat,next_pid,next_prio) if next_prio < 100' > events/sched/sched_switch/trigger Which will trigger the synthetic event "latency" when the sched_switch "next_pid" matches the sched_waking "pid" only if "next_prio" is less than 100 (note lower inside the kernel means higher priority, so these are only real time tasks). # echo 1 > events/synthetic/latency/enable # cat trace sshd-1049 [000] d...411 3739.316424: latency: lat=3 pid=277 prio=49 -0 [001] d...4.. 3739.316466: latency: lat=30 pid=275 prio=49 grep-9054 [000] d...4.. 3739.316564: latency: lat=3 pid=277 prio=49 grep-9054 [000] d...411 3739.316671: latency: lat=3 pid=277 prio=49 -0 [001] d...4.. 3739.316709: latency: lat=31 pid=275 prio=49 grep-9054 [000] d...4.. 3739.316759: latency: lat=3 pid=277 prio=49 sshd-1049 [000] d...411 3739.316835: latency: lat=4 pid=277 prio=49 -0 [001] d...4.. 3739.316893: latency: lat=50 pid=275 prio=49 sshd-1049 [000] d...4.. 3739.316968: latency: lat=4 pid=277 prio=49 sshd-1049 [000] d...4.. 3739.317082: latency: lat=6 pid=277 prio=49 -0 [001] d...4.. 3739.317115: latency: lat=29 pid=275 prio=49 sshd-1049 [000] d...411 3739.317194: latency: lat=4 pid=277 prio=49 # echo 'hist:keys=prio,lat:sort=lat' > events/synthetic/latency/trigger # cat events/synthetic/latency/hist # event histogram # # trigger info: hist:keys=prio,lat:vals=hitcount:sort=lat:size=2048 [active] # { prio: 98, lat: 2 } hitcount: 1 { prio: 98, lat: 3 } hitcount: 1 { prio: 0, lat: 3 } hitcount: 2 { prio: 98, lat: 4 } hitcount: 1 { prio: 98, lat: 5 } hitcount: 3 { prio: 98, lat: 6 } hitcount: 1 { prio: 49, lat: 8 } hitcount: 2 { prio: 49, lat: 9 } hitcount: 1 { prio: 49, lat: 10 } hitcount: 1 { prio: 49, lat: 11 } hitcount: 1 { prio: 98, lat: 22 } hitcount: 2 { prio: 98, lat: 25 } hitcount: 1 { prio: 49, lat: 25 } hitcount: 1 { prio: 98, lat: 26 } hitcount: 1 { prio: 98, lat: 28 } hitcount: 2 { prio: 49, lat: 30 } hitcount: 2 { prio: 49, lat: 31 } hitcount: 1 { prio: 98, lat: 33 } hitcount: 1 { prio: 49, lat: 34 } hitcount: 1 { prio: 49, lat: 35 } hitcount: 1 { prio: 49, lat: 41 } hitcount: 1 { prio: 49, lat: 44 } hitcount: 2 { prio: 49, lat: 54 } hitcount: 1 { prio: 0, lat: 172 } hitcount: 1 Totals: Hits: 32 Entries: 24 Dropped: 0 Just FYI ;-) -- Steve > opening trace_pipe with a script, parsing the events and accumulate the > state that way. This can lead to a concern that the script must be running > from system start to track the data and yes, this is exactly what you > have to do. It's not that different to having to monitor /proc/vmstat > over time to get some interesting vm stats as the accumulated state since > the system started is often useless.