From nobody Sun Dec 14 06:36:57 2025 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 C5468EB64DC for ; Mon, 10 Jul 2023 23:13:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231189AbjGJXN4 (ORCPT ); Mon, 10 Jul 2023 19:13:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230496AbjGJXNt (ORCPT ); Mon, 10 Jul 2023 19:13:49 -0400 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7ABB9E; Mon, 10 Jul 2023 16:13:48 -0700 (PDT) Received: by mail-pj1-x1032.google.com with SMTP id 98e67ed59e1d1-262e66481c4so2395506a91.1; Mon, 10 Jul 2023 16:13:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689030828; x=1691622828; 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=nkq4D9xPcGffxrWboWnEtYoPxH3qm7wLImoo2iq2oVo=; b=TcEJFTldAGYmOwZJM0VtK1sxEAYhc3DH8xF2LIP8d9rXlrXRItrQmp50lOQScm730o J/8WpLWSb+2UkZ8twUnXZwm+eTBe2Rgux6GSI94a87sK9zYCsIRVGaSAVloCh5URJ+pC 2//YV+SyLfo6m+kznHuAJNvfJhxjggbGwtxeKpkKJSLe4XYr/hLs9TWAXnWqWmlD1cRl yk9/5BR6ipwSd1EzLMWtYzF9QCuCPlyVBdpEbAQSZqwI78KTVz70qKa5890aGwG3OaeR ORLY0ktlwb1URqza7X9n/v5h05rMIlzWx4UKOdJH4kqmD4yalUELBGhZOU8UWSIeijv/ AVRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689030828; x=1691622828; 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=nkq4D9xPcGffxrWboWnEtYoPxH3qm7wLImoo2iq2oVo=; b=l0ywbY9RD1xDuQEfoncAuQD9wiGDROoaH8I2+YS/wfkASXify066+O0+g+xx1VbhZd 1JYjlArCc7iubvazajHlB7rRxIRQeHm42+VVqTGf4SoFYK2axqDi0qtvqCf5UViXlg6R ij0PfxctLmObOnUmJn4V+WCXytUzv8m/DjQXn0Irm8yctKWgLwSBx17zYK92jgENZYyp ymCTe85DeOe9Cv7031t7nRFRdJJ5JOjMX3ZWdGj29gnev9nOQ5mk3hoTj6qbPeL37/Aq ekyenX3SlhvPHvmcufsDaTIOhShaMHFngcy142w5NoHb1wbVPYIaWaxb6qqFijgiXAFm nyng== X-Gm-Message-State: ABy/qLb3qu6Q/yDU0QFj0IkXUDoD7FmaOtned4Vl749SwduFKBustOd2 aR9sYN36tKuUjdqA1GkoVF8= X-Google-Smtp-Source: APBJJlHzh9FTPyE9kL1HOB2Il09oaQYGfAGYRwKgGdi4LYSXdL7Bhv9GN5zmlgWT6HYc09cDj8Vyfw== X-Received: by 2002:a17:90a:d916:b0:261:631:95c2 with SMTP id c22-20020a17090ad91600b00261063195c2mr10054850pjv.27.1689030828296; Mon, 10 Jul 2023 16:13:48 -0700 (PDT) Received: from yoga ([2400:1f00:13:76f2:868d:bc7d:562b:a5bb]) by smtp.gmail.com with ESMTPSA id 30-20020a17090a191e00b002640b7073cfsm7300485pjg.14.2023.07.10.16.13.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jul 2023 16:13:48 -0700 (PDT) Date: Tue, 11 Jul 2023 04:43:40 +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 v3 4/6] scripts: python: Add trace end processing and JSON output Message-ID: <11543b39f97a7e2f9eac76c1233f1b1caa3f2c48.1689024635.git.anupnewsmail@gmail.com> 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" Inside the trace end function the final output will be dumped to standard output in JSON gecko format. Additionally, constants such as USER_CATEGORY_INDEX, KERNEL_CATEGORY_INDEX, CATEGORIES, and PRODUCT are defined to provide contextual information. Signed-off-by: Anup Sharma --- .../scripts/python/firefox-gecko-converter.py | 34 ++++++++++++++++++- 1 file changed, 33 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 0b8a86bdcab1..39818a603265 100644 --- a/tools/perf/scripts/python/firefox-gecko-converter.py +++ b/tools/perf/scripts/python/firefox-gecko-converter.py @@ -24,8 +24,40 @@ from Core import * thread_map =3D {} start_time =3D None =20 +# Follow Brendan Gregg's Flamegraph convention: orange for kernel and yell= ow for user +CATEGORIES =3D [ + {'name': 'User', 'color': 'yellow', 'subcategories': ['Other']}, + {'name': 'Kernel', 'color': 'orange', 'subcategories': ['Other']} +] + +# The product name is used by the profiler UI to show the Operating system= and Processor. +PRODUCT =3D os.popen('uname -op').read().strip() + def trace_end(): - pass + thread_array =3D thread_map.values())) + + result =3D { + 'meta': { + 'interval': 1, + 'processType': 0, + 'product': PRODUCT, + 'stackwalk': 1, + 'debug': 0, + 'gcpoison': 0, + 'asyncstack': 1, + 'startTime': start_time, + 'shutdownTime': None, + 'version': 24, + 'presymbolicated': True, + 'categories': CATEGORIES, + 'markerSchema': [] + }, + 'libs': [], + 'threads': thread_array, + 'processes': [], + 'pausedRanges': [] + } + json.dump(result, sys.stdout, indent=3D2) =20 def process_event(param_dict): global start_time --=20 2.34.1