Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp131123rwp; Wed, 12 Jul 2023 10:44:09 -0700 (PDT) X-Google-Smtp-Source: APBJJlFKfq5iLdm7EHOLKw3cftOcEC7dHyYfzAX6+F1tmqBCD3z01H9AYldPAqSyDLP07BS+SGDi X-Received: by 2002:a17:906:68c9:b0:960:ddba:e5c6 with SMTP id y9-20020a17090668c900b00960ddbae5c6mr17032822ejr.22.1689183848783; Wed, 12 Jul 2023 10:44:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689183848; cv=none; d=google.com; s=arc-20160816; b=x+fVjw6Q6YknikqXqpBpfHPdMESnX9t3YXeZYlU7l200HOJpdZjj4Gr+by9JynwOct ptsWNjn7/6AP8vFNPvNRNQo21qqy8tbTxcXJoiUsXKu2xWkrTshf5v8zmGFa+GqmjcQl 2fIuOoAQO8iNIlSdcGvy5qAVxwue+PILtFI9eeMIShXcNHDR4Jrn/2B2OKJMsIbV10v4 vg96cO6SRU7sTMj1IIRWWgdYYpFyCtaIxY8DsBz70PlkZI5rARRv0V6n/JFdJy4geHtI 8ZWWS9GaH+IeqlOXL6nmfEnQjS6punVJ1u5JFiNuW5afvYsgc7Mphkq0XLyU92MTWndT +SCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=HrWeWmJCdvVgXyliZ1/YegMmsWAccO5WW3YyUUW2YD0=; fh=r6t8ZIiaysjVIQ+d75wHhRrXERh1gbUWb6hp/nHvAjY=; b=o7YkauM6HfxlGyvejxD6ZjHI0FZNZ1aDJxEFXRfwY7o+Yr0KTCdoXPF6lCwjSJ5yeT mRk0wpgMSRTzlHPb/rFSG7TZAEJlfI0BGFQCGEVnjLwEFapjGyku/uu7hUnEqYnDUSv4 hwjCN2KcElX89Khdj8YpDJWtBFS89IORITTNGC1OyGayCOMmj+EMaNLfouuOrkke9H+a z9wzA+DUUIxRTjyiJ8cA+aNPdRpjBgm0VLjz6XcHzXvxVMQnzcVffljWiTDHKpx9r7mS aAzSPKbMTcEFGZiUzVq2W0/yfGh6eSbTCmgJPfcRe68wTheGPpKOFQbCh4GbBKqDZikz tOpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=IpcxfUaP; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sa17-20020a170906edb100b00992e91c6f3bsi5050365ejb.806.2023.07.12.10.43.43; Wed, 12 Jul 2023 10:44:08 -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=@google.com header.s=20221208 header.b=IpcxfUaP; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233363AbjGLQu4 (ORCPT + 99 others); Wed, 12 Jul 2023 12:50:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233028AbjGLQuz (ORCPT ); Wed, 12 Jul 2023 12:50:55 -0400 Received: from mail-qt1-x82b.google.com (mail-qt1-x82b.google.com [IPv6:2607:f8b0:4864:20::82b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3A381BFA for ; Wed, 12 Jul 2023 09:50:52 -0700 (PDT) Received: by mail-qt1-x82b.google.com with SMTP id d75a77b69052e-401d1d967beso9941cf.0 for ; Wed, 12 Jul 2023 09:50:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1689180652; x=1691772652; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=HrWeWmJCdvVgXyliZ1/YegMmsWAccO5WW3YyUUW2YD0=; b=IpcxfUaPhWIprdj58vlbq3Z4pHWo7awEFaOMX5Cz4OFgWAi2gKPPCiJual0yQ9u8sg /a55byZ0FxaAopfV5C8STDKQkBvP9SiNsd3OT2cLEXa55Bw9yzx1iokE2waI5xwjhhZw zM5Kit2HleHVUllHn4r06zhGqQMvETkyvyA0TP/XUaR1DfB70gkygOrLq4fhWpWlThmx 4pkUeFHZD6BlFTzwAmF+GK9GEXg1TUFhDPOplDMt+GU7AizElJ/aJ6u6f/Q0p3KM1RgZ VLW1jj90B+3hh47KlKqF1jtHvPJ2OM5Ikk2kmKsXcO+SmnjB3Z1+wC4PEtMDtYi6/xe1 pBEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689180652; x=1691772652; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HrWeWmJCdvVgXyliZ1/YegMmsWAccO5WW3YyUUW2YD0=; b=dl22qxOuq7Vef+0mUDrzlRKDawTpoEaxnjrp+3fDZqnluy60D+k4yxyBHLItpMZEbs lTlI+CWrJQRuXkPuAhiywopYCIUL2a2r3H2aLKnnz39ia3YLbZ8OFZAYU7ZeTTU7jINt kh8dU2N4EZ3LD/i+v1dBfp/Vr1rZNLCQ7unCZLgyk/ZUjL3lq1kVcZLCLaOWerJjB+jC e1HLByHFUQ5HOadEbhgBMSleHWwTmtnheQv3mirtB1LvLSN4Ja0QVieQWlJGnb4Bc77K LXZJD6aGlMT3BVfRWbi9ssTWuYqVHWnck7pVS6CX5toGACo2MXmaI8pfMm3BD1kcR208 SprQ== X-Gm-Message-State: ABy/qLZVtnDM1FMEYrHdyZxLNfQAZsV95ee1EviCCBOnk7pLoRINpiQ0 Yiwe0+i/3cWyZv/HdW4LJwQ+TexsuEacZSZXw/9MAsLY+g2bFrINHuY= X-Received: by 2002:a05:622a:38a:b0:3f5:2006:50f1 with SMTP id j10-20020a05622a038a00b003f5200650f1mr293662qtx.12.1689180651668; Wed, 12 Jul 2023 09:50:51 -0700 (PDT) MIME-Version: 1.0 References: <5d3727bacffa331cd81a059fc3122cfb3f43dabd.1689024635.git.anupnewsmail@gmail.com> In-Reply-To: <5d3727bacffa331cd81a059fc3122cfb3f43dabd.1689024635.git.anupnewsmail@gmail.com> From: Ian Rogers Date: Wed, 12 Jul 2023 09:50:40 -0700 Message-ID: Subject: Re: [PATCH v3 1/6] scripts: python: Add initial script file with imports To: Anup Sharma Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Adrian Hunter , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED,USER_IN_DEF_DKIM_WL, USER_IN_DEF_SPF_WL autolearn=unavailable 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 Mon, Jul 10, 2023 at 4:09=E2=80=AFPM Anup Sharma wrote: > > Added the necessary modules, including the Perf-Trace-Util > library, and defines the required functions and variables. > It leverages the perf_trace_context and Core modules for > tracing and processing events. Also added usage information. > > Signed-off-by: Anup Sharma Acked-by: Ian Rogers > --- > .../scripts/python/firefox-gecko-converter.py | 28 +++++++++++++++++++ > 1 file changed, 28 insertions(+) > create mode 100644 tools/perf/scripts/python/firefox-gecko-converter.py > > diff --git a/tools/perf/scripts/python/firefox-gecko-converter.py b/tools= /perf/scripts/python/firefox-gecko-converter.py > new file mode 100644 > index 000000000000..5b342641925c > --- /dev/null > +++ b/tools/perf/scripts/python/firefox-gecko-converter.py > @@ -0,0 +1,28 @@ > +# firefox-gecko-converter.py - Convert perf record output to Firefox's g= ecko profile format > +# SPDX-License-Identifier: GPL-2.0 > +# > +# The script converts perf.data to Gecko Profile Format, > +# which can be read by https://profiler.firefox.com/. > +# > +# Usage: > +# > +# perf record -a -g -F 99 sleep 60 > +# perf script firefox-gecko-converter.py > output.json > + > +import os > +import sys > +import json > +from functools import reduce > + nit: technically some of these imports should be added when necessary in the code. > +# Add the Perf-Trace-Util library to the Python path > +sys.path.append(os.environ['PERF_EXEC_PATH'] + \ > + '/scripts/python/Perf-Trace-Util/lib/Perf/Trace') > + > +from perf_trace_context import * > +from Core import * > + > +def trace_end(): > + pass > + > +def process_event(param_dict): nit: (this is likely addressed in later patches) you can add return and parameter types here to aid understanding of the code. Function comments are also useful. > + pass > -- > 2.34.1 >