All of lore.kernel.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [i-g-t PATCH 3/4] flip_test: use monotonic time to measure the test duration
Date: Thu, 22 Nov 2012 15:25:05 +0200	[thread overview]
Message-ID: <1353590706-1366-4-git-send-email-imre.deak@intel.com> (raw)
In-Reply-To: <1353590706-1366-1-git-send-email-imre.deak@intel.com>

Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 tests/flip_test.c |   16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/tests/flip_test.c b/tests/flip_test.c
index e2af358..d88f81c 100644
--- a/tests/flip_test.c
+++ b/tests/flip_test.c
@@ -786,15 +786,11 @@ static unsigned int wait_for_events(struct test_output *o)
 /* Returned the ellapsed time in us */
 static unsigned event_loop(struct test_output *o, unsigned duration_sec)
 {
-	struct timeval start, end;
-	struct timeval tv_dur;
+	unsigned long start, end;
 
-	gettimeofday(&start, NULL);
-	end.tv_sec = start.tv_sec + duration_sec;
-	end.tv_usec = start.tv_usec;
+	start = gettime_us();
 
 	while (1) {
-		struct timeval now;
 		unsigned int completed_events;
 
 		completed_events = run_test_step(o);
@@ -803,19 +799,17 @@ static unsigned event_loop(struct test_output *o, unsigned duration_sec)
 		check_all_state(o, completed_events);
 		update_all_state(o, completed_events);
 
-		gettimeofday(&now, NULL);
-		if (!timercmp(&now, &end, <))
+		if ((gettime_us() - start) / 1000000 >= duration_sec)
 			break;
 	}
 
-	gettimeofday(&end, NULL);
-	timersub(&end, &start, &tv_dur);
+	end = gettime_us();
 
 	/* Flush any remaining events */
 	if (o->pending_events)
 		wait_for_events(o);
 
-	return tv_dur.tv_sec * 1000 * 1000 + tv_dur.tv_usec;
+	return end - start;
 }
 
 static void run_test_on_crtc(struct test_output *o, int crtc, int duration)
-- 
1.7.9.5

  parent reply	other threads:[~2012-11-22 13:25 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-22 13:25 [i-g-t PATCH 0/4] flip_test: support for monotonic timestamps Imre Deak
2012-11-22 13:25 ` [i-g-t PATCH 1/4] flip_test: add wf-vblank test for expired sequence Imre Deak
2012-11-22 13:25 ` [i-g-t PATCH 2/4] flip_test: skip check for last_received_ts for the first event Imre Deak
2012-11-22 13:25 ` Imre Deak [this message]
2012-11-22 13:52   ` [i-g-t PATCH 3/4] flip_test: use monotonic time to measure the test duration Daniel Vetter
2012-11-22 13:25 ` [i-g-t PATCH 4/4] flip_test: switch to using monotonic timestamps Imre Deak
2012-11-22 13:46   ` Daniel Vetter
2012-11-22 13:50     ` Imre Deak
2012-11-22 14:04       ` Daniel Vetter
2012-11-22 14:07         ` Imre Deak
2012-11-22 14:46   ` [i-g-t PATCH 4/4] flip_test: switch to using monotonic timestamps (v2) Imre Deak
2012-11-22 20:20     ` Daniel Vetter
2013-02-11 16:32   ` [PATCH] lib/scatterlist: add simple page iterator Imre Deak
2013-02-11 18:50   ` [PATCH v2] " Imre Deak
2013-02-11 20:54     ` Andrew Morton
2013-02-12 17:07       ` Imre Deak
2013-02-12 17:13         ` Tejun Heo
2013-02-13 14:51           ` Imre Deak
2013-02-12 21:28         ` Andrew Morton
2013-02-13 15:10     ` [PATCH v3 1/2] " Imre Deak
2013-02-13 15:10     ` [PATCH v3 2/2] lib/scatterlist: use page iterator in the mapping iterator Imre Deak
2013-02-21 13:58       ` [PATCH v4] " Imre Deak
2013-02-24 11:05         ` [PATCH v5] " Imre Deak
2013-02-27  2:30           ` Stephen Warren
2013-02-23  4:29       ` [PATCH v3 2/2] " Stephen Warren
2013-02-23 20:04         ` Imre Deak
2013-02-23 23:45         ` Stephen Warren

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=1353590706-1366-4-git-send-email-imre.deak@intel.com \
    --to=imre.deak@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /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.