Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3870252pxb; Tue, 10 Nov 2020 02:06:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJxw0Dt8ZdGje6jJrFbfaOhiaVt9VOqDsgCrot4aJzYuyq9pYU4hlL87r65aL4d1meo8OaKD X-Received: by 2002:a17:906:3092:: with SMTP id 18mr19186011ejv.43.1605002774627; Tue, 10 Nov 2020 02:06:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605002774; cv=none; d=google.com; s=arc-20160816; b=ijkykxxerDdaYaCWvW+BHMQguSOxHsihdQumnRzIphWZAj+UJEcYy2lTgJWOCsu8Am 7+nA/TX4BTylpYw0xWWhGOTvU3WiqF7pHx6/YiU592BWCp8l91uqmD5VNeKwRqKDjrAv /sc7yUOLwpGWY4pIbcAF+qTOcBXfZ/9jlSaRKoGb738ysTnZwi0OAfjI0BYc+XtRlU31 IqEu9SDtUVt2VTU3IjAkJ3RyRFr8JofHr9Qgrd0YKHKIWWpJHFg4wQyqwDCJGbMo7qkr OhLePBvF62EYC2dm4ICRdtb+x+MS0yLG0yxLdwu1Ce2vXfxe6DEuLmG8IIHS7CGvdWJk xTbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:mime-version:message-id:date :sender:dkim-signature; bh=9+Z5Azrmhj3misriF6374XK8m6z58w8n3ugZjk4JaN4=; b=hoBCe7jqbaeq1UE36qQUafxKadQL+qjKRhOgj9gydxkOyzsGAz3Ytd3r0Tk/TA+8x6 tS4HnHqXTEz5r6KmTitQswd+1RMq1MJTvRAIZ37slysdIDelpZ65DpxFHdgCGDVML/lz /NOUVH/JEIuIT+czdPlk6japZI9VOrr96V5ihp6YOqZNOKPALGzV3YA145a6C6tS61B+ DzJAkG0K8rWzGreZJvq9QXUtAZLFLUmTGx4hewoUoSkZ9kDHFftpvfw6lNyUYNwo+PUB bDLleY0ySByW0FtUhGws+Am3buDsx/OqqOkVB3VlDuUbdPEK/dftGVmqrYt6dIr/wi6V T/1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=V0fmKmvd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u11si2841179ejy.598.2020.11.10.02.05.51; Tue, 10 Nov 2020 02:06:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=V0fmKmvd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730117AbgKJKD7 (ORCPT + 99 others); Tue, 10 Nov 2020 05:03:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726467AbgKJKD6 (ORCPT ); Tue, 10 Nov 2020 05:03:58 -0500 Received: from mail-qk1-x74a.google.com (mail-qk1-x74a.google.com [IPv6:2607:f8b0:4864:20::74a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C84AC0613CF for ; Tue, 10 Nov 2020 02:03:57 -0800 (PST) Received: by mail-qk1-x74a.google.com with SMTP id s128so8313538qke.0 for ; Tue, 10 Nov 2020 02:03:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:message-id:mime-version:subject:from:to:cc; bh=9+Z5Azrmhj3misriF6374XK8m6z58w8n3ugZjk4JaN4=; b=V0fmKmvdi1nl1i8calDh77i6i2t9GssMH+4a/5GfKwU6Ws+P7b6OaxTUH1UadV1ZWa jQqEKPrxcGijkoJy+1CW+h/aEBO0zXVJF0VFoAhR3DKWjrE9YaYnLGjTaY5MMtng3h+b wYWSayKXnRImU5qE5ineV9AYTAdSGn94X5jwTeohA7MzM/cGZZ9wQ5rJMZJFPaMYV857 tXFt0VGCdjLX6HN3yqJYjruKSz6UocUTuVwSNFRtxJ4ou/5AWIZQk/09q3EfeoNZcIQR 9yy+MSeUc19KQ/N8dYxbS8E1UlXhX30sjX6prp5G4uUNI0x8OuTO4TshA1s51+0TbB2f 29tQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:message-id:mime-version:subject:from :to:cc; bh=9+Z5Azrmhj3misriF6374XK8m6z58w8n3ugZjk4JaN4=; b=egO0gHh4dqPfP2rgERQTLMDi4R5Kl8a4JWzPCT/s4xXTCj8fkCjKpOp1e2sEZWR9/X 03uYfDYHErJgDIO3xZ8TC1XdXgEXIkr7mr3Onj6PXf+pQNHbppbd/HOzP5hIZfj5lCvi 4w68YxbA0SMUoDYnAq+f3LQXRn5ZQoaoNj7GHcaERdD52TIOpl2nIuknjjGSVLR4HBEw taWZdyuapJwUrLIPCYfiwfl1hqEB2MlzB9h0+gf0APy4LNiyiZYxKUeifgKAiI1LpyaO 7L0YMMtA+OWostDlKTrZ13DLPgTI72xa3D8bgO/5hImHf+UgaY7S5Ys0N4t7l+OT/lRa KqZw== X-Gm-Message-State: AOAM530tdWbLV5WT3cgAr3DlOkUNtxR1KjVnwZuMiuoILjprNDbp8uNB 15PP/AF72iImBIByMuUifMRv+Omv4OK4 Sender: "irogers via sendgmr" X-Received: from irogers.svl.corp.google.com ([2620:15c:2cd:2:f693:9fff:fef4:4583]) (user=irogers job=sendgmr) by 2002:a0c:8f09:: with SMTP id z9mr12954541qvd.3.1605002636233; Tue, 10 Nov 2020 02:03:56 -0800 (PST) Date: Tue, 10 Nov 2020 02:03:34 -0800 Message-Id: <20201110100346.2527031-1-irogers@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8-goog Subject: [RFC PATCH 00/12] Topdown parser From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-kernel@vger.kernel.org, Andi Kleen , Jin Yao , John Garry , Paul Clarke , kajoljain Cc: Stephane Eranian , Sandeep Dasgupta , linux-perf-users@vger.kernel.org, Ian Rogers Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This RFC is for a new tool that reads TMA_Metrics.csv as found on download.01.org/perfmon and generates metrics and metric groups from it. To show the functionality the TMA_Metrics.csv is downloaded, but an accepted change would most likely include a copy of this file from Intel. With this tool rather than just level 1 topdown metrics, a full set of topdown metrics to level 4 are generated. This change was: Suggested-by: Stephane Eranian Sandeep Dasgupta (12): perf topdown-parser: Add a simple logging API. perf topdown-parser: Add utility functions. perf topdown-paser: Add a CSV file reader. perf topdown-parser: Add a json file reader. perf topdown-parser: Add a configuration. perf topdown-parser: Interface for TMA_Metrics.csv. perf topdown-parser: Metric expression parser. perf topdown-parser: Add event interface. perf topdown-paser: Add code generation API. perf topdown-parser: Add json metric code generation. perf topdown-parser: Main driver. perf pmu-events: Topdown parser tool tools/perf/Makefile.perf | 13 +- tools/perf/pmu-events/Build | 50 +- tools/perf/pmu-events/topdown-parser/README | 5 + .../topdown-parser/code_gen_target.cpp | 51 + .../topdown-parser/code_gen_target.h | 77 ++ .../code_gen_target_perf_json.cpp | 546 ++++++++++ .../code_gen_target_perf_json.h | 25 + .../topdown-parser/configuration.cpp | 198 ++++ .../pmu-events/topdown-parser/configuration.h | 181 ++++ .../topdown-parser/configuration.json | 72 ++ .../pmu-events/topdown-parser/csvreader.cpp | 49 + .../pmu-events/topdown-parser/csvreader.h | 51 + .../topdown-parser/dependence_dag_utils.cpp | 984 ++++++++++++++++++ .../topdown-parser/dependence_dag_utils.h | 178 ++++ .../pmu-events/topdown-parser/event_info.cpp | 443 ++++++++ .../pmu-events/topdown-parser/event_info.h | 114 ++ .../pmu-events/topdown-parser/expr_parser.y | 224 ++++ .../topdown-parser/general_utils.cpp | 173 +++ .../pmu-events/topdown-parser/general_utils.h | 131 +++ .../pmu-events/topdown-parser/jsmn_extras.cpp | 199 ++++ .../pmu-events/topdown-parser/jsmn_extras.h | 42 + .../perf/pmu-events/topdown-parser/logging.h | 25 + .../topdown-parser/topdown_parser_main.cpp | 155 +++ 23 files changed, 3981 insertions(+), 5 deletions(-) create mode 100644 tools/perf/pmu-events/topdown-parser/README create mode 100644 tools/perf/pmu-events/topdown-parser/code_gen_target.cpp create mode 100644 tools/perf/pmu-events/topdown-parser/code_gen_target.h create mode 100644 tools/perf/pmu-events/topdown-parser/code_gen_target_perf_json.cpp create mode 100644 tools/perf/pmu-events/topdown-parser/code_gen_target_perf_json.h create mode 100644 tools/perf/pmu-events/topdown-parser/configuration.cpp create mode 100644 tools/perf/pmu-events/topdown-parser/configuration.h create mode 100644 tools/perf/pmu-events/topdown-parser/configuration.json create mode 100644 tools/perf/pmu-events/topdown-parser/csvreader.cpp create mode 100644 tools/perf/pmu-events/topdown-parser/csvreader.h create mode 100644 tools/perf/pmu-events/topdown-parser/dependence_dag_utils.cpp create mode 100644 tools/perf/pmu-events/topdown-parser/dependence_dag_utils.h create mode 100644 tools/perf/pmu-events/topdown-parser/event_info.cpp create mode 100644 tools/perf/pmu-events/topdown-parser/event_info.h create mode 100644 tools/perf/pmu-events/topdown-parser/expr_parser.y create mode 100644 tools/perf/pmu-events/topdown-parser/general_utils.cpp create mode 100644 tools/perf/pmu-events/topdown-parser/general_utils.h create mode 100644 tools/perf/pmu-events/topdown-parser/jsmn_extras.cpp create mode 100644 tools/perf/pmu-events/topdown-parser/jsmn_extras.h create mode 100644 tools/perf/pmu-events/topdown-parser/logging.h create mode 100644 tools/perf/pmu-events/topdown-parser/topdown_parser_main.cpp -- 2.29.2.222.g5d2a92d10f8-goog