From 53582e958d727e06648743e505862f9df11bbb35 Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Wed, 6 May 2015 03:43:26 +0200 Subject: In pcitool try tocquire real-time performance for DMA and grabbing operations --- pcitool/cli.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'pcitool') diff --git a/pcitool/cli.c b/pcitool/cli.c index fb9b4e8..98ac5b8 100644 --- a/pcitool/cli.c +++ b/pcitool/cli.c @@ -2501,6 +2501,8 @@ int main(int argc, char **argv) { int timeout_set = 0; // int run_time_set = 0; + struct sched_param sched_param = {0}; + while ((c = getopt_long(argc, argv, "hqilr::w::g::d:m:t:b:a:s:e:o:", long_options, NULL)) != (unsigned char)-1) { extern int optind; switch (c) { @@ -3104,7 +3106,23 @@ int main(int argc, char **argv) { if (!ofile) { Error("Failed to open file \"%s\"", output); } - } + } + + // Requesting real-time priority when needed + switch (mode) { + case MODE_READ: + case MODE_WRITE: + if (amode != ACCESS_DMA) + break; + case MODE_BENCHMARK: + case MODE_GRAB: + sched_param.sched_priority = sched_get_priority_min(SCHED_FIFO); + err = sched_setscheduler(0, SCHED_FIFO, &sched_param); + if (err) pcilib_info("Failed to acquire real-time priority (errno: %i)", errno); + break; + default: + ; + } switch (mode) { case MODE_INFO: -- cgit v1.2.3