Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp9888684rwd; Wed, 21 Jun 2023 13:14:30 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6r5vKgE0C1epQ5qxQ5jQmBvkHC1wvs2iCP71O6oynWrG+OTko7YMjKafnETJNR40R8EFXa X-Received: by 2002:a05:6870:1841:b0:1a3:2447:7f4a with SMTP id u1-20020a056870184100b001a324477f4amr12804294oaf.32.1687378470419; Wed, 21 Jun 2023 13:14:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687378470; cv=none; d=google.com; s=arc-20160816; b=1EDBbjMigrIXf+hxLImfIz3bxZ24oqjcTuvv5kaRTVONd3xucRodY+bZ1y5M3XiDD9 NBNDm36HlQYoHW/IjsuJ/iy1/dJKprdKZDJ9PYmaoU5R/xzEaVODH3AUgWK43bp/60pq kqJ2FeuW8O9UMrcE/APDt0QPpcrpB4n59EsqrA1Bb0k8PqYSpPyV4s1uTrPPFvCa3ijG BkN+WBJ8S9b59VpLy0ZITwyJib5MYCnjNhOCbcz2EcZ4n7Gg3RMgA0pE0l3sz07bsN6K RpzoxTI8lTr7OhLM4713TRdt4ZwcFaErY7DQQ7/ORkomZMoFJljIpE5Nb+7Sk6ag3JeJ HLng== 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=wysmKxTjA5POXPuSnL3ZWdPlXIDrR3joMPak2RW+D1M=; b=yiwJ9Xy3Ur5RzH1sY7QRdjHVwlQ4YbxBxT8vgK0xaXphPOWZKt1pG77O9SXD3cEtOT nq9JUXivnlwlLLWk6VE8xSwSxDSC7f7szypbs98Pz9lQsZvUjI2pjvLUmcMI+vlpvzut EA2ZqtJXwT6r2IMeMsl1u5h4OLIUTQoSFmMVCCItdbxyuEVtdImQMPh14Pb+y+bUmOND qEvS4peDrQGBTend6aLPfOXthtg55U8amgT5ZMepliXmqIOeRt0yWCHjQ7WNy82QVF7W +D0uvYnna71/L5JHp/JeM1bnNeJYArW139Q7zhTsEuH5RpFZ3H4KAcS2xNvhV7rnXeGc XBPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=S07+kLCU; 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 on11-20020a17090b1d0b00b00260a7aee61asi413034pjb.155.2023.06.21.13.14.17; Wed, 21 Jun 2023 13:14:30 -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=S07+kLCU; 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 S231251AbjFUThZ (ORCPT + 99 others); Wed, 21 Jun 2023 15:37:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231145AbjFUThU (ORCPT ); Wed, 21 Jun 2023 15:37:20 -0400 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD4121992; Wed, 21 Jun 2023 12:37:14 -0700 (PDT) Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1b5465a79cdso28158575ad.3; Wed, 21 Jun 2023 12:37:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687376234; x=1689968234; 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=wysmKxTjA5POXPuSnL3ZWdPlXIDrR3joMPak2RW+D1M=; b=S07+kLCUT/SwJ5u1DA+bkwXwy97NCQpkedZxhO8+z6Wq8+W6n5xNfqYhJNk24Dtx2J dsZxb94BkFneFYNQTcJrx8e3lpkdZnE1tJk7lz0V00qnMvjNIHqsPDTZbhqhTz6jHwvO 6zjxgjTnw/hw9pNYqi6jVBHgBPAjDkE30MLk8M06RDHtHJa4nxy0YJn5kUvO35SLeyT8 zy1l6SfvqEVmjFVNjvRL/Mr0Ot5X1KwelKNhaHVqD36RmV561WGqqqenu8/0Ran/6sRe Xlp8JlZCoyOMC3ds4twYoRWsqJkF0S9kPLKsYbVG52nnv76D7niK19XtvLp/MrLrzw6O 9m4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687376234; x=1689968234; 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=wysmKxTjA5POXPuSnL3ZWdPlXIDrR3joMPak2RW+D1M=; b=Qw9zjJPq7bIfEC1mR7TQtVVIb7vCsL/kWdwCB3rhWUgEsRkQP405SMK2pIwbcwlxYi p5Kgq7pIqYUqi2K4igh6HXqFt9IXKTipAB13Q0yu9fAhsKtEiQJqAHjaPV+2pwp1gEbD wFb8ZqPxTyu0ZWOryfLlWln5GGCn9XXSndZbfOjSnS1i3uZLmOQ4TpJGt0VYFN+TipZb dfaVSQVyXUCF9/qVjX3jLawxt3rOT2C7qPRfi7huTSSfJ+Y4i1oJs5fvvitfcWUn3sN/ xlTY1iiA7ucUA93pAMpeuWFX/CyR8XVvzY5rxAYRdNBbBvqqrwgGOs54dSx1zrDVhx39 SA4w== X-Gm-Message-State: AC+VfDx9w7XVG2rEP+V6pSdeGmmLHiUd7WwVH2YRiDgnjSueYVyxE1ku XbXgjAfFiEuXSPkismqhwHs= X-Received: by 2002:a17:902:f551:b0:1b5:4f50:f1e0 with SMTP id h17-20020a170902f55100b001b54f50f1e0mr11017305plf.29.1687376234097; Wed, 21 Jun 2023 12:37:14 -0700 (PDT) Received: from yoga ([2400:1f00:13:6258:556c:aad7:2240:7612]) by smtp.gmail.com with ESMTPSA id jl17-20020a170903135100b001b39f8dc06fsm3862326plb.152.2023.06.21.12.37.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jun 2023 12:37:13 -0700 (PDT) Date: Thu, 22 Jun 2023 01:07:05 +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 1/9] scripts: python: Add check for correct perf script format Message-ID: 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, 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 The isPerfScriptFormat function, validates the format of a perf script. The function checks if the given input meets specific criteria to determine if it is a valid perf script output. Signed-off-by: Anup Sharma --- .../scripts/python/firefox-gecko-converter.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 tools/perf/scripts/python/firefox-gecko-converter.py diff --git a/tools/perf/scripts/python/firefox-gecko-converter.py b/tools/perf/scripts/python/firefox-gecko-converter.py new file mode 100644 index 000000000000..73a431d0c7d1 --- /dev/null +++ b/tools/perf/scripts/python/firefox-gecko-converter.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 +import re +import sys +import json +from functools import reduce + +def isPerfScriptFormat(profile): + if profile.startswith('# ========\n'): + return True + + if profile.startswith('{'): + return False + + firstLine = profile[:profile.index('\n')] + return bool(re.match(r'^\S.*?\s+(?:\d+/)?\d+\s+(?:\d+\d+\s+)?[\d.]+:', firstLine)) -- 2.34.1