Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp78015pxa; Wed, 26 Aug 2020 05:21:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfsdPXcRcTgmEkwVSyU338dK0CsZNvIX+2fikiYjq4QDew0YUYu821SQewCo2Ijjn+I0o/ X-Received: by 2002:a17:906:2352:: with SMTP id m18mr15994522eja.214.1598444501036; Wed, 26 Aug 2020 05:21:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598444501; cv=none; d=google.com; s=arc-20160816; b=UUu4iCehpLfQ6i5mDhHAxzlDypC3ArMefcx5wnSCfrxjgWNfiF29Eab28qphNuMobq AlYamtNYYHFrD6g0IDtt9T+1MmE5FMtpr2CW+Vckv5mJR3b1VoH0jl1s2oJUiEuDfBYY 4KrYlEPN8vtol5UZ1OR8LTcpfIvDXSkWr4xa2NZ7+vHW3XxsUA4UKgaqRO1cyQ0bghMd BTCdYwbcRXw/tKJYbxcOqj3S8npiVX2LFjQKNeLgCRCFvOSlYU+INuGZ4yCM0BiqooLA NROxf4J8jyFIQq1jgWO2powSGVoc6pWzxEoUcYB0FsGmX3aI51zy+wMSon2mKle8AEqN GkCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=xrlSE8I/COK0D2YzSZC8jDllNcYvqK1EXk4ZYuX00Vc=; b=0+oaywLo3K8xT+gwORNFUbKsO9cghb4hp7eJvDLpRxIluukL4gG48x6opWEB8lQTMI fi0c8IfufnEBjaxKbldd5Pfbzqy/TYQ9smed1q/Xfknxuw5I4mxix6r0zBMC3j5rtAKM Hf/22HWwP1or9g8Fq35X87e0tQsc0SeGVFlz3YPLlcLi1/ZTfFi4L3gO0pke4uXEEf0j F5TSOzaPT0IsEVmcFFE5MGqFRjNVX2rPYKFpVlmWaUxF00vEf9OKD/lBkuq3/felazuH WmnuI9HAuFiiDYyLpZeOF9PafQctQmeKIIs6w6B57ApyN/TFH0xDPYdtNTynOOC/LhIL /vjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="qNsS4/2c"; 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=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l6si1308692edn.312.2020.08.26.05.21.16; Wed, 26 Aug 2020 05:21:41 -0700 (PDT) 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=@ibm.com header.s=pp1 header.b="qNsS4/2c"; 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=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729422AbgHZMRh (ORCPT + 99 others); Wed, 26 Aug 2020 08:17:37 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:20456 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729204AbgHZMRg (ORCPT ); Wed, 26 Aug 2020 08:17:36 -0400 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 07QB3ICa112291; Wed, 26 Aug 2020 07:24:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=xrlSE8I/COK0D2YzSZC8jDllNcYvqK1EXk4ZYuX00Vc=; b=qNsS4/2cUIv7fdcRD+PNW6bA372jfherwSW8p81CQVuSUioZQ9FBt1PmMu/L9C5/mMCG ypyXIeyfgymqHIqEHLShjGjuaSg1KQG2Ap7178CX5wE1hy5LovgLH78GUFl/c+3D3Xtp f2jrUCkQVG9iAC21nKbf1R2YEiq0po3xbdVbl0kxhpuHypK1c7hmEyWWB7S4eMuIZLkc Q35N45m/S8E0fncu31ev3cq/EFjkYvlhTX0mDLfcz0Dwy+/oisdbX2Rko/YA+6FuA8qY kmHqF6wlSkOPBOnzZgrkn0dSYXx3AiCR8iIQ8l+XGOPBos9aYIAlxY2h/CHd8oQNva8n 4A== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 335pfn8psp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Aug 2020 07:24:53 -0400 Received: from m0098409.ppops.net (m0098409.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 07QB6Y5I124743; Wed, 26 Aug 2020 07:24:53 -0400 Received: from ppma01wdc.us.ibm.com (fd.55.37a9.ip4.static.sl-reverse.com [169.55.85.253]) by mx0a-001b2d01.pphosted.com with ESMTP id 335pfn8ps8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Aug 2020 07:24:53 -0400 Received: from pps.filterd (ppma01wdc.us.ibm.com [127.0.0.1]) by ppma01wdc.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 07QBN2lt022536; Wed, 26 Aug 2020 11:24:52 GMT Received: from b01cxnp22035.gho.pok.ibm.com (b01cxnp22035.gho.pok.ibm.com [9.57.198.25]) by ppma01wdc.us.ibm.com with ESMTP id 332uwah973-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Aug 2020 11:24:52 +0000 Received: from b01ledav005.gho.pok.ibm.com (b01ledav005.gho.pok.ibm.com [9.57.199.110]) by b01cxnp22035.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 07QBOptV45023642 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 26 Aug 2020 11:24:51 GMT Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B8D24AE060; Wed, 26 Aug 2020 11:24:51 +0000 (GMT) Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 45C32AE05C; Wed, 26 Aug 2020 11:24:48 +0000 (GMT) Received: from localhost.localdomain (unknown [9.199.43.94]) by b01ledav005.gho.pok.ibm.com (Postfix) with ESMTP; Wed, 26 Aug 2020 11:24:47 +0000 (GMT) Subject: Re: [RFC] perf/jevents: Add new structure to pass json fields. To: Jiri Olsa , John Garry Cc: acme@kernel.org, ak@linux.intel.com, yao.jin@linux.intel.com, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, irogers@google.com, maddy@linux.ibm.com, ravi.bangoria@linux.ibm.com References: <20200825074041.378520-1-kjain@linux.ibm.com> <20200826110046.GF703542@krava> From: kajoljain Message-ID: <5d91b929-cffd-265a-dd0c-f63bc3d1565d@linux.ibm.com> Date: Wed, 26 Aug 2020 16:54:46 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <20200826110046.GF703542@krava> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.687 definitions=2020-08-26_08:2020-08-26,2020-08-26 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 clxscore=1015 impostorscore=0 mlxlogscore=999 lowpriorityscore=0 priorityscore=1501 mlxscore=0 malwarescore=0 adultscore=0 bulkscore=0 phishscore=0 suspectscore=2 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2008260089 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/26/20 4:30 PM, Jiri Olsa wrote: > On Tue, Aug 25, 2020 at 09:14:11AM +0100, John Garry wrote: > > SNIP > >>> goto free_strings; >>> } >>> - err = func(data, name, real_event(name, event), desc, long_desc, >>> - pmu, unit, perpkg, metric_expr, metric_name, >>> - metric_group, deprecated, metric_constraint); >>> + je->event = real_event(je->name, je->event); >>> + err = func(data, je); >>> free_strings: >>> - free(event); >>> - free(desc); >>> - free(name); >>> - free(long_desc); >>> free(extra_desc); >>> - free(pmu); >>> free(filter); >>> - free(perpkg); >>> - free(deprecated); >>> - free(unit); >>> - free(metric_expr); >>> - free(metric_name); >>> - free(metric_group); >>> - free(metric_constraint); >>> free(arch_std); >>> + free(je); >>> if (err) >>> break; >>> diff --git a/tools/perf/pmu-events/jevents.h b/tools/perf/pmu-events/jevents.h >>> index 2afc8304529e..e696edf70e9a 100644 >>> --- a/tools/perf/pmu-events/jevents.h >>> +++ b/tools/perf/pmu-events/jevents.h >> >> Somewhat unrelated - this file only seems to be included in jevents.c, so I >> don't see why it exists... > > ah right.. I won't mind getting rid of it Hi John and Jiri Thanks for reviewing the patch. I can remove this file and add these structure inside jevents.c Thanks, Kajol Jain > >>> @@ -2,14 +2,28 @@ >>> #ifndef JEVENTS_H >>> #define JEVENTS_H 1 >>> +#include "pmu-events.h" >>> + >>> +struct json_event { >>> + char *name; >>> + char *event; >>> + char *desc; >>> + char *topic; >>> + char *long_desc; >>> + char *pmu; >>> + char *unit; >>> + char *perpkg; >>> + char *metric_expr; >>> + char *metric_name; >>> + char *metric_group; >>> + char *deprecated; >>> + char *metric_constraint; >> >> This looks very much like struct event_struct, so could look to consolidate: >> >> struct event_struct { >> struct list_head list; >> char *name; >> char *event; >> char *desc; >> char *long_desc; >> char *pmu; >> char *unit; >> char *perpkg; >> char *metric_expr; >> char *metric_name; >> char *metric_group; >> char *deprecated; >> char *metric_constraint; >> }; > > as Andi said they come from different layers, I think it's > better to keep them separated even if they share some fields > > thanks, > jirka >