|
lookig into source i see something like this used in another case but maybe it is what you need
t!
BOOL bResult = CPropertySheet::OnInitDialog();
int ActPage = GetActiveIndex();
for(int i = 0; i < GetPageCount(); i++)
SetActivePage(i);
SetActivePage(ActPage); //return back
|
|
|
|
|
This should work, but I'm afraid that the swap of active pages will be visible to the user (as this has to take place during runtime, and I think this code was used before the creation of CPropertySheet).
Why did they prevent that stupid window from creating during AddPage ?
anyway thank you, I will be trying...
|
|
|
|
|
Hi,
How can i get the total amount of memory used by a process at any given time?
I know about GetProcessWorkingSetSize, but this works only on Winnt and not
9x systems, also this function will give only the max and min usages.
|
|
|
|
|
Hello,
What should one use:
memset or FillMemory / ZeroMemory
memcpy or CopyMemory etc.?
I assume the Win32 memory functions are faster, but how much?
Best regards,
Alexandru Savescu
|
|
|
|
|
If you plan to port your code to other systems, use CRT functions else call the API as that's what CRT functions do eventually.
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Nish - Native CPian wrote:
else call the API as that's what CRT functions do eventually.
Not always, may I add
I was thinking of the thread functions mostly.
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Thanks Nish,
I do not plan to port my code (obviously), all I am interested in is the performance, especially speed. Any idea?
Best regards,
Alexandru Savescu
|
|
|
|
|
I assume the Win32 memory functions are faster, but how much?
Actually, FillMemory and colleagues are macros for memset These are not real Win32 functions, but rather they're resolved usually as inline code.
Apart from this, Mish wisely pointed out the convenience of not using platform-specific APIs if they're are so easily avoidable as these.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Ok, thanks, I thought there were somehow "more built in" in the OSs architecture.
Best regards,
Alexandru Savescu
|
|
|
|
|
Joaquín M López Muñoz wrote:
Mish wisely pointed out
Mish????
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Oh, forgive the typo I was talking about you, of course.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
At least he said you did smth wisely
Best regards,
Alexandru Savescu
|
|
|
|
|
I assume that functions like ZeroMemory will eventually call memset. A debug stepping confirmed this (for a dialog based app, debug build)
About speed - testing with RDTSC gave the following result when filling a 10'000 byte array: [modified](This seems odd when I read the response above. Perhaps this is just a debug mode thing)[/modified]
memset: 2753 ticks
ZeroMemory: 4255 ticks
I might add that this was also a debug build. [modified]Yes, under Release no difference in the execution time could be measured.[/modified]
/moliate
|
|
|
|
|
Performance testing under debug is pointless.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Tim Smith wrote:
Performance testing under debug is pointless.
I didn't think it would make a difference in this case since the same code is called.
Suppose I have to take a closer look at the Debug/Release differences (again...)
/moliate
Two o'clock and walking through familiar London - Or what was familiar London before the cursor deleted certain certainties -
I watch a suit and tie man giving suck to the Psion Organizer lodged in his breast pocket
its serial interface like a cool mouth hunting his chest for sustenance, familiar feeling, and I'm watching my breath steam in the air.
Neil Gaiman - Cold Colours
|
|
|
|
|
You could be right. But it has always been my opinion to just go ahead and test in release mode. Then you don't have to guess if it might make a difference.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
I was under the impression that using RDTSC (alone) in a true multi-tasking environment would not yield accurate results due to the fact that the OS is busy doing other things, and your code, no matter how small, might get suspended/swapped.
Peace!
-=- James.
"Fat people are hard to kidnap."
(Try Check Favorites Sometime!)
|
|
|
|
|
This is very true. Which is why you run your tests for a long time and multiple times. There are also things you do to try and make sure all you program code is paged in.
But generally, you never test for raw speed (i.e. X runs in 506ms). You should always test for relative speed (i.e. X runs 23% faster than Y). This helps to make sure that both tests for X and Y are performed in the same environment.
Also, test for repeatability.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
What I am trying to say is that even though what you said is very true. There are things that you can do to still make performance measurement reasonably reliable.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
moliate wrote:
ZeroMemory
If recall correctly Zero Memory is a memset that fills 0's in the destination adress.
Cheers,
Joao Vaz
A person who is nice to you, but rude to the waiter, is not a nice person - Natalie Portman (Padme/Amidala of Star Wars)
|
|
|
|
|
Yes, but Joaquín told us it was a macro rather than a function. That's why I found it so odd to get different results on the memset/ZeroMemory.
Apparantly it is never safe to do even the simplest performance testing in a Debug build. Lesson learned.
/moliate
Two o'clock and walking through familiar London - Or what was familiar London before the cursor deleted certain certainties -
I watch a suit and tie man giving suck to the Psion Organizer lodged in his breast pocket
its serial interface like a cool mouth hunting his chest for sustenance, familiar feeling, and I'm watching my breath steam in the air.
Neil Gaiman - Cold Colours
|
|
|
|
|
moliate wrote:
Yes, but Joaquín told us it was a macro rather than a function.
Yeap, Joaquin is right
moliate wrote:
do even the simplest performance testing in a Debug build. Lesson learned
The allocation of memory is monitored in debug builds by the CRT , so it fakes the results ...
Actually ZeroMemory is a macro using the RtlZeroMemory that is also a Macro that uses ...
Cheers,
Joao Vaz
A person who is nice to you, but rude to the waiter, is not a nice person - Natalie Portman (Padme/Amidala of Star Wars)
|
|
|
|
|
Actually ZeroMemory is a macro using the RtlZeroMemory that is also a Macro that uses ...
WTF?????
ZeroMemory sub contracts the work out to RtlZeroMemory? I didn't authorize subcontractors!!!!
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Tim Smith wrote:
ZeroMemory sub contracts the work out to RtlZeroMemory?
And guess what ? The RtlZeroMemory does a simple memset !!!!
#define RtlZeroMemory(Destination,Length) memset((Destination),0,(Length))
Tim Smith wrote:
I didn't authorize subcontractors!!!!
Cheers,
Joao Vaz
A person who is nice to you, but rude to the waiter, is not a nice person - Natalie Portman (Padme/Amidala of Star Wars)
|
|
|
|
|
Duhhhhhhhhhhhhhhh !
#define RtlZeroMemory(Destination,Length) memset((Destination),0,(Length))
Cheers,
Joao Vaz
A person who is nice to you, but rude to the waiter, is not a nice person - Natalie Portman (Padme/Amidala of Star Wars)
|
|
|
|