From patchwork Tue Jul 25 07:22:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ze Gao X-Patchwork-Id: 125393 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp2305387vqg; Tue, 25 Jul 2023 00:52:49 -0700 (PDT) X-Google-Smtp-Source: APBJJlEWtQtci464G/2onPZrH7tbMzBQgcbXQLvVnF3Zf7lFkVde3zkguMK8r5C1nIVepVT6lwP/ X-Received: by 2002:a17:906:9bf6:b0:993:ec93:a5ef with SMTP id de54-20020a1709069bf600b00993ec93a5efmr11287841ejc.47.1690271568812; Tue, 25 Jul 2023 00:52:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690271568; cv=none; d=google.com; s=arc-20160816; b=KZ76lRWwSG3HygDQYHFPbBYdaQu6XrEF/TQCpZ79SuELmJsJrYgjZYkRaOwLMl4e3E rX2EnB/67GYICzZP+vGFu3dk7qammNNF898DB79+RaXFRlRP9wx6eJNl7op0dMajnhtX pWIk9jWbN4KZ32Acj5ABjuxxRe54fmj5oXopPfBj6aKvDJ74D5iRmpEWaNPuEw+vGB7j gSuxI7lAlSdLIDeluQdkpB6auWayygtBm5cRDFbNXhTQf/yHmtfJK1WCLJixMH/Ppqla lMUjhuxjtCvxw2+0L2eVhu/RnPZKLngMHvDYDuchkq5GEo8NlSNh0zJpFCVUksWcpYSi kv5w== 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:date:subject:cc:to:from :dkim-signature; bh=MBwG97iRZO4tN6Fiy1txLbQFfSCq1pL4Ni9ia1DF4dY=; fh=A8InIXaUJCDiCU1PTNfzcNZ+u4dmNDGcONSlyuU68T4=; b=KoXuCoh+NB+1jzrEs9SO7pgY7WbvCvN+7MGEBLw0xiBAblXzZPBRSGAXBIhP8BN/LE IK6JDj/San/9RGfwWq2J9VqCphog4WVvPzLkudzz6IGqGLHqC3lBPMZQz9W3O0P3KUKn CNnb3jATQjDzzYMfO2Re9LjBTJocq+UW/wimplNkUxeAmwawxjvFUR04q/2Lf/kIdM// xLOl5ka3wQ2JepOw7W62JYiVgp9I/L5z5RiSxCaJQCcVxm+wAbfaL7EpTXDY5AgZQ1ja 0pItnJplNYbif6yAo0W7zGpqLA8+dhu/0HjYn3oCN4gRzohtmEC0gbAWFpgivVZlJoLv A95A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=fDWP8pJg; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e4-20020a170906374400b00992bf8cc68csi7933923ejc.973.2023.07.25.00.52.24; Tue, 25 Jul 2023 00:52:48 -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; dkim=pass header.i=@gmail.com header.s=20221208 header.b=fDWP8pJg; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230078AbjGYH1Y (ORCPT + 99 others); Tue, 25 Jul 2023 03:27:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232528AbjGYH03 (ORCPT ); Tue, 25 Jul 2023 03:26:29 -0400 Received: from mail-oi1-x230.google.com (mail-oi1-x230.google.com [IPv6:2607:f8b0:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81A0519A2; Tue, 25 Jul 2023 00:23:17 -0700 (PDT) Received: by mail-oi1-x230.google.com with SMTP id 5614622812f47-3a04e5baffcso3613766b6e.3; Tue, 25 Jul 2023 00:23:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690269797; x=1690874597; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MBwG97iRZO4tN6Fiy1txLbQFfSCq1pL4Ni9ia1DF4dY=; b=fDWP8pJgo8CFkH9+IiKqXOh4RtqqEqQ/6GGY3V8azRSvvGfKhpE6KDe1fbUdl7Zpy9 dBPsirxsiAz3pCvshqbdZtlUoRX8zx94wFRpw/Rdz6WXWg55bEmRlH1nzm5WhMFxW3yK +Ke1E46i/28HQOvfoSUM9Px7LQmVoho9ggOfEY9VRGW4uJtXYJ/Y6kSPVcjhprdkyzRt npvN/d2+2vqMXt8ZrsBjvErj8cwmHSdq7trsZcyu3egVacU7Iapvo7nlSx2ktw5EK53N r3uUvOnVlQ4Cgqf663FAU4bcLckT8RLyDkN48g/uoNFZqfoL31bgX7TbV9sgpVfJkzEO 32uA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690269797; x=1690874597; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MBwG97iRZO4tN6Fiy1txLbQFfSCq1pL4Ni9ia1DF4dY=; b=FyHoHqt1sDm4gQk8u9Q+OaYQrMurSMuPKKp+1SE2uKH7q5+xG912NU/j/W5mach9wt PedHAP1US8h4P30JvCGwG0TM3sjnOomw7jilozumbLeBbhUYbqkxIOzmtZq19ZU3gcCR KyHONoMWXqS3GB9ZfEW6aqD6Czy2APn01KJrOn6duCV+KgqTTXdlMAMUDJ6rONsWTMY0 LIOBRspRYmH0N7t9VMqxNmxR40EBvRKtPi0vz9vVH0a9ETjXCRW28NwVMIpm8YxxEeCd kMlvPZiKn/5ogoaQsJ/0Jcec/CxqAiiZ3iPBGlwcm8uXcuiIWxrf/4891lNrlE4IKr6j 9yTg== X-Gm-Message-State: ABy/qLYrTNZ6eKfSGTmg+Pqgop9gcWhuGOEeKIHyeLSuSBkGGKYQWFuP ZWCJ6w3YRdzoDCLrQijK/LMU7HtEO4zDww== X-Received: by 2002:a54:4703:0:b0:3a1:eb15:5ec4 with SMTP id k3-20020a544703000000b003a1eb155ec4mr9832357oik.42.1690269796838; Tue, 25 Jul 2023 00:23:16 -0700 (PDT) Received: from localhost.localdomain ([203.205.141.82]) by smtp.googlemail.com with ESMTPSA id d12-20020a63734c000000b0055acfd94c20sm9863908pgn.35.2023.07.25.00.23.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jul 2023 00:23:16 -0700 (PDT) From: Ze Gao X-Google-Original-From: Ze Gao To: Ingo Molnar , Peter Zijlstra , Steven Rostedt , Namhyung Kim , Ian Rogers , Arnaldo Carvalho de Melo , Jiri Olsa , Mark Rutland , Masami Hiramatsu , Adrian Hunter , Alexander Shishkin Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Ze Gao Subject: [RFC PATCH 3/3] libtraceevent: sync with latest sched_switch tracepoint definition Date: Tue, 25 Jul 2023 15:22:54 +0800 Message-Id: <20230725072254.32045-4-zegao@tencent.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230725072254.32045-1-zegao@tencent.com> References: <20230725072254.32045-1-zegao@tencent.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_BLOCKED,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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772378200487722943 X-GMAIL-MSGID: 1772378200487722943 Since tracepoint sched_switch changes its reported task state type, update the parsing logic accordingly. Signed-off-by: Ze Gao --- plugins/plugin_sched_switch.c | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/plugins/plugin_sched_switch.c b/plugins/plugin_sched_switch.c index 8752cae..37c1be2 100644 --- a/plugins/plugin_sched_switch.c +++ b/plugins/plugin_sched_switch.c @@ -9,27 +9,6 @@ #include "event-parse.h" #include "trace-seq.h" -static void write_state(struct trace_seq *s, int val) -{ - const char states[] = "SDTtZXxW"; - int found = 0; - int i; - - for (i = 0; i < (sizeof(states) - 1); i++) { - if (!(val & (1 << i))) - continue; - - if (found) - trace_seq_putc(s, '|'); - - found = 1; - trace_seq_putc(s, states[i]); - } - - if (!found) - trace_seq_putc(s, 'R'); -} - static void write_and_save_comm(struct tep_format_field *field, struct tep_record *record, struct trace_seq *s, int pid) @@ -100,7 +79,7 @@ static int sched_switch_handler(struct trace_seq *s, trace_seq_printf(s, "[%d] ", (int) val); if (tep_get_field_val(s, event, "prev_state", record, &val, 1) == 0) - write_state(s, val); + trace_seq_putc(s, (char) val); trace_seq_puts(s, " ==> ");