[PATCH i-g-t 1/2] tests/i915/perf: trybot: Print lost reports on SKL for polling-small-buf
Umesh Nerlige Ramappa
umesh.nerlige.ramappa at intel.com
Mon Sep 14 22:19:00 UTC 2020
On some platforms like SKL a very short oa sampling period sometimes
results in lost reports. The polling-small-buf test fails in some
scenarios on SKL, so print the number of reports.
Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa at intel.com>
---
tests/i915/perf.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/tests/i915/perf.c b/tests/i915/perf.c
index ba477f1c..991f5891 100644
--- a/tests/i915/perf.c
+++ b/tests/i915/perf.c
@@ -2313,13 +2313,15 @@ static void test_polling_small_buf(void)
.properties_ptr = to_user_pointer(properties),
};
uint32_t test_duration = 80 * 1000 * 1000;
- int sample_size = (sizeof(struct drm_i915_perf_record_header) +
+ struct drm_i915_perf_record_header *header;
+ int sample_size = (sizeof(*header) +
get_oa_format(test_set->perf_oa_format).size);
int n_expected_reports = test_duration / oa_exponent_to_ns(oa_exponent);
int n_expect_read_bytes = n_expected_reports * sample_size;
struct timespec ts = {};
int n_bytes_read = 0;
uint32_t n_polls = 0;
+ uint32_t n_report_lost = 0;
stream_fd = __perf_open(drm_fd, ¶m, true /* prevent_pm */);
do_ioctl(stream_fd, I915_PERF_IOCTL_ENABLE, 0);
@@ -2330,20 +2332,26 @@ static void test_polling_small_buf(void)
ppoll(&pollfd, 1, NULL, NULL);
if (pollfd.revents & POLLIN) {
uint8_t buf[1024];
- int ret;
+ int ret, offset;
ret = read(stream_fd, buf, sizeof(buf));
if (ret >= 0)
n_bytes_read += ret;
+
+ for (offset = 0; offset < ret; offset += sample_size) {
+ header = (void *)(buf + offset);
+ if (header->type == DRM_I915_PERF_RECORD_OA_REPORT_LOST)
+ n_report_lost++;
+ }
}
n_polls++;
}
- igt_info("Read %d expected %d (%.2f%% of the expected number), polls=%u\n",
+ igt_info("Read %d expected %d (%.2f%% of the expected number), polls=%u, reports lost=%u\n",
n_bytes_read, n_expect_read_bytes,
n_bytes_read * 100.0f / n_expect_read_bytes,
- n_polls);
+ n_polls, n_report_lost);
__perf_close(stream_fd);
--
2.20.1
More information about the Intel-gfx-trybot
mailing list