Russian Qt Forum
Апрель 16, 2024, 20:26 *
Добро пожаловать, Гость. Пожалуйста, войдите или зарегистрируйтесь.
Вам не пришло письмо с кодом активации?

Войти
 
  Начало   Форум  WIKI (Вики)FAQ Помощь Поиск Войти Регистрация  

Страниц: [1]   Вниз
  Печать  
Автор Тема: [Решено] Профилирование в Qt: генерируется почти пустой gmon.out  (Прочитано 3024 раз)
xintrea
Супер активный житель
*****
Offline Offline

Сообщений: 754



Просмотр профиля WWW
« : Ноябрь 29, 2017, 17:52 »

Решил спрофилировать свой проект. Добавил в *.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 если что.
« Последнее редактирование: Ноябрь 29, 2017, 18:16 от xintrea » Записан

Собираю информацию по крупицам
http://webhamster.ru
xintrea
Супер активный житель
*****
Offline Offline

Сообщений: 754



Просмотр профиля WWW
« Ответ #1 : Ноябрь 29, 2017, 18:15 »

Вопрос снимается, это баг GCC 6

https://bugs.launchpad.net/ubuntu/ source/gcc-6/ bug/1678510

Для обхода можно писать такие опции:

Код:
QMAKE_CXXFLAGS_DEBUG += -pg -no-pie
QMAKE_LFLAGS_DEBUG += -pg -no-pie

Записан

Собираю информацию по крупицам
http://webhamster.ru
__Heaven__
Джедай : наставник для всех
*******
Offline Offline

Сообщений: 2130



Просмотр профиля
« Ответ #2 : Ноябрь 30, 2017, 09:13 »

Вроде ж можно без добавления в pro запускать профилирование. Просто в qtcreator выбирается buid configuration Profile.
Рекомендую попробовать Callgrind - результат отображается сразу в qtcreator.
Записан
Страниц: [1]   Вверх
  Печать  
 
Перейти в:  


Страница сгенерирована за 0.045 секунд. Запросов: 22.