|
29 | 29 | #include "ReadoutUtils.h" |
30 | 30 |
|
31 | 31 |
|
| 32 | +#include <sys/types.h> |
| 33 | +#include <sys/stat.h> |
| 34 | +#include <fcntl.h> |
| 35 | + |
| 36 | + |
32 | 37 | // option to add callgrind instrumentation |
33 | 38 | // to use: valgrind --tool=callgrind --instr-atstart=no --dump-instr=yes ./a.out |
34 | 39 | // to display stats: kcachegrind |
@@ -105,6 +110,19 @@ int main(int argc, char* argv[]) |
105 | 110 | theLog.log("Error : %s",err.c_str()); |
106 | 111 | return -1; |
107 | 112 | } |
| 113 | + |
| 114 | + |
| 115 | + // try to prevent deep sleeps |
| 116 | + theLog.log("Disabling CPU deep sleep for process"); |
| 117 | + int maxLatency=1; |
| 118 | + int latencyFd = open("/dev/cpu_dma_latency", O_WRONLY); |
| 119 | + if (latencyFd < 0) { |
| 120 | + theLog.log("Error opening /dev/cpu_dma_latency"); |
| 121 | + } else { |
| 122 | + if (write(latencyFd, &maxLatency, sizeof(maxLatency)) != sizeof(maxLatency)) { |
| 123 | + theLog.log("Error writing to /dev/cpu_dma_latency"); |
| 124 | + } |
| 125 | + } |
108 | 126 |
|
109 | 127 |
|
110 | 128 | // extract optional configuration parameters |
@@ -296,7 +314,7 @@ int main(int argc, char* argv[]) |
296 | 314 | // configuration of data sampling |
297 | 315 | #ifdef WITH_DATASAMPLING |
298 | 316 | int dataSampling=0; |
299 | | - dataSampling=cfg.getValue<int>("sampling.enabled"); |
| 317 | + cfg.getOptionalValue<int>("sampling.enabled",dataSampling); |
300 | 318 | std::unique_ptr<AliceO2::DataSampling::InjectorInterface> dataSamplingInjector; |
301 | 319 | if (dataSampling) { |
302 | 320 | theLog.log("Data sampling enabled"); |
@@ -419,6 +437,10 @@ int main(int argc, char* argv[]) |
419 | 437 | } |
420 | 438 | readoutDevices.clear(); // to do it all in one go |
421 | 439 |
|
| 440 | + if (latencyFd>=0) { |
| 441 | + close(latencyFd); |
| 442 | + } |
| 443 | + |
422 | 444 | theLog.log("Operations completed"); |
423 | 445 |
|
424 | 446 | return 0; |
|
0 commit comments