LINUX.ORG.RU

Профилирование в Qt: генерируется почти пустой gmon.out

 , ,


0

3

Решил спрофилировать свой проект. Добавил в *.pro файл опции:

QMAKE_CXXFLAGS_DEBUG += -pg
QMAKE_LFLAGS_DEBUG += -pg


полностью пересобрал. Запустил бинарник. После завершения работы бинарника появился файл gmon.out размером 72339 байт. Смотрю его командой:

gprof ./<имя бинарника> ./gmon.out -p


И он показывает пустой профиль:

Flat profile:

Each sample counts as 0.01 seconds.
  %   cumulative   self              self     total           
 time   seconds   seconds    calls  Ts/call  Ts/call  name    

 %         the percentage of the total running time of the
time       program used by this function.

cumulative a running sum of the number of seconds accounted
 seconds   for by this function and those listed above it.

 self      the number of seconds accounted for by this
seconds    function alone.  This is the major sort for this
           listing.

calls      the number of times this function was invoked, if
           this function is profiled, else blank.

 self      the average number of milliseconds spent in this
ms/call    function per call, if this function is profiled,
	   else blank.

 total     the average number of milliseconds spent in this
ms/call    function and its descendents per call, if this
	   function is profiled, else blank.

name       the name of the function.  This is the minor sort
           for this listing. The index shows the location of
	   the function in the gprof listing. If the index is
	   in parenthesis it shows where it would appear in
	   the gprof listing if it were to be printed.

Copyright (C) 2012-2017 Free Software Foundation, Inc.


Вот. Что где еще надо крутить, чтобы получить нормальный файл профилирования?

Qt 5.9.2 если что.

★★★★★

Ответ на: комментарий от Xintrea

Решение:

QMAKE_CXXFLAGS_DEBUG += -pg -no-pie
QMAKE_LFLAGS_DEBUG += -pg -no-pie

Xintrea ★★★★★
() автор топика

Решил спрофилировать свой проект.

И почему ты не воспользовался Valgrind, который уже встроен в тот же Qt Creator и рекомендуется к использованию из коробки?

http://doc.qt.io/qtcreator/creator-analyzer.html
http://doc.qt.io/qtcreator/creator-cache-profiler.html

Вместо этого ты взял древнючий gprof и сходу наступил на грабли.

EXL ★★★★★
()
Ответ на: комментарий от EXL

Я им спрофилировал, да, он есть в Qt прям встроенный. Но его вывод мне ни о чем не говорит. Gprof с ходу показал проблемное место.

Xintrea ★★★★★
() автор топика
Ответ на: комментарий от yoghurt

valgrind - это целое семейство утилит. Если не изменяет память, нужен cachegrind, ну и KCachegrind для анализа результатов

dave ★★★★★
()
Последнее исправление: dave (всего исправлений: 1)
Ответ на: комментарий от Xintrea

Gprof с ходу показал проблемное место.

что он показал, чего не смог valgrind-cachegrind ?

x905 ★★★★★
()
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.