|
Is there any tools to analyse the performance of C# program? What i care about is the speed of procedures in an algorithm.
I use VS7, but can't find a tool like profiler in VC6.
Tried to write a profiler for C# like the QProfile in CodeGuru, but i find it impossible because C# doesn't accept static variable in procedure. Then measure the time cost of a single procedure is not easy, or will cost a lot (for example use a string name or a unique number as a hash key to show which procedure is the profiler reached). Any suggestion?
|
|
|
|
|
I have been using Compuware/Numega DevPartner Profiler (Community Edition). It's Free.
Still waiting for the sales rep to call back when the Studio suite is available for VS.NET, they said around june for the upgrade from version 6.6. It's not Free.
|
|
|
|
|
BTW, If you do decide to check out the afore mentioned tool, a word of warning.
The installer that I used did NOT suggest to reboot my machine after it was finished.
Reboot your machine after installing it and before you actually run it. Otherwise VS.NET might do it for you. It BSOD’d my machine.
Sorry if it already bit you, it’s just been a long time since I installed it, it slipped my mind.
Regards
|
|
|
|
|
Neil Van Note wrote:
It BSOD’d my machine.
What's "BSOD" ??
Maxwell Chen
People say "No news is good news". Then, no code is good code!?
|
|
|
|
|
Blue Screen of Death, in other words windows got messed up to the point it couldn't recover.
James
Simplicity Rules!
|
|
|
|
|
Like James said, It torked my machine bad enough that it decided it was time for a reboot. Although, Under XP I choose to call it the Black Screen of Death...
I thought is was cute how XP volunteers to phone home to MSFT after a crash though.
|
|
|
|
|
Ohh, a fairly good tool.
I download and run the 6.7 prerelease. It work smoothly and have not find any BSOD yet
But still some limits according to my usage, I wanna analyse some procedure not all. The later solution give too many data that confused my eyes. i will rather have a library like QProfile. You can manually write a static object in a procedure you focused. when in its contruction take a time mark and in its destruction take another. then have the subtration of them, we have a time span of one run. Finally have several run's spans summed, you have the time cost of this procedure in your application. But this design is difficult to apply on C# because it shorts of the feature of static variable in procedure(function).
|
|
|
|
|
It does have such features, plus an API, although I don't know if they are present in the community version.
|
|
|
|
|
Can someone give a a good explanation of what DoubleBuffering is. Also while I am making requests , since the String data type is immutable(Am I correct?) is there a mutable data type like StringBuffer available in C# like there is in other languages? Someone clear me up on this. Thanks.
Nick Parker
|
|
|
|
|
System.Text.StringBuilder
|
|
|
|
|
In short, double buffering is the act drawing to an off-screen graphics context and then blitting it to the screen in one action. Sorry No time for a good explanation.
|
|
|
|
|
DoubleBuffering is a common graphics drawing algorithm. Basically, you "draw" everything in a bitmap in memory. When a screen refresh occurs, you put your drawn bitmap on the video memory.
This way, you avoid partially drawn frames: they are ugly and kills action and animation on a game or multimedia app, for example. Even a common form on the screen can be improved with doublebuffering, because the app appears to be faster and more responsive. Movement with double buffering usually is very smooth.
But there is no free lunch. First, you have two writes and a performance hit: one write on main memory, second a data transfer to the video card (ok, normally very fast).
Second problem: because you only transfer the buffer to screen when it's drawn, performance falls at fractions of video refresh speed.
E.g: you make a simple animation and double buffer to a 60Hz video mode. So, you get 60 FPS (frames per second). So, you start adding more details to each frame and keeping 60FPS. Suddenly, you add a little more detail and animation falls to 30FPS. A little more and 15FPS. A little more and 7 FPS. So, your very responsive app can become a slow one.
I'm not sure (because of my english) if I was clear enough. There are (lots of) other animation algorithms and some workarounds to the problems I told you, but the basic issues are those.
Crivo
Automated Credit Assessment
|
|
|
|
|
Thanks that was a great explanation really, very well put.
Nick Parker
|
|
|
|
|
I have create a custom Windows form control and enabled the built in double buffering with:
this.SetStyle(ControlStyles.DoubleBuffer & ControlStyles.UserPaint & ControlStyles.AllPaintingInWmPaint, true);
but this does not help my flicker problem at all... From what I have read that will work in controls, Right?.?.
Joshua Guy Sonork ID: 100.9944
ICQ: 519642
Hotmail: JoshuaJGuy@hotmail.com
|
|
|
|
|
this.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);
|
|
|
|
|
DOH! Well that was part of my problems, but even with that it still flickers like crazy. I have that enabled in my Windows Form control and the parent form. Any other suggestions?
Joshua Guy Sonork ID: 100.9944
ICQ: 519642
Hotmail: JoshuaJGuy@hotmail.com
|
|
|
|
|
Are you doing all your drawing during the Paint event?
Thats the only time that the double-buffering is actually used.
James
Simplicity Rules!
|
|
|
|
|
It's all in the Paint event. To make things worse. I copied and pasted all my code into a form and it works like a charm. I'll dig in more into the control but something isn't right with that.
Joshua Guy Sonork ID: 100.9944
ICQ: 519642
Hotmail: JoshuaJGuy@hotmail.com
|
|
|
|
|
DOH! It was so stupid I won't even admit what I did.
Joshua Guy Sonork ID: 100.9944
ICQ: 519642
Hotmail: JoshuaJGuy@hotmail.com
|
|
|
|
|
But you must tell us, if not for us do it for the children; think of the children who may fall into the same trap you did.
James
Simplicity Rules!
|
|
|
|
|
If you must know.
I posted the message with the following code:
this.SetStyle(ControlStyles.DoubleBuffer & ControlStyles.UserPaint & ControlStyles.AllPaintingInWmPaint, true);
Which of course would not enable the double buffering.
Neil points out my stupid mistake(which I originally had in my other test form, but a monkey came along and changed all the |'s to &'s as a nasty joke, so as you see this was clearly the monkeys fault not mine)
this.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);
So I see Neil'd observation and hit myself. Well evidently I hit my self so hard that when I went to change it I went into the source of my dummy app in which I was testing the control. So the parent form was double buffered correctly. Thinking that I had enabled it in my control I was sad. So I left it alone until now. And after a break and looking in my code again I relize that the monkeys &'s had not be changed to |'s... If it weren't for the monkey I would have been set.
Joshua Guy Sonork ID: 100.9944
ICQ: 519642
Hotmail: JoshuaJGuy@hotmail.com
|
|
|
|
|
Damned dirty monkeys
James
Simplicity Rules!
|
|
|
|
|
LOL, I hate it when I do that... , Errr, The monkeys I mean...
|
|
|
|
|
using xml, i need to have a wizard (add-in or ui-less control) generate controls and place them on the form.
for instance, the xml reads:
<code>
<controls>
<control tag="DB_COLUMN_NAME">
<name value="Sample"/>
<type value="MyLib.Controls.TextWithLabel"/>
<label value="My Sample"/>
<defaultText value="Enter Text Here"/>
<size>
<width value="200"/>
<height value="34"/>
</size>
. . .
</control>
</controls>
</code>
so when this control loads this xml, it creates a 'TextWithLabel' control and places it on the form as if the user drew the control from the toolbox.
this is a hard topic to search for and i would appreciate any good books/articles on Generative UI development. *like this or more hardcore only please*
|
|
|
|
|
Why don't u use XSL, it's perfect for such task (controls is a pseudo-hierarchical recorset in fact & is enough flat to avoid dirty case).
You should asso look native format .resx (see resgen.exe) which the XML schema of microsoft form. Other tracks:
* Configuration
* Visual Inheritance
* Designer
good luck
|
|
|
|