Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp448187pxm; Wed, 2 Mar 2022 19:45:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJzSkoPt94MX4jhoHU4XiCRnChJkFGRqH4DYlXviOacWlKvYOID0WjhLxINmnNeyw1lYKpJX X-Received: by 2002:a17:90b:3846:b0:1be:fbc2:1f61 with SMTP id nl6-20020a17090b384600b001befbc21f61mr3134673pjb.209.1646279150370; Wed, 02 Mar 2022 19:45:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646279150; cv=none; d=google.com; s=arc-20160816; b=fq+F6f7Kp/k+yH1RqSngJ0b32XgFT0EnPYjFHO/TtLBeBg05IcpAgcWB1QtpeLc5Rq ogKc1MpUsVNclAv5UEVVcjt6E0DBFUJH4ReF7oBSvYhImlFRzq46qlZ0cldkBImmSvDA lKAlcVWwptGZQ5srZVqu4T7f/KL2XXSIWesb3U2S4EFBfpawX9s6dXSZ+YmoY1ZBqEfc ecWmroZm13cQrjePnjuZC5tqf2pm0bRyDc/IhQT24wozYDRNo32kxL/FhNBkUJfWASIK TbJRcv+3YLTR1+zXlr7nvrU0ySJAvc6lw9FHWLOpU4rQ4u1Xl68k5YOZ1hInLPISetHf KZJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=S5AaKLaBCbpfmGFweb39AeIoMc6UJseBiVDqpoXcX58=; b=sonAutpn0ntBjIYw7Q+cM4f2lSG5HpRVnuxfvPEZhIuMRsqBjmif9ZS+Ee3xrj//Nn YUPaeYCMDIYKVoEqFoznhhkbI1fMvDEC2KCMqfLpKRzUd3cOhEmn0Be/yH/VWSbvOgey h3tdusr8MDvm0HK601VVaaEiw6Z/pD71kt+zbyFEDNaACNnPeF2JS16c96lckyb26VpE pf/J21RBSg/5K6lv8TIf0ZOnZZctB9S8BuiGi+5Vtpu+UpUcxGMvVQt61wogw19QdixP 7h2tU1IpoKHACRAfASu7jNx9X1zpV9LdDLyVVUDT8HpCBpfzoKY5JEGlM6MkiQt6bGvI hPVA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e22-20020a63db16000000b00378473f69d7si890534pgg.428.2022.03.02.19.45.29; Wed, 02 Mar 2022 19:45:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229464AbiCCDmQ (ORCPT + 99 others); Wed, 2 Mar 2022 22:42:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229436AbiCCDmP (ORCPT ); Wed, 2 Mar 2022 22:42:15 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D73411D7A4 for ; Wed, 2 Mar 2022 19:41:29 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2F111B8219C for ; Thu, 3 Mar 2022 03:41:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6BF5C004E1; Thu, 3 Mar 2022 03:41:25 +0000 (UTC) Date: Wed, 2 Mar 2022 22:41:24 -0500 From: Steven Rostedt To: Joel Fernandes Cc: LKML , Ingo Molnar , Andrew Morton , Peter Zijlstra , Masami Hiramatsu , Tom Zanussi Subject: Re: [PATCH 2/2] tracing: Add sample code for custom trace events Message-ID: <20220302224124.433ba754@rorschach.local.home> In-Reply-To: References: <20220302032414.503960863@goodmis.org> <20220302032820.877781830@goodmis.org> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2 Mar 2022 22:22:30 -0500 Joel Fernandes wrote: > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +#define THIS_SYSTEM "custom_sched" > > + > > +#define SCHED_PRINT_FMT \ > > + C("prev_prio=%d next_pid=%d next_prio=%d", REC->prev_prio, REC->next_pid, \ > > Probably prev_pid should be included so we know what the previous task was? > > Or are you expecting that a prior sched_switch would have that > information? If so, then prev_prio is also not needed as the previous > sched_switch's next_prio would have the prio. That would save even > more space too.. No, I left it out because it's already recorded in the event: kworker/u16:2-19213 [005] d..2. 24689.792052: sched_switch: prev_comm=kworker/u16:2 prev_pid=19213 prev_prio=120 prev_state=I ==> next_comm=swapper/5 next_pid=0 next_prio=120 The above is the normal sched_switch event. The prev pid is 19213 which is equal to common_pid (the first 19213 in that string). As prios can change, I would not want to drop that anyway. > > > + REC->next_prio) > > + > > +#define SCHED_WAKING_FMT \ > > + C("pid=%d prio=%d", REC->pid, REC->prio) > > + > > I think including the target_cpu of a wake up is also really important > to show where the task is going to be awakened, and maybe we can drop > prio since a subsequent sched_switch will have the priority in > next_prio. True, we can do that. > > [..] > > +static void __exit trace_sched_exit(void) > > +{ > > + trace_set_clr_event(THIS_SYSTEM, "sched_switch", 0); > > + trace_set_clr_event(THIS_SYSTEM, "sched_waking", 0); > > + > > + trace_remove_event_call(&sched_switch_call); > > + trace_remove_event_call(&sched_waking_call); > > +} > > + > > +module_init(trace_sched_init); > > +module_exit(trace_sched_exit); > > + > > +MODULE_AUTHOR("Steven Rostedt"); > > +MODULE_DESCRIPTION("Custom scheduling events"); > > +MODULE_LICENSE("GPL"); > > + > > Remove extra lines from the end of the file? > Ah, yeah. Thanks for reviewing. -- Steve