Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp36029029rwd; Mon, 10 Jul 2023 16:53:59 -0700 (PDT) X-Google-Smtp-Source: APBJJlH35ihYmGn/djPKMGLO50cjZGxVKJVi7LXklciw1dYwfKklWgnY1g73Vi00+2jrwtAMYSkV X-Received: by 2002:a2e:800b:0:b0:2b6:cb0d:56ae with SMTP id j11-20020a2e800b000000b002b6cb0d56aemr9612013ljg.11.1689033239418; Mon, 10 Jul 2023 16:53:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689033239; cv=none; d=google.com; s=arc-20160816; b=UXfYTahRWjMRlNrF/J1cwwX5hme3tQ0S9JQ2ICvw7SguXTnXWqwnNNErgA5sGweyHR Hm/TybTk4XRcjeA0KRJRt87KZnV/FftyBAJtKUSbQ5vOxLDhPhJyo4vn21iTsFErCoUu yVsY7ujZNpfmuGg0uAABjE2CWMPJFVnij3ct+g8vu0c/EP/2JyUIhap1a72sb47A891D r3oCJuxvghj74gzFEebM4rjSPygGNnUxXJemPsEJuY5O1QSMooX102MngkywSCt8TxuW HpiGN/h6wKpBZ1LEBbgR05Dfjrr0cg4+5KY0nS4NS30cB9scmInrrucBQDrxOpxe2/6g sZjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:to:from:date:dkim-signature; bh=nkq4D9xPcGffxrWboWnEtYoPxH3qm7wLImoo2iq2oVo=; fh=74JdZCcncRx9vhK0g0jCPyLh0X9SLH8kcZrk5gmejJ4=; b=0PzVcjfd2n8jEsa9UaiJ37OcwDD4JTFvT8Ly+l/M+CUcnb47pThq0WAoV9W6rd/1SZ RWRGuj2u6nd8vVw9egOP17SN63ddM1Dg2PZ9kDwkVt7ZRMD+NmcPNC8nZfVZ3BhnGQm/ lFxZ6a5CqM/qasv8jtSVRocUnvxr5awetUCTDeNhNu//02k6YCVOabZmY7Ha5xFeorRx 7RKXjRK7YkkxLkuW6CEKTusw8sGStbqAvCoZbGbqKGDZhm7miGe9K3sw2psAHnQIpIOj 2JIDr7OFnnRixAW/SDncVZG4NYfuRCAJ7gOtn2kHa4CP6VJVQhzyXJcyggO0Roex5Imc t+Ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=TcEJFTld; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y15-20020a170906470f00b00973a7283de2si630046ejq.505.2023.07.10.16.53.35; Mon, 10 Jul 2023 16:53:59 -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=TcEJFTld; 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 S231124AbjGJXNz (ORCPT + 99 others); Mon, 10 Jul 2023 19:13:55 -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-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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 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/perf/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 = {} start_time = None +# Follow Brendan Gregg's Flamegraph convention: orange for kernel and yellow for user +CATEGORIES = [ + {'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 = os.popen('uname -op').read().strip() + def trace_end(): - pass + thread_array = thread_map.values())) + + result = { + '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=2) def process_event(param_dict): global start_time -- 2.34.1