Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751342AbdIPPXe (ORCPT ); Sat, 16 Sep 2017 11:23:34 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:35015 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751253AbdIPPXc (ORCPT ); Sat, 16 Sep 2017 11:23:32 -0400 X-Google-Smtp-Source: ADKCNb4+0R66y20Czqqmw85pKJVq8XGFrAQKvTr+4vhIfdxyYQtqnyrN3RudNSF2/LlWHmuZ+Sde+A== Subject: Re: [PATCH 2/3] Makes all those related functions receive the FILE pointer To: yuzhoujian , peterz@infradead.org, mingo@redhat.com, alexander.shishkin@linux.intel.com, jolsa@kernel.org, namhyung@kernel.org, yuzhoujian@didichuxing.com Cc: linux-kernel@vger.kernel.org References: <1505315433-28437-1-git-send-email-yuzhoujian@didichuxing.com> <1505315433-28437-3-git-send-email-yuzhoujian@didichuxing.com> From: David Ahern Message-ID: <3ebd97c7-2fbc-757d-f733-5edd901ccc60@gmail.com> Date: Sat, 16 Sep 2017 09:23:32 -0600 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <1505315433-28437-3-git-send-email-yuzhoujian@didichuxing.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 826 Lines: 23 On 9/13/17 9:10 AM, yuzhoujian wrote: > @@ -1621,8 +1634,12 @@ static int process_comm_event(struct perf_tool *tool, > sample->tid = event->comm.tid; > sample->pid = event->comm.pid; > } > - print_sample_start(sample, thread, evsel); > - perf_event__fprintf(event, stdout); > + if (tool->orientation_output == false) > + fp = stdout; > + else > + fp = orientation_file; > + fprint_sample_start(sample, thread, evsel, fp); > + perf_event__fprintf(event, fp); > ret = 0; > out: > thread__put(thread); The subject of this patch is replacing printf and stdout with fprintf and a given fp. Please keep it to that one change. Meaning the above setting of fp something other than stdout should be a separate patch. And it would be best to have the fp selection in a helper, versus the same change in so many places.