From nobody Tue Oct 21 00:46:02 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 750D7EB64DD for ; Wed, 5 Jul 2023 19:48:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233793AbjGETsz (ORCPT ); Wed, 5 Jul 2023 15:48:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233699AbjGETsn (ORCPT ); Wed, 5 Jul 2023 15:48:43 -0400 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59610FC; Wed, 5 Jul 2023 12:48:42 -0700 (PDT) Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-6682909acadso32574b3a.3; Wed, 05 Jul 2023 12:48:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688586522; x=1691178522; 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=Nwmiw8kqzz8HG3/q8vV707Kb04avPuRY7Vptw/E/9iA=; b=XMX9vGJ3vgS1YR9suzkK1qqrmkpIqmrmAsgRRYbxxTDEBj9gP/e/b8d4VzRXQj+ZUe +QlXqk0PGs7Ht2p+i+KqE/0CHwQjCDPIwxj3J0sm9XQolhAAITmHVZIGPVzf+4jcA93L ahFqoOe59sQUzcydyip4GKLGo9GemKzuf2suRmYl3bI8jeOVQac7LZmDzAfs8znF/ioz JtKjRfKSo00wk7Ar9V5DE5h9RdOKdsCjYT32SxPi3WkFkDQRY62cSiCKMllaURNb8BFF p5tiLEFB6X3AocwXzj2R4LOVl7h00qmFJl2DDpDcJHW1E3UBNyyB8QIcaLy8R2Gyh/Kf u/rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688586522; x=1691178522; 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=Nwmiw8kqzz8HG3/q8vV707Kb04avPuRY7Vptw/E/9iA=; b=Ml1i0/8sqz1F0e7ME/56bpJKOkyVkIkxKsVNAXExN8baULVlqyjWUFyN0dQe2WFWPL fi4t4fSoIDwmKcSbtJMsU8cFgESH9V8+f1ZZfvmdlF1DXdp/HdHWqXV6Ra7yl096H/m6 lNf3JYGvd/TP0NnXE/4eIL8XyzdWAkwdVZVqiujW/j6sRxQDsFOOXjtIzmctMAkQrsUP qeIpwVDTHRkWoyDot/PEb5PR7d0KHM29BAVCwJ1BRvuOXgq7cEFBOGk+H851ZDUVu+5l yL2l4J5sk01N3FeMTxCdBUA81+7PQJroJwzFVcL74SQtShVaW+e/oZdT8Rb4irfLi1oC IxMA== X-Gm-Message-State: ABy/qLby4akpR9+bXnw2EpnVHB7ARl8UkZ2FimyvUlfYFLV20h36hZwo gE9B6Y40P/U/kR1vN8ca8J4= X-Google-Smtp-Source: APBJJlHg+O+p8sad9sRSUZCKtzRPgzmOdoXVj+MU4BKD8Zr76cr6X4Pf8mLTbqeSC/zaoKAbZ5bKIA== X-Received: by 2002:a05:6a00:248f:b0:668:7292:b2c2 with SMTP id c15-20020a056a00248f00b006687292b2c2mr15585714pfv.2.1688586521656; Wed, 05 Jul 2023 12:48:41 -0700 (PDT) Received: from yoga ([2400:1f00:13:c628:31be:68ae:86f5:48b9]) by smtp.gmail.com with ESMTPSA id x16-20020a056a00271000b0067459e92801sm16197721pfv.64.2023.07.05.12.48.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jul 2023 12:48:40 -0700 (PDT) Date: Thu, 6 Jul 2023 01:18:33 +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 v2 5/7] scripts: python: implement get or create frame function 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 get_or_create_frame function is responsible for retrieving or creating a frame based on the provided frameString. If the frame corresponding to the frameString is found in the frameMap, it is returned. Otherwise, a new frame is created by appending relevant information to the frameTable's 'data' array and adding the frameString to the stringTable. The index of the newly created frame is added to the frameMap. Signed-off-by: Anup Sharma --- .../scripts/python/firefox-gecko-converter.py | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tools/perf/scripts/python/firefox-gecko-converter.py b/tools/p= erf/scripts/python/firefox-gecko-converter.py index 6f69c083d3ff..d5b9fb16e520 100644 --- a/tools/perf/scripts/python/firefox-gecko-converter.py +++ b/tools/perf/scripts/python/firefox-gecko-converter.py @@ -77,6 +77,39 @@ def process_event(param_dict): stackMap[key] =3D stack return stack =20 + frameMap =3D dict() + def get_or_create_frame(frameString): + frame =3D frameMap.get(frameString) + if frame is None: + frame =3D len(frameTable['data']) + location =3D len(stringTable) + stringTable.append(frameString) + category =3D KERNEL_CATEGORY_INDEX if frameString.find('kallsyms') != =3D -1 \ + or frameString.find('/vmlinux') !=3D -1 \ + or frameString.endswith('.ko)') \ + else USER_CATEGORY_INDEX + implementation =3D None + optimizations =3D None + line =3D None + relevantForJS =3D False + subcategory =3D None + innerWindowID =3D 0 + column =3D None + + frameTable['data'].append([ + location, + relevantForJS, + innerWindowID, + implementation, + optimizations, + line, + column, + category, + subcategory, + ]) + frameMap[frameString] =3D frame + return frame + def _addThreadSample(pid, tid, threadName, time_stamp, stack): thread =3D thread_map.get(tid) if not thread: --=20 2.34.1