From nobody Sun Feb 8 11:06:34 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1B80C001DC for ; Tue, 18 Jul 2023 22:48:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231168AbjGRWsu (ORCPT ); Tue, 18 Jul 2023 18:48:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229518AbjGRWsr (ORCPT ); Tue, 18 Jul 2023 18:48:47 -0400 Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF384EC; Tue, 18 Jul 2023 15:48:34 -0700 (PDT) Received: by mail-pg1-x52d.google.com with SMTP id 41be03b00d2f7-55c993e26ffso2433620a12.0; Tue, 18 Jul 2023 15:48:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689720514; x=1692312514; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=1d8swg9Y9ZixZmusx5ZmXbxt99Xqol7znCwCmQSk3ZI=; b=emwJY9ZJECLmBaafe7jMvIHAr4sMp56GWkOkD7dQZL5tAOkKbIVuBc5y7+2hvJD5ZC SScNluQBdVqrXU8XA0q5rXinV8EaBkL4x9F83xoAmn/kx2+LcNhCFghJVdly7VCbGlwN 8HCR4Gdqoy74YVjuRkik+yCbDi9/QQwRkVnUgbv9gA5na23PcLR0YLBCDT1wetrDr1c0 qVNappH1/hxsd6g85MH1Gctgw1CZvKwUKqGwG2LGdBHwN23rNY4pZdI/vEW7MWBpIpWt kTm2Umi602swO+e+Ye72G0Sjoa+2Q5/56UGa6oTsayuOyc9fKa2mTzFxPvQQRQN1czE8 xLeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689720514; x=1692312514; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=1d8swg9Y9ZixZmusx5ZmXbxt99Xqol7znCwCmQSk3ZI=; b=NTUrLlri4JASAN2goQRF1D7ovF9DPpCGdphH7Mx7SNUf0MorAAWdUJzZ+gwjheeynq bXdZA2nBBx1gwc41jNKKbly/PoDw9zeavPOby4nTcTjQFqyCtN3kF1dz4hNzX5Ux4Tp+ /rETyYkMabMxwu+rQn2kjKcZ3qPAAFyGBLLsR2UuEL2Au38DwjtKmBVpGRuyZR1nVB8F GXlZ1vqM1wl/lFEqE7ta2P2Ody2susU7Ak06IsAolU2C3N96Ums5YAt1pue2FnRriaEN xvmza0vAanSTQAHf2WBg+n9JxAQDPuvF/OPqNvM91dudRGt8UPWpsMludXjnwHM6FlMd JaeQ== X-Gm-Message-State: ABy/qLbM6yZm5qugN9rGUVttb/tiyHNT20wtgwkEQLHlQ5SU9Tduh88G TXSHr0uylGmo0lFeneo8x4g= X-Google-Smtp-Source: APBJJlEr9VeGDpzg3TrHyG+9650W/M65MuPWS5iwlfcndUVKOal5WfoaF32Bn8dB3y9BpmI1dyGKSg== X-Received: by 2002:a05:6a20:3955:b0:12f:dce2:b385 with SMTP id r21-20020a056a20395500b0012fdce2b385mr4062572pzg.10.1689720514171; Tue, 18 Jul 2023 15:48:34 -0700 (PDT) Received: from yoga ([2400:1f00:13:be68:c61a:77e0:3624:e4f6]) by smtp.gmail.com with ESMTPSA id u21-20020aa78395000000b0065434edd521sm1959826pfm.196.2023.07.18.15.48.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jul 2023 15:48:33 -0700 (PDT) Date: Wed, 19 Jul 2023 04:18:26 +0530 From: Anup Sharma To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , Anup Sharma , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 2/6] perf scripts python: Extact necessary information from process event Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The script takes in a sample event dictionary(param_dict) and retrieves relevant data such as time stamp, PID, TID, and comm for each event. Also start time is defined as a global variable as it need to be passed to trace_end for gecko meta information field creation. Signed-off-by: Anup Sharma --- .../perf/scripts/python/firefox-gecko-converter.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tools/perf/scripts/python/firefox-gecko-converter.py b/tools/p= erf/scripts/python/firefox-gecko-converter.py index 63ecaf1abee8..bfc8c2b026bf 100644 --- a/tools/perf/scripts/python/firefox-gecko-converter.py +++ b/tools/perf/scripts/python/firefox-gecko-converter.py @@ -20,10 +20,22 @@ sys.path.append(os.environ['PERF_EXEC_PATH'] + \ from perf_trace_context import * from Core import * =20 +# start_time is intialiazed only once for the all event traces. +start_time =3D None + # Uses perf script python interface to parse each # event and store the data in the thread builder. def process_event(param_dict: Dict) -> None: - pass + global start_time + global tid_to_thread + time_stamp =3D (param_dict['sample']['time'] // 1000) / 1000 + pid =3D param_dict['sample']['pid'] + tid =3D param_dict['sample']['tid'] + comm =3D param_dict['comm'] + + # Start time is the time of the first sample + if not start_time: + start_time =3D time_stamp =20 # Trace_end runs at the end and will be used to aggregate # the data into the final json object and print it out to stdout. --=20 2.34.1