Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1153502pxb; Tue, 26 Oct 2021 03:55:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyb5bQEYViZumKgzNhy38MH3HmeYpsClQM/7DvWGsNOJ7q7FZyTIpr83/9Znt/o+XQ9o1FA X-Received: by 2002:a17:90b:17d2:: with SMTP id me18mr27091686pjb.98.1635245740808; Tue, 26 Oct 2021 03:55:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635245740; cv=none; d=google.com; s=arc-20160816; b=bIUyCjDZQDQSX76nGnQUAIiecrDugBOXYaF5dtmdUQtqmIcQWuAWnh/VCaDFlW84M7 JltU7eypHDfWMp6z2BQj5Vzp4OFqBh0tXsYSnSN9IJOvKYHbpLlWmiuywxgjWS0nKe1y OEcQsDObDwUpTBolDd3YPFxdgmBZwzqkgEOA9Q2D/NiA8sPYVxm/gF9nIKv8r9iSc/Cb dlizQnvHyuZ4+EFWVwch6cqu5T+XZhRF3GrRy7cCJ5MBO3d2jzbpWcfaHkyKR5FVY6hj g4pKe+R1GTGco/zQ9DOIYux5gDuFgePMPUIXEbco6VzTEjamXdRWwWstzVKUvulTVaQr M6sQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:organization :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=fE07tgkkHMNQ2bDtGejGlXHTWhv6ek9Y2AsOStYPigs=; b=w+7IAnis85TYDJxCZF39sekY9KaezTu+3I4pSpoRr8U9YiEplT39At14GvtalAI307 YDM5UWAOPKi9rp7eqRLSun7shhLlO5blY8ITTBMw5kshHJbduFCm9wy0VaogJSyvxiiO FFi8wRfv1iz2fgN476Wd04md70ibn7bkPMexRUXF4wFmykkZ5/dfMcTH8/eRpc3vOKls J2FRGJoRIGJAnsmQ0qnOIRpHsugWCxsWIZ9T8Pd/7lQ5R5IMn5HATqIghuVt1jST8giv txymzhfwryRAxUmo9ezqn6eAedBjROPV2JwN5XTcfqgRpD7vVcA43wEocpIX+pnlQ5Xa 2FcQ== ARC-Authentication-Results: i=1; mx.google.com; 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id oo7si408499pjb.59.2021.10.26.03.55.26; Tue, 26 Oct 2021 03:55:40 -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; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234772AbhJZJEd (ORCPT + 99 others); Tue, 26 Oct 2021 05:04:33 -0400 Received: from mga17.intel.com ([192.55.52.151]:37214 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234713AbhJZJE3 (ORCPT ); Tue, 26 Oct 2021 05:04:29 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10148"; a="210639834" X-IronPort-AV: E=Sophos;i="5.87,182,1631602800"; d="scan'208";a="210639834" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Oct 2021 02:02:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,182,1631602800"; d="scan'208";a="723991278" Received: from ahunter-desktop.fi.intel.com ([10.237.72.76]) by fmsmga005.fm.intel.com with ESMTP; 26 Oct 2021 02:02:04 -0700 From: Adrian Hunter To: Arnaldo Carvalho de Melo Cc: Jiri Olsa , Andi Kleen , linux-kernel@vger.kernel.org Subject: [PATCH V2 6/6] perf intel-pt: Support itrace d+o option to direct debug log to stdout Date: Tue, 26 Oct 2021 12:01:52 +0300 Message-Id: <20211026090152.357591-7-adrian.hunter@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211026090152.357591-1-adrian.hunter@intel.com> References: <20211026090152.357591-1-adrian.hunter@intel.com> MIME-Version: 1.0 Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It can be useful to see debug output in between normal output. Add support for AUXTRACE_LOG_FLG_USE_STDOUT to Intel PT. Signed-off-by: Adrian Hunter --- tools/perf/Documentation/perf-intel-pt.txt | 1 + tools/perf/util/intel-pt-decoder/intel-pt-log.c | 8 ++++---- tools/perf/util/intel-pt.c | 5 +++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/tools/perf/Documentation/perf-intel-pt.txt b/tools/perf/Documentation/perf-intel-pt.txt index 81dd27be3d09..b94dca105ebd 100644 --- a/tools/perf/Documentation/perf-intel-pt.txt +++ b/tools/perf/Documentation/perf-intel-pt.txt @@ -948,6 +948,7 @@ by flags which affect what debug messages will or will not be logged. Each flag must be preceded by either '+' or '-'. The flags support by Intel PT are: -a Suppress logging of perf events +a Log all perf events + +o Output to stdout instead of "intel_pt.log" By default, logged perf events are filtered by any specified time ranges, but flag +a overrides that. diff --git a/tools/perf/util/intel-pt-decoder/intel-pt-log.c b/tools/perf/util/intel-pt-decoder/intel-pt-log.c index 09feb5b07d32..5f5dfc8753f3 100644 --- a/tools/perf/util/intel-pt-decoder/intel-pt-log.c +++ b/tools/perf/util/intel-pt-decoder/intel-pt-log.c @@ -82,10 +82,10 @@ static int intel_pt_log_open(void) if (f) return 0; - if (!log_name[0]) - return -1; - - f = fopen(log_name, "w+"); + if (log_name[0]) + f = fopen(log_name, "w+"); + else + f = stdout; if (!f) { intel_pt_enable_logging = false; return -1; diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c index 57e49b23ad25..793bac850268 100644 --- a/tools/perf/util/intel-pt.c +++ b/tools/perf/util/intel-pt.c @@ -3659,8 +3659,6 @@ int intel_pt_process_auxtrace_info(union perf_event *event, if (err) goto err_free; - intel_pt_log_set_name(INTEL_PT_PMU_NAME); - if (session->itrace_synth_opts->set) { pt->synth_opts = *session->itrace_synth_opts; } else { @@ -3675,6 +3673,9 @@ int intel_pt_process_auxtrace_info(union perf_event *event, pt->synth_opts.thread_stack = opts->thread_stack; } + if (!(pt->synth_opts.log_plus_flags & AUXTRACE_LOG_FLG_USE_STDOUT)) + intel_pt_log_set_name(INTEL_PT_PMU_NAME); + pt->session = session; pt->machine = &session->machines.host; /* No kvm support */ pt->auxtrace_type = auxtrace_info->type; -- 2.25.1