Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4260633pxf; Tue, 6 Apr 2021 11:44:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwF75Bb+DhwK2G+toefVANl88fx6kzlIUB5+IoOAJF8vV+DtYrlVAGYu4UOi+YDGnE8rZvx X-Received: by 2002:a17:906:148a:: with SMTP id x10mr22116839ejc.92.1617734693030; Tue, 06 Apr 2021 11:44:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617734693; cv=none; d=google.com; s=arc-20160816; b=1JGnjzTpEj6bx5+X3FAxdBVgz6A/8iz7L7k9TGMIczksNbGUh4S3W+VEbzSv2EOhuK ZhoZb26Ab4Me1rX/Zz3clCPP7TfkPrNYmEH55/8fRn9DWbvhXmhAH3eQSgwoPmnyfVix mMSlh51Q7WCI+xELer/7SqyhU5XXC+iM7Vf6LAMfN3jeXYQgyi42OKpk7fypBWmWUku7 bq7ljKBMbb/sbTiC2J0Fx3luYIPd6QdDtQiKHn2m36nIAVP/twqZg/Xjbwzbq9hQepV1 MBQ9AXHevUwhQUWoJsSHh5bfo7RaY+PbtbVVvT5KfHVRCI34dcF6flWrChLA3KaUjPKy i37Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=5FkcxajTibeYdrCIX51k3meJRElahfxK2YPLhmX0I1c=; b=RtnSFvGRCkuwi+flw8zNrLKWWesauR/JJhkQTbEFrM4XdU6s0W7lkOuKA/ivL9ZvK7 wDAORtsRWIjpEeD0rVqZI+bHMCOXVVBnFBR13kbCdyw1juPDxgAOdru5ZQ/WeUQonlgE rppAWHoDP6ZTBXPJg8Ybs8Zl7ZGwfMypqe6TyZCx/0odGkKIJFj960YsMKT8uZp1I6Pf 1D46UIpzh5NFogpyHm0bj8lyRFkRFIBbIhaoKmWoTLnVzIKEG1GfHXh5zsKX385sxl2b Sp4PgF69XwrNBYTShmGugiv4K0XpSB96C/h010JyKAnGosgjFoFVgAFk5GE+uQgYhEv2 mW8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@codeweavers.com header.s=6377696661 header.b=gmdRsi5f; 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=fail (p=NONE sp=NONE dis=NONE) header.from=codeweavers.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i10si16605925edc.63.2021.04.06.11.44.29; Tue, 06 Apr 2021 11:44:53 -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=fail (test mode) header.i=@codeweavers.com header.s=6377696661 header.b=gmdRsi5f; 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=fail (p=NONE sp=NONE dis=NONE) header.from=codeweavers.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235663AbhDFJcD (ORCPT + 99 others); Tue, 6 Apr 2021 05:32:03 -0400 Received: from mail.codeweavers.com ([50.203.203.244]:50604 "EHLO mail.codeweavers.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231701AbhDFJcC (ORCPT ); Tue, 6 Apr 2021 05:32:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=codeweavers.com; s=6377696661; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=5FkcxajTibeYdrCIX51k3meJRElahfxK2YPLhmX0I1c=; b=gmdRsi5f7JMJKFwJ+1YhLU0mvt 9E4WpZ2lQyLMWLK1YZ4nbgFn4Qv0c/n2CjsDB87410om8vgGJdLy7RqJOMklH46TnGYvA1k49U83D xCG0fG7PtUX5UBGAlTLttKLhkw0nkH6CdwoBFTfr8mA6npBz/MIfIufgllDdYC0grlFI=; Received: from 198-48-224-11.cpe.pppoe.ca ([198.48.224.11] helo=[192.168.1.180]) by mail.codeweavers.com with esmtpsa (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lTi3t-00053P-EA; Tue, 06 Apr 2021 04:31:53 -0500 Subject: Re: [PATCH] perf data: Add JSON export To: Jiri Olsa Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Namhyung Kim , Ian Rogers , Kan Liang , Stephane Eranian , Tan Xiaojun , Jin Yao , linux-kernel@vger.kernel.org References: From: Nicholas Fraser Message-ID: <0831d8ee-12d5-dd28-dde4-a46e4781a76f@codeweavers.com> Date: Tue, 6 Apr 2021 05:31:51 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jiri, Thanks again for the review. I've fixed the issues you mentioned. Some notes below: On 2021-04-01 8:15 a.m., Jiri Olsa wrote: > I recall you did not add support for walltime clock, > don't you need it to sync with other events? Not necessarily. As long as the perf recording and the GPU trace are made from the same clock, the events should line up; the real time doesn't matter. I've added it anyway though since it's good to have. It now outputs "clockid", "clock-time" and "real-time" in the headers if clock info was included in the recording. On 2021-04-01 9:18 a.m., Jiri Olsa wrote: > also I will not push hard for test, becase we don't have any for CTF ;-) > but if you could think of any, that'd be great I'm not sure what kind of tests would be useful. We could include a small perf.data file and its JSON output and verify that they match. This is probably pointless because almost any change to the JSON code would be expected to change the output so we'd just be resetting the test on each change. > I was wondering how to make this \t mess more readable, > how about you define function like output_json: > > output_json(FILE, level, field, format, ...); > > and use it: > > output_json(c->out, 3, "data-offset", "PRIu64", header->data_offset); > output_json(c->out, 3, "data-size", "PRIu64", header->data_size); > output_json(c->out, 3, "feat-offset", PRIu64, header->feat_offset); > > similar way as we do for pr_debug -> eprintf I've cleaned up the output with some additional helper functions. This is essentially turning into its own mini JSON encoder which I was hoping to avoid but I suppose it's necessary to make the code maintainable. I'll be sending a new patch shortly. Nick