• 4138阅读
  • 1回复

为什么我的程序这么慢? [复制链接]

上一主题 下一主题
离线zrr1117
 
只看楼主 倒序阅读 楼主  发表于: 2008-08-22
— 本帖被 XChinux 执行加亮操作(2008-08-25) —
用Qt4编一个绘制拓扑结构的工具,在建立结点时将结点的ID插入到QStringList链表中,建立连接时,在dockWidget的comboBox中加载QStringList(有4个这样的comboBox)。一到这个对话框就超级慢?我该怎么办?
离线steinlee

只看该作者 1楼 发表于: 2008-08-23
In order to optimize the code, people need to know  where the code uses most CPU time.
gprof can be used to find that out. Steps to use it
1. add  option  -pg to  CFLAGS, CXXFLAGS and LINK  in make file
2. make clean and recompile your code
3. run your code(for example guiapp)  and you will get  a file gmon.out
4.  type command "gprof guiapp | less"  to see the info

From the steps above you can find which function uses the most CPU time. Then you may either find some errors there or  try to optimize this function. Good luck
[ 此贴被steinlee在2008-08-25 11:29重新编辑 ]
Looking for remote C/C++ and Qt 兼职
快速回复
限100 字节
 
上一个 下一个