I am trying to periodically call a fetch function in a C ++ stream on my Linux machine. I would like to restart my function after a very short period, ideally 1 ms, but I find that the power (in W) consumed during 1 ms is prohibitively high: the system works at twice the power level, as when my period is 5 ms . Low power consumption is a serious issue for the functionality I want.
In particular,
void* loop_and_sample(void* arg) { while(1) { sample(); nanosleep((struct timespec[]){{0,1000000}}, NULL); } }
Accepts 2x power:
void* loop_and_sample(void* arg) { while(1) { sample(); nanosleep((struct timespec[]){{0,5000000}}, NULL); } }
I determined that the difference in the energy consumption of my sampler at 2 frequencies is negligible and that the additional energy consumption comes from a sleep call. That is, even if I comment on the sample () line in both fragments above, the second still takes up half the power. Any ideas on how I can reduce the power consumed by a sleep call?
FYI, I am running Ubuntu 3.2.0 on a 24-core Intel Xeon processor, and a search in my / boot / config for frequency shows the following:
cat /boot/config-3.2.0-48-generic | egrep 'HZ' CONFIG_RCU_FAST_NO_HZ=y CONFIG_NO_HZ=y
However, by running this script: http://www.advenage.com/topics/linux-timer-interrupt-frequency.php , I found that interrupting the kernel timer is at least 4016 Hz (this is 4 times the frequency I would like to try ) Thank you for your help!
jst14 source share