1

Boot to desktop and boot to command line can be chosen using raspi-config. I decided to do a test to see whether my code will execute faster using the command line interface.

How come the raspberry pi execution time calculated is different on the desktop terminal and command line terminal with the command line interface execution showing slower results?

Code execution of my code in the desktop terminal shows 0.004s / 250Hz while in command line interface showing a slower 0.03s / 33Hz execution time

I am using:

At the beginning of the code I use:

deltaTimeInit=getTickCount(); //Open CV function

Then calculate the total execution time at the end of the code loop using the code at the bottom:

The while condition adds delay to keep the deltaTime constant which is used for gyroscope angular velocity integration to obtain angles from quadcopter orientation

while((((float)getTickCount()-deltaTimeInit)/(((float)getTickFrequency())))<0.004){
    deltaTime=((float)getTickCount()-deltaTimeInit)/(((float)getTickFrequency()));
    cout << "DT = " << deltaTime << endl;
}
  • I don't understand what you are doing. Presumably you have a C++ program. How are you invoking the program in each of the two cases you have timed? What output does it produce to the screen? – joan Feb 27 '16 at 10:57
  • @joan Basically its the quadcopter PID loop. I'm checking which parts of the code is incurring the most delays. I'm printing the delays and the values from the Accel and Gyro as well as the PWM values using cout. These are displayed on the raspbian terminal in desktop mode and, after reboot after changing to the commandline interface, display in the command line itself. – user123456098 Feb 27 '16 at 11:17
  • @joan the prints in the terminal would display different values of delays calculated eg "delay = 0.004s" in the terminal in desktop mode while showing "delay = 0.03s in the command line – user123456098 Feb 27 '16 at 11:20
  • I' m executing the same code at two different times at the two interface options – user123456098 Feb 27 '16 at 12:45
  • A one off timing is always going to show variation. at the very least you need to take multiple measurements and avg them. For example what else is the system doing while you are running your tests? – Steve Robillard Feb 27 '16 at 13:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.