examples/ioat: fix the stop flag issue for kernel test tool

The "idle" status has 2 meanings for IOAT kernel performace
test module dmaperf: performance test task has finished or
no performance task at all. For the lastest kernel(4.8), the
userland tool will get the "idle" status before the kernel
changed to "running", but for some older kernels(3.17,4.0)
the test tool run correctly. So add a sleep syscall before
to get the status will fix it.

Change-Id: Ia236416607c77b3b8689933fe71ce53a783a04cc
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
Changpeng Liu 2017-02-08 15:28:41 +08:00 committed by Daniel Verkamp
parent 200217a47e
commit 04ddd8f2c9

View File

@ -313,18 +313,20 @@ int main(int argc, char *argv[])
fprintf(stdout, "Running I/O ");
fflush(stdout);
memset(buf, 0, BUFSIZ);
/* wait all the channels to be idle */
while (!get_str_from_file("/sys/kernel/debug/dmaperf/dmaperf/status", buf, BUFSIZ)) {
do {
fprintf(stdout, ". ");
fflush(stdout);
sleep(1);
if (strstr(buf, "idle") != NULL) {
fprintf(stdout, "\n");
fflush(stdout);
sleep(1);
break;
}
fprintf(stdout, ". ");
fflush(stdout);
sleep(1);
}
} while (!get_str_from_file("/sys/kernel/debug/dmaperf/dmaperf/status", buf, BUFSIZ));
/* collect each channel performance data */