Author Topic: CodeCompletion slow on some machine  (Read 20218 times)

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5280
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: CodeCompletion slow on some machine
« Reply #15 on: April 16, 2012, 02:43:03 am »
CB is not compiled with the compiler option -pg, correct ? I will need to recompile it.
Yes, recompile is need. (I have once recompiled CC plugin with -pg to profile it).

Quote
it would be better to provide 2 patches : one for the additionnal profiling, and one for the code change.
Some times, I have also meet this kind of issue, I have two different changes on the same file. No idea how to  create two consequence patches. Maybe, Git can help me.  :)

Quote
And please be patient : I can debug this problem only at work, and I have since more than 1 year a very high pressure on my project (reason why other projects seem abandonned, like the xpmeditor). I cannot afford to spend too much time in a row on this problem. I hope everybody can understand that.
I think any kind of contribution is valuable. Thank you!!!
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9606
Re: CodeCompletion slow on some machine
« Reply #16 on: April 16, 2012, 06:57:56 am »
Some times, I have also meet this kind of issue, I have two different changes on the same file. No idea how to  create two consequence patches. Maybe, Git can help me.  :)
No, GIT won't help.

That's why I have a actually 2 working copies, one is SVN-controlled:
When I want to merge something into trunk I first use a diff tool to pump it from my working- into into the SVN-working copy and then create a patch, revert the changes in the svn-working copy and apply the nest modifications etc...
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline jarod42

  • Multiple posting newcomer
  • *
  • Posts: 83
Re: CodeCompletion slow on some machine
« Reply #17 on: April 16, 2012, 10:32:11 am »
Some DVCS support shelving (which may be done by chunk).
and 'git add --patch' seems to solve your issue.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12911
    • Travis build status
Re: CodeCompletion slow on some machine
« Reply #18 on: April 16, 2012, 01:29:45 pm »
ollydbg:
gprof is useless when you have shared libraries. It only works well for statically linked applications or at least I've not been able to make it work.
You need something like Intel V-Tune or oprofile.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9606
Re: CodeCompletion slow on some machine
« Reply #19 on: April 16, 2012, 02:03:37 pm »
gprof is useless when you have shared libraries. It only works well for statically linked applications [...]
That's why I wrote:
I guess using the profiler plugin and a testing environment you can do much better ;-)
By that I meant out test ParserTest project, if that is sufficient for that purpose - depending on where the lag would be, it may not cover all methods affected.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline seb_seb0

  • Almost regular
  • **
  • Posts: 166
Re: CodeCompletion slow on some machine
« Reply #20 on: April 16, 2012, 10:33:30 pm »
I have made a few progress:
  1 - -pg does not help : the gmon.out is empty. I have seen somewhere on the net how to enable gprof for multithreaded applications. Perhaps it would help
       For now, the good old printf method is sometimes unbeatable (simple and effective).

  2 - when amount of parser threads is set to 1 per project, the freeze does occur
       when the amount of parser threads is set to 2 or more per project, there are no more freeze.
       Using 1 parser for the whole workspace does not provoke the freeze. However, on the work computer (Win XP), the CodeCompletion does not give results. It works however on Win7

  3 - I have tried to launch Code::Blocks in the debugger gdb, and paused the process during the freeze: I end up each time in a ntdll!DbgUiConnectToDbg. So not a lot of help here for now. (and yes, I was using Code::Blocks with debug symbols enabled).

So in short : I have found a workaround for making it work on both machines. This is however not really satisfying, because I still do not understand what happens exactly. So I will continue to search for an explanation (why do we have a freeze with 1 parser and not with 2 ?)

Seb
 
« Last Edit: April 16, 2012, 10:43:03 pm by seb_seb0 »

Offline seb_seb0

  • Almost regular
  • **
  • Posts: 166
Re: CodeCompletion slow on some machine
« Reply #21 on: April 16, 2012, 10:40:49 pm »
ollydbg:
gprof is useless when you have shared libraries. It only works well for statically linked applications or at least I've not been able to make it work.
You need something like Intel V-Tune or oprofile.
oprofile is Linux only (I work on Windows), and Intel V-Tune costs a bit (for that, I do not think my boss will be very happy to pay for it). If you know another profiler than gprof, I would be happy to hear from it.
I will try CodeTune (just found it, I do not know how to use it yet).

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5280
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: CodeCompletion slow on some machine
« Reply #22 on: April 17, 2012, 05:17:59 am »
I have made a few progress:
  1 - -pg does not help : the gmon.out is empty. I have seen somewhere on the net how to enable gprof for multithreaded applications. Perhaps it would help
       For now, the good old printf method is sometimes unbeatable (simple and effective).
Though gprof is said to be useless, it does generate the gmon.out file in my cases(build CC with -pg enabled, several months ago).

Quote
 2 - when amount of parser threads is set to 1 per project, the freeze does occur
       when the amount of parser threads is set to 2 or more per project, there are no more freeze.
       Using 1 parser for the whole workspace does not provoke the freeze. However, on the work computer (Win XP), the CodeCompletion does not give results. It works however on Win7
There are some basic logic about this. If one parser for the whole workspace, which means we have only one instance of the Parser class, and all tokens were added to the one TokensTree. On the other side, if one parser for one c::b project, this means there are many instances of Parser, each Parser object holds the corresponding tokens for each project. This feature is added  by Loaden who is not active for half a year.


Quote
 3 - I have tried to launch Code::Blocks in the debugger gdb, and paused the process during the freeze: I end up each time in a ntdll!DbgUiConnectToDbg. So not a lot of help here for now. (and yes, I was using Code::Blocks with debug symbols enabled).
At this case, you can run "step out" or "step", or the "backtrace" to see the call-stack in each thread or set some breakpoints where you believe is a endless loop.
« Last Edit: April 17, 2012, 08:41:07 am by ollydbg »
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5280
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: CodeCompletion slow on some machine
« Reply #23 on: April 17, 2012, 05:32:18 am »
Some DVCS support shelving (which may be done by chunk).
and 'git add --patch' seems to solve your issue.
Thanks, I do not familiar with gdb shelving. :)
But Git can generate a sequence of patches. When I read the GDB patches maillist, I always see some posts like:
[Patch XXX 0/2]
[Patch XXX 1/2]
[Patch XXX 2/2]
Each posts contains one piece patches, but I can see they were generated by Git. You need to apply the patch in sequence.
Note: GDB code repo is controlled by CVS, but many GDB developers were using Git for maintaining patches.

PS: Biplab has constructed a Git read-only repo for C::B.
« Last Edit: April 17, 2012, 07:31:47 am by ollydbg »
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.