All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Adrian Hunter <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, adrian.hunter@intel.com, mingo@kernel.org,
	linux-kernel@vger.kernel.org, tglx@linutronix.de,
	jolsa@redhat.com, hpa@zytor.com, yao.jin@linux.intel.com
Subject: [tip:perf/core] perf intel-pt: Factor out intel_pt_8b_tsc()
Date: Mon, 17 Jun 2019 12:41:00 -0700	[thread overview]
Message-ID: <tip-e72b52a2cfdea5cb0279b2d63a36d78b8c2134de@git.kernel.org> (raw)
In-Reply-To: <20190604130017.31207-6-adrian.hunter@intel.com>

Commit-ID:  e72b52a2cfdea5cb0279b2d63a36d78b8c2134de
Gitweb:     https://git.kernel.org/tip/e72b52a2cfdea5cb0279b2d63a36d78b8c2134de
Author:     Adrian Hunter <adrian.hunter@intel.com>
AuthorDate: Tue, 4 Jun 2019 16:00:03 +0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 10 Jun 2019 16:20:12 -0300

perf intel-pt: Factor out intel_pt_8b_tsc()

Factor out intel_pt_8b_tsc() so it can be reused.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/20190604130017.31207-6-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 .../perf/util/intel-pt-decoder/intel-pt-decoder.c  | 26 ++++++++++++++--------
 1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
index 13123b195083..c06dceb774e9 100644
--- a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
+++ b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
@@ -1369,6 +1369,21 @@ static int intel_pt_mode_tsx(struct intel_pt_decoder *decoder, bool *no_tip)
 	return 0;
 }
 
+static uint64_t intel_pt_8b_tsc(uint64_t timestamp, uint64_t ref_timestamp)
+{
+	timestamp |= (ref_timestamp & (0xffULL << 56));
+
+	if (timestamp < ref_timestamp) {
+		if (ref_timestamp - timestamp > (1ULL << 55))
+			timestamp += (1ULL << 56);
+	} else {
+		if (timestamp - ref_timestamp > (1ULL << 55))
+			timestamp -= (1ULL << 56);
+	}
+
+	return timestamp;
+}
+
 static void intel_pt_calc_tsc_timestamp(struct intel_pt_decoder *decoder)
 {
 	uint64_t timestamp;
@@ -1376,15 +1391,8 @@ static void intel_pt_calc_tsc_timestamp(struct intel_pt_decoder *decoder)
 	decoder->have_tma = false;
 
 	if (decoder->ref_timestamp) {
-		timestamp = decoder->packet.payload |
-			    (decoder->ref_timestamp & (0xffULL << 56));
-		if (timestamp < decoder->ref_timestamp) {
-			if (decoder->ref_timestamp - timestamp > (1ULL << 55))
-				timestamp += (1ULL << 56);
-		} else {
-			if (timestamp - decoder->ref_timestamp > (1ULL << 55))
-				timestamp -= (1ULL << 56);
-		}
+		timestamp = intel_pt_8b_tsc(decoder->packet.payload,
+					    decoder->ref_timestamp);
 		decoder->tsc_timestamp = timestamp;
 		decoder->timestamp = timestamp;
 		decoder->ref_timestamp = 0;

  reply	other threads:[~2019-06-17 19:41 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-04 12:59 [PATCH 00/19] perf intel-pt: Add support for efficient time interval filtering Adrian Hunter
2019-06-04 12:59 ` [PATCH 01/19] perf auxtrace: Add perf time interval to itrace_synth_ops Adrian Hunter
2019-06-17 19:38   ` [tip:perf/core] " tip-bot for Adrian Hunter
2019-06-04 13:00 ` [PATCH 02/19] perf script: Set perf time interval in itrace_synth_ops Adrian Hunter
2019-06-17 19:38   ` [tip:perf/core] " tip-bot for Adrian Hunter
2019-06-04 13:00 ` [PATCH 03/19] perf report: " Adrian Hunter
2019-06-17 19:39   ` [tip:perf/core] " tip-bot for Adrian Hunter
2019-06-04 13:00 ` [PATCH 04/19] perf intel-pt: Add lookahead callback Adrian Hunter
2019-06-17 19:40   ` [tip:perf/core] " tip-bot for Adrian Hunter
2019-06-04 13:00 ` [PATCH 05/19] perf intel-pt: Factor out intel_pt_8b_tsc() Adrian Hunter
2019-06-17 19:41   ` tip-bot for Adrian Hunter [this message]
2019-06-04 13:00 ` [PATCH 06/19] perf intel-pt: Factor out intel_pt_reposition() Adrian Hunter
2019-06-17 19:41   ` [tip:perf/core] " tip-bot for Adrian Hunter
2019-06-04 13:00 ` [PATCH 07/19] perf intel-pt: Add reposition parameter to intel_pt_get_data() Adrian Hunter
2019-06-17 19:42   ` [tip:perf/core] " tip-bot for Adrian Hunter
2019-06-04 13:00 ` [PATCH 08/19] perf intel-pt: Add intel_pt_fast_forward() Adrian Hunter
2019-06-17 19:43   ` [tip:perf/core] " tip-bot for Adrian Hunter
2019-06-04 13:00 ` [PATCH 09/19] perf intel-pt: Factor out intel_pt_get_buffer() Adrian Hunter
2019-06-17 19:43   ` [tip:perf/core] " tip-bot for Adrian Hunter
2019-06-04 13:00 ` [PATCH 10/19] perf intel-pt: Add support for lookahead Adrian Hunter
2019-06-17 19:44   ` [tip:perf/core] " tip-bot for Adrian Hunter
2019-06-04 13:00 ` [PATCH 11/19] perf intel-pt: Add support for efficient time interval filtering Adrian Hunter
2019-06-17 19:45   ` [tip:perf/core] " tip-bot for Adrian Hunter
2019-06-04 13:00 ` [PATCH 12/19] perf time-utils: Treat time ranges consistently Adrian Hunter
2019-06-17 19:45   ` [tip:perf/core] " tip-bot for Adrian Hunter
2019-06-04 13:00 ` [PATCH 13/19] perf time-utils: Factor out set_percent_time() Adrian Hunter
2019-06-17 19:46   ` [tip:perf/core] " tip-bot for Adrian Hunter
2019-06-04 13:00 ` [PATCH 14/19] perf time-utils: Prevent percentage time range overlap Adrian Hunter
2019-06-17 19:47   ` [tip:perf/core] " tip-bot for Adrian Hunter
2019-06-04 13:00 ` [PATCH 15/19] perf time-utils: Fix --time documentation Adrian Hunter
2019-06-17 19:47   ` [tip:perf/core] " tip-bot for Adrian Hunter
2019-06-04 13:00 ` [PATCH 16/19] perf time-utils: Simplify perf_time__parse_for_ranges() error paths slightly Adrian Hunter
2019-06-17 19:48   ` [tip:perf/core] " tip-bot for Adrian Hunter
2019-06-04 13:00 ` [PATCH 17/19] perf time-utils: Make perf_time__parse_for_ranges() more logical Adrian Hunter
2019-06-17 19:49   ` [tip:perf/core] " tip-bot for Adrian Hunter
2019-06-04 13:00 ` [PATCH 18/19] perf tests: Add a test for time-utils Adrian Hunter
2019-06-17 19:50   ` [tip:perf/core] " tip-bot for Adrian Hunter
2019-06-04 13:00 ` [PATCH 19/19] perf time-utils: Add support for multiple explicit time intervals Adrian Hunter
2019-06-17 19:50   ` [tip:perf/core] " tip-bot for Adrian Hunter
2019-06-07 19:49 ` [PATCH 00/19] perf intel-pt: Add support for efficient time interval filtering Arnaldo Carvalho de Melo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-e72b52a2cfdea5cb0279b2d63a36d78b8c2134de@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=acme@redhat.com \
    --cc=adrian.hunter@intel.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=yao.jin@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.