Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp4468147pxy; Tue, 27 Apr 2021 05:56:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzP76bNfelY8Y6HzITOwXuL9teL2U8HB0nU/kZIA6AT5sLZfjH01ywdSm1OHCyCCgFYPqPk X-Received: by 2002:a17:907:e88:: with SMTP id ho8mr22845604ejc.473.1619528191053; Tue, 27 Apr 2021 05:56:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619528191; cv=none; d=google.com; s=arc-20160816; b=NS5QplB4po56Ww1fhLuPJNQw5ke4vff/2wgjqCzp8njqvDEavzq9yyEK5r4y8R4lIa F4kCZKdgEt6vOb9zRzO5lEKpvqxFCjAs9bJwmZRs+EksDTtVZjgUHWifgvAjAbkzVq6g hPD7wt1w8mTa9HTk6lPKKPPqxPTOix5w1lUrVLKNKlzgcdn7hiYW4ihPT5x/kUhBXDW6 N+Zz/aOhMk5TxuQkd6apktNV8jQHIO4XrnC3U4dW67CzL43FEQW2UNTGVnd40jQXGcQX v5hjT3Yb7J+/fO0GmwptDSXkXSnA1Ojv1NKP3SaT0+2e/FTVqpVQgUTShV28YUSwAb9X HLHQ== 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:cc:to:from:date:dkim-signature; bh=avrD+32acikZPWwF+S5hSTXBV36ITyV0GY4gC1geNu8=; b=GgOsmZdlgIDpTRA4LN3Mz9OIBrCkGRrfkjDGhKYJh+bN9sdreR7s99Yx+VqExNaI0W FqqKuR3V0ZoXY9DIRqMfkpAWZPqZdCUnSPaL0O+p4VsVZP28PoLg3sMIjRnWCZC/tHsr yMSXCYBjkxVtYUlTUJGm9ct7vBDoK/GKe41453lqaWqDLUHiZwRmzwn35y5lfcpXYO0e AhnMFJRpdRhCk4xDua/FwUQWvbx+ouZ7eG87VxZjVKrUh6YcNPB6lLyrx0vm/oGogWdV 1Khfio4Eb3/lt7wybHChGVRcXSw1Va38qAlyDGyZc7sgIBXc8aYxt6hQn94wEGziSbmq SHQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Dcww0GN7; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id sa7si4572585ejb.243.2021.04.27.05.56.04; Tue, 27 Apr 2021 05:56:31 -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=@kernel.org header.s=k20201202 header.b=Dcww0GN7; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235795AbhD0Myn (ORCPT + 99 others); Tue, 27 Apr 2021 08:54:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:35348 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235426AbhD0Mym (ORCPT ); Tue, 27 Apr 2021 08:54:42 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6C623610A5; Tue, 27 Apr 2021 12:53:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619528039; bh=0wPMFSzfumuWdxhjKufVDIU2f/5A7naNmjXmYtbwGwA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Dcww0GN7G8SfGSNjBYdpLUl5wDXxrkOz3Hy+oN49P5JKEJtiZvf3LhbE0nx5mieL1 PqIZVl9RzMaOpEmoQyr69SWwhPw5nXOASfA6AiwChsIp1DacWRZWnq40LfQzQoFFT6 tIht2Itr4jTUsLxjjaznMsIIM1pmGhK98ujbXSogeuJUm+93Poa9VFI8YlWZSKtF68 z8U1/zKur20q/1uQq+gf3Kt9mnDredMc7Vf5Aw6VEJ7f9r66I5L7ZeEfxlyajYaLmA v7T9fbcqwI0vG2K2ahLxZ5yBymvDEakdzi5m7hSWwbsx2tK6eWv4KbbWOPUclNfXTZ F6oaWxjT5f5Yw== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 0A94640647; Tue, 27 Apr 2021 09:53:56 -0300 (-03) Date: Tue, 27 Apr 2021 09:53:55 -0300 From: Arnaldo Carvalho de Melo To: Nicholas Fraser Cc: Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Changbin Du , Kan Liang , Tan Xiaojun , Jin Yao , linux-kernel@vger.kernel.org, Ulrich Czekalla Subject: Re: [PATCH v2] perf data: Add JSON export Message-ID: References: <3884969f-804d-2f53-c648-e2b0bd85edff@codeweavers.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Url: http://acmel.wordpress.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Mon, Apr 26, 2021 at 06:24:29PM -0300, Arnaldo Carvalho de Melo escreveu: > Em Mon, Apr 26, 2021 at 05:25:58PM -0300, Arnaldo Carvalho de Melo escreveu: > > Em Mon, Apr 26, 2021 at 10:47:16AM -0400, Nicholas Fraser escreveu: > > > This adds a feature to export perf data to JSON. > > > > > > The resolved symbols are exported into the JSON so that external tools > > > don't need to load the dsos themselves (or even have access to them at > > > all.) This makes it easy to load and analyze perf data with standalone > > > tools where direct perf or libbabeltrace integration is impractical. > > > > > > The exporter uses a minimal inline JSON encoding without any external > > > dependencies. Currently it only outputs some headers and sample metadata > > > but it's easily extensible. > > > > > > Use it like this: > > > > > > perf data convert --to-json out.json > > One more, clang complains: > > 7 50.92 alpine:3.10 : FAIL gcc version 8.3.0 (Alpine 8.3.0) > util/data-convert-json.c:126:32: error: address of array 'al->sym->name' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion] > if (al && al->sym && al->sym->name && strlen(al->sym->name) > 0) { > ~~ ~~~~~~~~~^~~~ > 1 error generated. > make[3]: *** [/git/perf-5.12.0/tools/build/Makefile.build:139: util] Error 2 So the fix is the one below, applied and tested, thanks. - Arnaldo diff --git a/tools/perf/util/data-convert-json.c b/tools/perf/util/data-convert-json.c index f24593d57f80be1b..355cd1948bdf006a 100644 --- a/tools/perf/util/data-convert-json.c +++ b/tools/perf/util/data-convert-json.c @@ -123,7 +123,7 @@ static void output_sample_callchain_entry(struct perf_tool *tool, output_json_format(out, false, 4, "{"); output_json_key_format(out, false, 5, "ip", "\"0x%" PRIx64 "\"", ip); - if (al && al->sym && al->sym->name && strlen(al->sym->name) > 0) { + if (al && al->sym && al->sym->namelen) { fputc(',', out); output_json_key_string(out, false, 5, "symbol", al->sym->name);