// SPDX-License-Identifier: GPL-2.0 /* * udelay() test kernel module * * Test is executed by writing and reading to /sys/kernel/debug/udelay_test * Tests are configured by writing: USECS ITERATIONS * Tests are executed by reading from the same file. * Specifying usecs of 0 or negative values will run multiples tests. * * Copyright (C) 2014 Google, Inc.
*/
staticint udelay_test_single(struct seq_file *s, int usecs, uint32_t iters)
{ int min = 0, max = 0, fail_count = 0;
uint64_t sum = 0;
uint64_t avg; int i; /* Allow udelay to be up to 0.5% fast */ int allowed_error_ns = usecs * 5;
for (i = 0; i < iters; ++i) {
s64 kt1, kt2; int time_passed;
if (i == 0 || time_passed < min)
min = time_passed; if (i == 0 || time_passed > max)
max = time_passed; if ((time_passed + allowed_error_ns) / 1000 < usecs)
++fail_count;
WARN_ON(time_passed < 0);
sum += time_passed;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.