From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 910FD168B1; Tue, 29 Oct 2024 01:04:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730163840; cv=none; b=cbC+PJAzgQDN16nW8DddozCHI8fG9TjDL4dhQrkApYftncZGJ324qZY40YRPZTk2t/WBGrXccFq/TtBtGKEcA3fFEbtBOe5wDLyWBKeQKNkQDpXCWg/DAdMJSJBNj0BjSGWURRxJhz2tyLg6GDyLJqtarffVUV4VddNZTF6HzEU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730163840; c=relaxed/simple; bh=YU6zL+S91zVz79lMB5TTT0iiLFRBvoFA82gjQYE2qy4=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=Pc6zqebzMNS6LWZAubkWXksxlwbPcVJeRAZll1AQKxWW4BNjjCK7ULYkVnTDHkYM4SojuFeVSSqJWI6c+9pz0Z4WDHUnYOV2L4BQcLa7ruwsdpyU0ql+9T4OJiut9hBvB73o8EVR3Q8NrBE8mV+ecnJLnOBMPTC4mtvimYJTIJE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=aIod6kLK; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="aIod6kLK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 996BEC4CEC3; Tue, 29 Oct 2024 01:03:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1730163840; bh=YU6zL+S91zVz79lMB5TTT0iiLFRBvoFA82gjQYE2qy4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=aIod6kLKsuQtMvrc0kXNNzxRMGhWCGGLV7u7KLix015CZn2EPdvYL37TBJTWfnekT kI6Q4iHz4QSj8tgm0LL0iW2/rJHljzTX8AxYwLzn/0qty3INbLHJk8kx+/DvbCszbt nEHec4tT3GEwfXog/1YwbcyqJ1wFHRJrbA0W4usII4VRseh1pTrNyEzWLhoLpLR1zQ Xr28HucsTTC23DJGrZs0x9yDnOO7320TCbZdjrMwLDDvZWmcVzzLtudjqaltL1p+5/ 0ALIsg1CEOzhuicuPcQ3e5a3mm0zmYWFUnlO2T5sXy652PEyKcDs8CelU8S0wY+1dp k1K4gQE9nufVw== Date: Tue, 29 Oct 2024 10:03:56 +0900 From: Masami Hiramatsu (Google) To: "Masami Hiramatsu (Google)" Cc: Steven Rostedt , Shuah Khan , Tom Zanussi , Mathieu Desnoyers , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH v6 0/3] tracing: Support poll on event hist file Message-Id: <20241029100356.099a6e639846aae4d0a6083f@kernel.org> In-Reply-To: <172907575534.470540.12941248697563459082.stgit@mhiramat.roam.corp.google.com> References: <172907575534.470540.12941248697563459082.stgit@mhiramat.roam.corp.google.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Wed, 16 Oct 2024 19:49:15 +0900 "Masami Hiramatsu (Google)" wrote: > Overview > -------- > This patch set allows user to `poll`(or `select`, `epoll`) on event > histogram interface. As you know each event has its own `hist` file > which shows histograms generated by trigger action. So user can set > a new hist trigger on any event you want to monitor, and poll on the > `hist` file until it is updated. Note: This `hist` is not disabled by tracing_on interface, because that interface only disables `recording`. Thus to monitor events via this interface, user must ensure the tracing_on is enabled, also, set the same "filter" to the hist action. Thank you, > > There are 2 poll events are supported, POLLIN and POLLPRI. POLLIN > means that there are any readable update on `hist` file and this > event will be flashed only when you call read(). So, this is > useful if you want to read the histogram periodically. > The other POLLPRI event is for monitoring trace event. Like the > POLLIN, this will be returned when the histogram is updated, but > you don't need to read() the file and use poll() again. > > Note that this waits for histogram update (not event arrival), thus > you must set a histogram on the event at first. > > Usage > ----- > Here is an example usage: > > ---- > TRACEFS=/sys/kernel/tracing > EVENT=$TRACEFS/events/sched/sched_process_free > > # setup histogram trigger and enable event > echo "hist:key=comm" >> $EVENT/trigger > echo 1 > $EVENT/enable > > # Wait for update > poll pri $EVENT/hist > > # Event arrived. > echo "process free event is comming" > tail $TRACEFS/trace > ---- > > The 'poll' command is in the selftest patch. > > You can take this series also from here; > > https://git.kernel.org/pub/scm/linux/kernel/git/mhiramat/linux.git/log/?h=topic/event-hist-poll > > Thank you, > --- > > Masami Hiramatsu (Google) (3): > tracing/hist: Add poll(POLLIN) support on hist file > tracing/hist: Support POLLPRI event for poll on histogram > selftests/tracing: Add hist poll() support test > > > include/linux/trace_events.h | 14 +++ > kernel/trace/trace_events.c | 14 +++ > kernel/trace/trace_events_hist.c | 100 +++++++++++++++++++- > tools/testing/selftests/ftrace/Makefile | 2 > tools/testing/selftests/ftrace/poll.c | 74 +++++++++++++++ > .../ftrace/test.d/trigger/trigger-hist-poll.tc | 74 +++++++++++++++ > 6 files changed, 275 insertions(+), 3 deletions(-) > create mode 100644 tools/testing/selftests/ftrace/poll.c > create mode 100644 tools/testing/selftests/ftrace/test.d/trigger/trigger-hist-poll.tc > > -- > Masami Hiramatsu (Google) -- Masami Hiramatsu (Google)