Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp29535490rwd; Wed, 5 Jul 2023 13:23:41 -0700 (PDT) X-Google-Smtp-Source: APBJJlFF7yDoChWmgPupIN+WzPRxI3OZ4poPDL48q3lvkONJmX0LUi4TkFXizfiNfIqmWR4LSjM9 X-Received: by 2002:a05:6a20:9d94:b0:12d:a04c:7e8b with SMTP id mu20-20020a056a209d9400b0012da04c7e8bmr12185680pzb.40.1688588621091; Wed, 05 Jul 2023 13:23:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688588621; cv=none; d=google.com; s=arc-20160816; b=gcIi6hC6W9bEiI8d9wVSHBha0rm3SoxK3ZlAxhD1AJ2NGFgQ+6bVLrBdCPfqCL874I kw5UCUHDeb9niZIA8Snu8QJD0HXIAD5XfoMssGEVrBD/EPGORDQUVFhgwB+CW6hcA6Cx QdKaDPoB7NZvPP2MAnDWT9HTr8U7gSVxAwyl7Fz8FshNz6kiPwRPUGzw+92p7tgqbFIy IzKbops4tnS7CuG/QY1Zry+uqW9BThic0p1GngQL2nTfRFfTr/YDnf6InX9ysgehEmGV JTGSAduAqmPjDRkJBoEDnMLNfsSY7/gLuUFYmeXY/yuoNAyupFePtuEvrbfJx0Zawc7m bnTg== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:date:from:dkim-signature; bh=lr+OJtVyAxS2YZZNpALcE7P9fld+sL5KFJ+QmTRku7k=; fh=vck5kFZ6SdlNXAtY63R+nnnix1rYSWhBCpJaUQTr4iQ=; b=E9fciIjwEXTc4NYYDGlaCU1woX6As62gTbNW6/Cgjt4s1AEaI72oVZVYSjqL3hzp6l 7e8wvhBY6c7IBgUzqGE4ltYg4jQXwiW3URJleOV+xYllSmZhuj6byEpAPcpr4KNVa9zv 3g2CltrfNAZLuKykezLpcuEdsnoSK0dyuQeq7gBdOGjm9vXwCW9bBlEJzHSjDAeUlVxt iuRRGA8wARLdyYzsWiAWSdghgusKYrW3Z++DynuUYASwt99YFWQGj4BUbuYTDgohdMV7 YOHO+5gDl8WM3wRPsFr3t6TsNQbKS4YZ3g0Zm+ylRyeOYaNT33jVfoXBv799EorMauD5 /oDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=Zb1FJmd9; 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 z27-20020a056a001d9b00b00666c9148d03si20652476pfw.6.2023.07.05.13.23.28; Wed, 05 Jul 2023 13:23:41 -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=Zb1FJmd9; 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 S232934AbjGEUCA (ORCPT + 99 others); Wed, 5 Jul 2023 16:02:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229700AbjGEUBx (ORCPT ); Wed, 5 Jul 2023 16:01:53 -0400 Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11135121; Wed, 5 Jul 2023 13:01:49 -0700 (PDT) Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1b89600a37fso18385585ad.2; Wed, 05 Jul 2023 13:01:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688587308; x=1691179308; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:date:from:from:to :cc:subject:date:message-id:reply-to; bh=lr+OJtVyAxS2YZZNpALcE7P9fld+sL5KFJ+QmTRku7k=; b=Zb1FJmd9sQBDTe7gTKyJ3r1Ie574IGzORuw90G/FqGbphJHOMPbAxyYG27GkZxp8BC vtrP+c99e3oJH69vFXwOkOSwCeDNjq8v1+yigmx0G3S2BHFqNKYU+TZJiZ7BfzM9RrQk 68t3Z/UjAKdfGzr4e4+3a03lirqD7rUJx44YSJBl5Iuo2BapV88KomZZmc6khG1OsSff 9MOXkghbR/dEW6BzFayPCQj3PMFuyBpiIqZNd4OMAztq3RRMS58vy2R1efRYaq467r5M CGDZjKcBx/pTb7k16Ae13Q9d8ThIBoyLRXoLjwYeKa82MK7rlPCzZSfA/O/5/uwkwK7w dRSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688587308; x=1691179308; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:date:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=lr+OJtVyAxS2YZZNpALcE7P9fld+sL5KFJ+QmTRku7k=; b=awDyfdUffvtkNFPteiaSEZGlgxqSiYBSnGlJKTnIfH3vDPOwJ1fjZuzSzKf7uKBgLE 1DUnFRfUh0z+UUeHjebtXbdsymhbkklLMeTrHsmEpvA3O8irVbO+MkbA+rW2T+EWH+tK asdK00YciOPszDGknJFpmC7CEnvLKNdiv8fdGYrfa1yPvziveHLqe8+2LBvaTCMn6ByJ uhlVBY74ZUfsNDYGHfYOt4OlrOs4vjUTb6ckOVyyB/gQGjyop19a8pJgxZfGAhoHo8Fe rVPWhtY9D5SHh3a8zfDDKq40Qyull5ukZHv4T/jb4dXMyRqTeLQps004IKLZSTNwv32l /8Yg== X-Gm-Message-State: ABy/qLa3triI4qfhRo5xhcj5y1MSO6I9EtTwFboF+7VLQcHJkuVIRM5M YnxnBvb0pH9BbdZCBd+Ng3U= X-Received: by 2002:a17:902:da92:b0:1b5:5a5f:369b with SMTP id j18-20020a170902da9200b001b55a5f369bmr16089762plx.65.1688587308312; Wed, 05 Jul 2023 13:01:48 -0700 (PDT) Received: from yoga ([2400:1f00:13:c628:31be:68ae:86f5:48b9]) by smtp.gmail.com with ESMTPSA id m23-20020a170902bb9700b001b50cbc0b4fsm19351441pls.111.2023.07.05.13.01.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jul 2023 13:01:47 -0700 (PDT) From: Anup Sharma X-Google-Original-From: Anup Sharma Date: Thu, 6 Jul 2023 01:31:40 +0530 To: Namhyung Kim Cc: Anup Sharma , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 7/9] scripts: python: implement get or create frame function Message-ID: References: <4d0ac80521ebd44322a360ac331ce2443a1f0f26.1687375189.git.anupnewsmail@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit 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, URIBL_BLOCKED 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 On Fri, Jun 23, 2023 at 05:04:56PM -0700, Namhyung Kim wrote: > On Wed, Jun 21, 2023 at 12:45 PM Anup Sharma wrote: > > > > The CATEGORIES list and the USER_CATEGORY_INDEX and > > KERNEL_CATEGORY_INDEX constants has been introduced. > > > > 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 | 38 +++++++++++++++++++ > > 1 file changed, 38 insertions(+) > > > > diff --git a/tools/perf/scripts/python/firefox-gecko-converter.py b/tools/perf/scripts/python/firefox-gecko-converter.py > > index 30fc542cfdeb..866751e5d1ce 100644 > > --- a/tools/perf/scripts/python/firefox-gecko-converter.py > > +++ b/tools/perf/scripts/python/firefox-gecko-converter.py > > @@ -15,6 +15,13 @@ def isPerfScriptFormat(profile): > > firstLine = profile[:profile.index('\n')] > > return bool(re.match(r'^\S.*?\s+(?:\d+/)?\d+\s+(?:\d+\d+\s+)?[\d.]+:', firstLine)) > > > > +CATEGORIES = [ > > +{'name': 'User', 'color': 'yellow', 'subcategories': ['Other']}, > > +{'name': 'Kernel', 'color': 'orange', 'subcategories': ['Other']} > > +] > > +USER_CATEGORY_INDEX = 0 > > +KERNEL_CATEGORY_INDEX = 1 > > + > > def convertPerfScriptProfile(profile): > > def _createtread(name, pid, tid): > > markers = { > > @@ -70,6 +77,37 @@ def convertPerfScriptProfile(profile): > > stackMap[key] = stack > > return stack > > > > + frameMap = dict() > > + def get_or_create_frame(frameString): > > + frame = frameMap.get(frameString) > > + if frame is None: > > + frame = len(frameTable['data']) > > + location = len(stringTable) > > + stringTable.append(frameString) > > + > > + category = KERNEL_CATEGORY_INDEX if frameString.find('kallsyms') != -1 or frameString.find('/vmlinux') != -1 or frameString.endswith('.ko)') else USER_CATEGORY_INDEX > > This line is too long, we usually don't allow long lines > over 100 characters. Thanks for your suggestion. I have taken care in latest version. Is there any way to add such checks in editor itself ? I used checkpatch.pl scripts, however it didnt catch this. > Thanks, > Namhyung > > > > + implementation = None > > + optimizations = None > > + line = None > > + relevantForJS = False > > + subcategory = None > > + innerWindowID = 0 > > + column = None > > + > > + frameTable['data'].append([ > > + location, > > + relevantForJS, > > + innerWindowID, > > + implementation, > > + optimizations, > > + line, > > + column, > > + category, > > + subcategory, > > + ]) > > + frameMap[frameString] = frame > > + return frame > > + > > def addSample(threadName, stackArray, time): > > nonlocal name > > if name != threadName: > > -- > > 2.34.1 > >