⚠️ Forum Maintenance: Feb 6th, 8am - 14pm (UTC+2)

Print build time

  • Is there any method to print a build time? I see that Qt Creator or qmake prints a message when make starts and stops. I want to print at the end of the build difference between them.

    Example of Compile Output:
    15:02:05: Running build steps for project untitled...
    15:02:06: Starting: "/usr/bin/qmake-qt4" /tmp/untitled/untitled.pro -r -spec linux-g++
    15:02:06: The process "/usr/bin/qmake-qt4" exited normally.
    15:02:06: Starting: "/usr/bin/make" -w
    make: Entering directory /tmp/untitled-build-desktop-Qt_4_7_4_w_PATH__System__Release' g++ -c -pipe -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_SHARED -I/usr/lib64/qt4/mkspecs/linux-g++ -I../untitled -I/usr/include/QtCore -I/usr/include -I. -I../untitled -I. -o main.o ../untitled/main.cpp g++ -Wl,-O1 -o untitled main.o -L/usr/lib64 -lQtCore -lpthread make: Leaving directory/tmp/untitled-build-desktop-Qt_4_7_4_w_PATH__System__Release'
    15:02:06: The process "/usr/bin/make" exited normally.

    // here I want to print differences between the times

  • Qt Creator adds those time stamps.

    A good way to get the desired time difference on linux/mac is to just add "time" in front of the call: It will measure different time values (cpu time, wallclock time) and print it once the application is done.

  • Thanks, I forget about time, but this works outside Qt Creator. There is a another solution, which will work inside Qt Creator?

Log in to reply