diff options
author | Suren A. Chilingaryan <csa@suren.me> | 2015-05-06 03:43:26 +0200 |
---|---|---|
committer | Suren A. Chilingaryan <csa@suren.me> | 2015-05-06 03:43:26 +0200 |
commit | 53582e958d727e06648743e505862f9df11bbb35 (patch) | |
tree | 9619fb037887906f6ecf55b1438cd26252b7cf25 /pcitool | |
parent | 98d3c9e1b820020111aa85853c93ecb3550c627b (diff) | |
download | pcitool-53582e958d727e06648743e505862f9df11bbb35.tar.gz pcitool-53582e958d727e06648743e505862f9df11bbb35.tar.bz2 pcitool-53582e958d727e06648743e505862f9df11bbb35.tar.xz pcitool-53582e958d727e06648743e505862f9df11bbb35.zip |
In pcitool try tocquire real-time performance for DMA and grabbing operations
Diffstat (limited to 'pcitool')
-rw-r--r-- | pcitool/cli.c | 20 |
1 files changed, 19 insertions, 1 deletions
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: |