From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752203AbbD3Olr (ORCPT ); Thu, 30 Apr 2015 10:41:47 -0400 Received: from mga11.intel.com ([192.55.52.93]:52334 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752140AbbD3OlC (ORCPT ); Thu, 30 Apr 2015 10:41:02 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,677,1422950400"; d="scan'208";a="718478427" From: Adrian Hunter To: Arnaldo Carvalho de Melo Cc: Peter Zijlstra , linux-kernel@vger.kernel.org, David Ahern , Frederic Weisbecker , Jiri Olsa , Namhyung Kim , Stephane Eranian Subject: [PATCH V4 22/24] perf tools: Intel BTS to always update thread stack trace number Date: Thu, 30 Apr 2015 17:37:45 +0300 Message-Id: <1430404667-10593-23-git-send-email-adrian.hunter@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1430404667-10593-1-git-send-email-adrian.hunter@intel.com> References: <1430404667-10593-1-git-send-email-adrian.hunter@intel.com> Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The enhanced thread stack is used by higher layers but still requires the trace number. The trace number is used to distinguish discontinuous sections of trace (for example from Snapshot mode or Sample mode), which cause the thread stack to be flushed. Signed-off-by: Adrian Hunter --- tools/perf/util/intel-bts.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/tools/perf/util/intel-bts.c b/tools/perf/util/intel-bts.c index fe777c1..1c9d5d4 100644 --- a/tools/perf/util/intel-bts.c +++ b/tools/perf/util/intel-bts.c @@ -27,6 +27,8 @@ #include "machine.h" #include "session.h" #include "util.h" +#include "thread.h" +#include "thread-stack.h" #include "debug.h" #include "tsc.h" #include "auxtrace.h" @@ -441,19 +443,22 @@ static int intel_bts_process_buffer(struct intel_bts_queue *btsq, static int intel_bts_process_queue(struct intel_bts_queue *btsq, u64 *timestamp) { - struct auxtrace_buffer *buffer = btsq->buffer; + struct auxtrace_buffer *buffer = btsq->buffer, *old_buffer = buffer; struct auxtrace_queue *queue; + struct thread *thread; int err; if (btsq->done) return 1; if (btsq->pid == -1) { - struct thread *thread; - - thread = machine__find_thread(btsq->bts->machine, -1, btsq->tid); + thread = machine__find_thread(btsq->bts->machine, -1, + btsq->tid); if (thread) btsq->pid = thread->pid_; + } else { + thread = machine__findnew_thread(btsq->bts->machine, btsq->pid, + btsq->tid); } queue = &btsq->bts->queues.queue_array[btsq->queue_nr]; @@ -483,6 +488,11 @@ static int intel_bts_process_queue(struct intel_bts_queue *btsq, u64 *timestamp) intel_bts_do_fix_overlap(queue, buffer)) return -ENOMEM; + if (!btsq->bts->synth_opts.callchain && thread && + (!old_buffer || btsq->bts->sampling_mode || + (btsq->bts->snapshot_mode && !buffer->consecutive))) + thread_stack__set_trace_nr(thread, buffer->buffer_nr + 1); + err = intel_bts_process_buffer(btsq, buffer); auxtrace_buffer__drop_data(buffer); -- 1.9.1