I am using bochs to run the os kernel and find the problem of low performance of fork.
How to identify the performance bottle neck in the bochs? It will be better if it can find which function or which source file waste most of the system time.
Thanks.
How to identify the performance bottleneck of the kernel?
- zhongshu_gu
- Posts: 6
- Joined: Tue Jan 22, 2008 9:47 pm
- Location: Beijing, China
Re: How to identify the performance bottleneck of the kernel?
I guess the simplest (but probably longest one) is to simply time most of the functions called inside the 'fork' function. A very simple way of timing would be:
Or something equivalent. You can probably also measure it with the debugger or by profiling or something, but I'm not really sure how that works. You'll have to wait for some other responses I guess.
Code: Select all
unsigned long Time = GetSystemTicks();
DoFunction();
PrintValue(GetSystemTicks() - Time);
When the chance of succeeding is 99%, there is still a 50% chance of that success happening.
- salil_bhagurkar
- Member
- Posts: 261
- Joined: Mon Feb 19, 2007 10:40 am
- Location: India
Re: How to identify the performance bottleneck of the kernel?
Unfortunately, the concept of a function that a compiler understands, is not understood by the processor. If it could, it would have generated exceptions on function entry and function exit, the handlers of which would take care of runtime profiling beautifully...
Re: How to identify the performance bottleneck of the kernel?
Have a look at -finstrument-functions. That should do EXACTLY what you want.salil_bhagurkar wrote:Unfortunately, the concept of a function that a compiler understands, is not understood by the processor. If it could, it would have generated exceptions on function entry and function exit, the handlers of which would take care of runtime profiling beautifully...
- salil_bhagurkar
- Member
- Posts: 261
- Joined: Mon Feb 19, 2007 10:40 am
- Location: India
Re: How to identify the performance bottleneck of the kernel?
Nice! This is interesting, but it will add a bit of memory overhead to your code. Apart from that, if you wanted to switch off the profiling, it would need a recompilation. Nevertheless, it would be a cool way to profile your code at runtime.JamesM wrote:Have a look at -finstrument-functions. That should do EXACTLY what you want.salil_bhagurkar wrote:Unfortunately, the concept of a function that a compiler understands, is not understood by the processor. If it could, it would have generated exceptions on function entry and function exit, the handlers of which would take care of runtime profiling beautifully...