Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp1143417rdg; Fri, 11 Aug 2023 11:04:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFVfUE/BXTrTTEKK3v7UlpiJL1Z2wefIUwvlfdpTbvBqmL55pCbFMhazuTWdpEWWARRvY6U X-Received: by 2002:a05:6a21:1f30:b0:137:9622:17d0 with SMTP id ry48-20020a056a211f3000b00137962217d0mr2347818pzb.58.1691777058328; Fri, 11 Aug 2023 11:04:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691777058; cv=none; d=google.com; s=arc-20160816; b=au9Cu6BojnkCfB5fLi2m5JVktQsvnPbwHoKJs5vfJJ6KxpJ4hdUqxBB5TxDFx36CEK VmHaADUmxtHcnBZO9IvORO62tKse8uX6wZrdXvb086ZEg/smSW8t/EvaYqeA0ZhyRgOy A2EKfDluIMKKLIb6P4RQ5K4YgwUKyRh4Sy/D7ibggKYDwn9KX+cXmVvrR6y+DMzz+1Pu VpiJ38e2IZ6L/zAbaHx1iewgzXtoJGZ9k1n0O1/W34HPvO7G/7EJvr/4Bsv7LLf5PO76 ugeioPkenqiKoXiM4byKpSs3TBCHbGNJS64U1o+IbNjtccS/WuFtr2Tsf3ByOsFUJp4U 6TiA== 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=zeN749AN+hkC3sQivYJsmsEVojg9GVTMCUsQIoSLy6g=; fh=QPcmO6yB/KPSQvHVTHXrJIAZ2Lc0OF59bOrd5z+WnJo=; b=XtKEEWyTdsKm3bJOhZ6+YV1Clkk/CpoESt5w6Am93QkWqZeLs4cqNf+a+1djEl35pi hYE07feWkh0bZclKrsFUPVpVqTnO9ez76KUECef+XBV7NEbi8PukWr6FbbjVRxvE90yc bY2Dj130iOAFdcB5jVIBCSsYphqsu4QOhtrQZfQMIooqzvn9ztWGnUKQ3ZF/6SYO9io3 YOASwYkGaaGIbr6rGGhHSs7gyNC7BcNr2jbt0kHiw2OiHBhYy2g/XFEM2x1wtbUjROs4 7+Z6fqllWL5T9PRNCSZFN1WY16q3GNtN/Rddp+Dp93sG8gjf82AziW/6vaY+RI40+1B5 21aA== 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 a7-20020a634d07000000b00564a033fb0csi3676526pgb.569.2023.08.11.11.04.05; Fri, 11 Aug 2023 11:04:18 -0700 (PDT) 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 S232185AbjHKR2X (ORCPT + 99 others); Fri, 11 Aug 2023 13:28:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233523AbjHKR2R (ORCPT ); Fri, 11 Aug 2023 13:28:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4960BCE; Fri, 11 Aug 2023 10:28:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DB57F61231; Fri, 11 Aug 2023 17:28:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7006FC433C9; Fri, 11 Aug 2023 17:28:13 +0000 (UTC) Date: Fri, 11 Aug 2023 13:28:11 -0400 From: Steven Rostedt To: Ze Gao Cc: acme@kernel.org, adrian.hunter@intel.com, alexander.shishkin@linux.intel.com, irogers@google.com, jolsa@kernel.org, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-trace-kernel@vger.kernel.org, mark.rutland@arm.com, mhiramat@kernel.org, mingo@redhat.com, namhyung@kernel.org, peterz@infradead.org, zegao@tencent.com Subject: Re: [PATCH] perf sched: parse task state from tracepoint print format Message-ID: <20230811132811.28b9b766@gandalf.local.home> In-Reply-To: <20230810055023.67529-2-zegao@tencent.com> References: <20230803234122.19b3d3a4@rorschach.local.home> <20230810055023.67529-2-zegao@tencent.com> X-Mailer: Claws Mail 3.19.1 (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=-1.6 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no 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 Thu, 10 Aug 2023 01:50:24 -0400 Ze Gao wrote: > Hi Steven, > > I managed to build task state char map dynamically by parsing > the tracepoint print format from data recorded by perf. And > likewise for libtraceevent. > > FYI, I tried TEP_PRINT_INFO but no shot. It turns out TEP_PRINT_INFO > stills relies on libtraceevent (i.e., sched_switch_handler() in > plugin_sched_switch.c) and we need to parse the print format on our own. There is a way to unload plugins: tep_unload_plugins(t->plugin_list, tep); Hmm, I should add: tep_unload_plugin(tep, t->plugin_list, "plugin-name"); To unload a single plugin. I it can also just override what the plugin does by calling: static int sched_switch_handler(struct trace_seq *s, struct tep_record *record, struct tep_event *event, void *context) { // do whatever you want. } tep_register_event_handler(tep, -1, "sched", "sched_switch", sched_switch_handler, NULL); > > Anyway, it works now and I've tested on some perf.data in old formats > but not cover all the kernel releases. > > Thoughts? I don't maintain the perf code. You'll have to talk with the perf maintainers. -- Steve