From: Dave Gordon <david.s.gordon@intel.com>
To: ankitprasad.r.sharma@intel.com, intel-gfx@lists.freedesktop.org
Cc: akash.goel@intel.com, shashidhar.hiremath@intel.com
Subject: Re: [PATCH 2/3] igt/gem_pread: Support to verify pread/pwrite for non-shmem backed obj
Date: Mon, 06 Jul 2015 15:33:46 +0100 [thread overview]
Message-ID: <559A91CA.7010802@intel.com> (raw)
In-Reply-To: <559657D1.4060106@linux.intel.com>
On 03/07/15 10:37, Tvrtko Ursulin wrote:
>
>
> On 07/01/2015 10:26 AM, ankitprasad.r.sharma@intel.com wrote:
>> From: Ankitprasad Sharma <ankitprasad.r.sharma@intel.com>
>>
>> This patch adds support to verify pread/pwrite for non-shmem backed
>> objects. It also shows the pread/pwrite speed.
>> It also tests speeds for pread with and without user side page faults
>>
>> v2: Rebased to the latest (Ankit)
>>
>> Signed-off-by: Ankitprasad Sharma <ankitprasad.r.sharma at intel.com>
>> ---
>> tests/gem_pread.c | 100
>> +++++++++++++++++++++++++++++++++++++++++++++++++++++
>> tests/gem_pwrite.c | 45 ++++++++++++++++++++++++
>> 2 files changed, 145 insertions(+)
[snip]
>> @@ -142,9 +154,97 @@ int main(int argc, char **argv)
>> }
>> }
>>
>> + igt_subtest("stolen-normal") {
>> + for (count = 1; count <= 1<<17; count <<= 1) {
>> + struct timeval start, end;
>> +
>> + gettimeofday(&start, NULL);
>> + do_gem_read(fd, src_stolen, dst_user, object_size, count);
>> + gettimeofday(&end, NULL);
>> + igt_info("Time to pread %d bytes x %6d: %7.3fµs, %s\n",
>> + object_size, count,
>> + elapsed(&start, &end, count),
>> + bytes_per_sec((char *)buf,
>> + object_size/elapsed(&start, &end, count)*1e6));
>
> There is no checking that bytes_per_sec won't overflow buf. Which is
> also declared as unit32_t just so we can cast here. :) Suggest fixing if
> you feel like it, won't mandate it since it is existing code.
That printf format appears to have 4 %-fields but 5 parameters?
Ah, no it hasn't, but the indentation is misleading -- how about
indenting the last line (the one beginning object_size ...) some more so
that it's more obviously a parameter to bytes_per_sec() and not igt_info().
Also perhaps nicer to precalculate elapsed(&start, &end, count) and save
it rather than inlining twice in the parameter list? Maybe even do the
same with the bps value (even though it's only used once) just so the
long printf lines don't have complicated expressions embedded?
Thus:
+ for (count = 1; count <= 1<<17; count <<= 1) {
+ struct timeval start, end;
* double usecs;
* char *bps;
+
+ gettimeofday(&start, NULL);
+ do_gem_read(fd, src_stolen, dst_user, object_size, count);
+ gettimeofday(&end, NULL);
* usecs = elapsed(&start, &end, count);
* bps = bytes_per_sec((char *)buf, 1e6*object_size/usecs);
* igt_info("Time to pread %d bytes x %6d: %7.3fµs, %s\n",
* object_size, count, time, bps);
... and obviously for all other similar code below.
.Dave.
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2015-07-06 14:33 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-01 9:26 [PATCH v2 0/3] Tests for verifying the old and extended GEM_CREATE ioctl ankitprasad.r.sharma
2015-07-01 9:26 ` [PATCH 1/3] igt/gem_stolen: Verifying extended gem_create ioctl ankitprasad.r.sharma
2015-07-03 9:05 ` Tvrtko Ursulin
2015-07-03 9:16 ` Chris Wilson
2015-07-03 9:38 ` Tvrtko Ursulin
2015-07-01 9:26 ` [PATCH 2/3] igt/gem_pread: Support to verify pread/pwrite for non-shmem backed obj ankitprasad.r.sharma
2015-07-03 9:37 ` Tvrtko Ursulin
2015-07-06 14:33 ` Dave Gordon [this message]
2015-07-21 12:38 ` Ankitprasad Sharma
2015-07-01 9:26 ` [PATCH 3/3] igt/gem_create: Test to validate parameters for GEM_CREATE ioctl ankitprasad.r.sharma
2015-07-03 9:52 ` Tvrtko Ursulin
2015-07-21 13:09 ` Ankitprasad Sharma
-- strict thread matches above, loose matches on Subject: below --
2015-09-15 8:36 [PATCH v4 0/3] Tests for verifying the old and extended " ankitprasad.r.sharma
2015-09-15 8:36 ` [PATCH 2/3] igt/gem_pread: Support to verify pread/pwrite for non-shmem backed obj ankitprasad.r.sharma
2015-09-15 15:35 ` Tvrtko Ursulin
2015-07-22 13:45 [PATCH v3 0/3] Tests for verifying the old and extended GEM_CREATE ioctl ankitprasad.r.sharma
2015-07-22 13:45 ` [PATCH 2/3] igt/gem_pread: Support to verify pread/pwrite for non-shmem backed obj ankitprasad.r.sharma
2015-07-22 16:14 ` Tvrtko Ursulin
2015-05-13 11:53 [PATCH 0/3] Tests for verifying the old and extended GEM_CREATE ioctl ankitprasad.r.sharma
2015-05-13 11:53 ` [PATCH 2/3] igt/gem_pread: Support to verify pread/pwrite for non-shmem backed obj ankitprasad.r.sharma
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=559A91CA.7010802@intel.com \
--to=david.s.gordon@intel.com \
--cc=akash.goel@intel.com \
--cc=ankitprasad.r.sharma@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=shashidhar.hiremath@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox