|
I have an application that has been brought out of mothballs, and am trying to determine the root of an obvious difference in performance between running on a Win2K machine and running on a WinXP machine.
Originally, the application would crash sporadically on a Windows XP machine. The application had been compiled many moons ago, so I set up VStudio 6 on a Windows XP machine, and recompiled the source code. Now the application will run on either Windows 2000 or Windows XP, but exhibits a definite performance decrease on a Windows XP machine.
The source code is not mine, so I don't know it intimately, and it has been many moons since I coded in Visual C++. But I have been able to recall enough to debug into it some. The UI is a thin layer on top of a calculation engine written in (from what I can tell) very generic C/C++ code. In other words, file I/O operations are done using fopen, fprintf, etc. The main calculation loop has 4 main steps, and it loops for every day of a given year. I placed local variables to track average tick count for each of these steps, and can see that one of these steps takes significantly longer than the rest. But again, diving into this function, all I see is standard C/C++ code.
My basic question is, are there any known performance differences when using C/C++ code on these two platforms. Does calloc perform awful on WinXP for some reason unless a particular compiler option is set? Does qsort perform fine on Win2Kbut awful on WinXP? Everything in my experience tells me, there should be no difference. So I think I'm looking for a needle in a haystack. Has anyone come across anything similar?
Any suggestions are greatly appreciated...
Cheers,
Carl
|
|
|
|
|
Do you have VS6 installed on both platforms? If so, you could use the profiler to find the bottleneck.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
David,
Thanks for the response. I don't have a profiler on both platforms, but do on a development XP system. I had some time the other day, and tried to get some decent info out. Unfortunately, I'll need to find more time to put to it, my quick attempt at profiling did not yield much useful information. But thank you for pointing me in that direction. I don't think I'd ever used the profiling tools provided with VStudio, though I have used things like BoundsChecker and RedGate ANTS Profiler, so I get the general concepts.
Thanks again for the suggestion. If you know any parituclarly good tutorials on using PREP and PROFILE, I'd appreciate it. Otherwise, I'll research and see what I can find...
Cheers,
Carl
|
|
|
|
|
Hi,
My sample dlg application having two buttons alloc and free. intially application size on memory is 2.5 mb. after allocating memory arround 100k the application size of memory is increased to 2.6 mb. now try to free the allocated memory after freeing the memory application is same as 2.6 mb.in the sample ok. but some huge amount of memory allocation and free and once allocation having problem. how to solve?
Thanks in Advance!
Have A Nice Day!
Murali.M
|
|
|
|
|
Post the code from your alloc and free functions so that we can take a look and help.
regards,
|
|
|
|
|
You seem to be confused on how the memory manager works. Just because you free 100KB of memory does not mean your address space (that number that folks look at via Task Manager) will suddenly shrink by 100KB. Those bytes are available for future allocation, but they still remain in your process' address space.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
If you are using XP or greater you can use SetProcessWorkingSetSize to attempt to reduce pages in physical RAM. http://msdn2.microsoft.com/en-us/library/ms686234.aspx[^]
SetProcessWorkingSetSize(GetCurrentProcess(), -1, -1);
This is generally not recommended for most applications... the NT memory manager does a decent job. Your applications performance can suffer greatly if this function is abused.
Best Wishes,
-Randor (David Delaune)
|
|
|
|
|
hi i am having a list control in my dialog to list all the files and folders of drive. how to list subitems and open the file types. pls help me im new to this. i need some guidance
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
deeps_cute wrote: how to list subitems and open the file types.
Please explain.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
i have to list files similar to windows explorer in my dialog.
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
For finding files, if you are using MFC, check out the CFileFind class.
Do you know how to add items to a list control?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi all,
Does anyone know of a good article on capturing images whilst using a digital camera using VC++ or even C#?
Many Thanks
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
dont know any articles but these might help some code in c++ and
c#
good luck
|
|
|
|
|
I am using _UNICODE as a directive but want my code to compile without errors without _UNICODE.
Can anyone tell me is there any way to switch between functions same way i do for strings
#ifdef _UNICODE
typedef wchar_t TCHAR;
#define __T(x) L ## x
#else
typedef char TCHAR;
#define __T(x) x
#endif
can i do something same for wcscpy and _tcslen functions.
I am using wcscpy in wchar and strcpy for const char*
|
|
|
|
|
You can use _tcscpy which will be either strcpy or wcscpy , depending on _UNICODE .
|
|
|
|
|
As Rage mentioned....all the CRT string functions have a generic equivelant.
Here's a handy chart: Routine Mappings[^]
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
I am extremely sorry if this is not the correct forum to post this question.
Conditional break point on CString object is not working, while i have checked that with int datatype and it was working fine, and evaluating the condition correctly.
Best Regards,
Mushq
Mushtaque Ahmed Nizamani
Software Engineer
Ultimus Pakistan
"English is my second language; please excuse any grammatical or spelling mistakes"
|
|
|
|
|
Possibly it's evaluating the address of the CString which likely isn't changing. I suggest putting the breakpoint in the CString code itself if you want to catch a CString changing. You could even make that breakpoint conditional on the internal buffer contents to get straight to the one you want. CString itself is a wrapper around a character buffer which is where the change is that it looks like you want to catch.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Hello everybody,
I am a beginner in programming c++. I have to do a programm that compare a model file to another file (txt files), and if the beginnings of the files are the same, then i have to rename the file compared. This programme works, but i have to compare more than one file with the model file. Therefore i have copied and pasted the following programme several times in the programme:
a=0;<br />
vadves.open("vadves.txt",ios::in);<br />
fstream fichier10;<br />
fichier10.open("ICET0R.WZT.MXS.G0900V00.G2307215",ios::in);<br />
for (i=1;i<=55;i=i+1) {<br />
vadves>>c;<br />
fichier10>>c;<br />
}<br />
while(a==0) {<br />
vadves>>c;<br />
fichier10>>t;<br />
if (c==t&&!fichier10.eof()) {<br />
a=0;
} else { if (vadves.eof()) {
a=2; <br />
} else { a=1;<br />
}<br />
} <br />
<br />
}<br />
vadves.close();<br />
fichier10.close();<br />
if (a==1) {<br />
cout<<"fichier10 is not vadves";<br />
}<br />
if (a==2) {<br />
cout<<"fichier10 is vadves";<br />
rename("ICET0R.WZT.MXS.G0900V00.G2307215", ostr.str().c_str());<br />
}
But i have conclude that once the file model (vadves.txt) has been read i can´t re-read it, even if i close and open the flow vadves.
Therefore, i thought about keeping open the flow vadves and rewinding it. But i don´t know how to use the command rewind, i also heard about fstream command...
Moreover, the file to compar has a name which change every day but always begin with "ICETOR". So is there a command or a programme that could find and associate their name to a value that i could use in my programme? The best command would translate: "for every file beginning whose name begin with ICETOR do ..."
I would be very thankful if somebody could help me
It has been 3 days that i am on this programme... and i am starting to be fed up with it ...
Deep thanks
Guillaume
|
|
|
|
|
What you can do is read the header of the reference file once for all, and then open the other files and compare them against this header reference. You do not need to get rid of your reference stream everytime.
For finding the files, you could use CFileFind::FindFile and CFindFile::FindNextFile.
|
|
|
|
|
Ok, thank you very much.
I am going to try this!
Hope it will work!
|
|
|
|
|
It seems that to use the function CFileFind::FindFile i must have afxwin.h . Unfortunately i don´t have that. Do you know where i can find it?
Moreover concerning the command CFileFind::FindFile , for what i have understood, it could suits my programme to find files. But i don´t understand what kind of type it returns. Could you explain me? (i only have like 30hours of programmation )
Thank you very much!
|
|
|
|
|
|
Don't worry about CFileFind . It's an MFC class which you don't need to be bothered with at the moment. Focus on how to solve the problem first, then you can worry about what tool you want to use. Using simple C++ code will be more than enough.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|