Newsgroups: comp.os.msdos.djgpp Subject: Re: large variation in run-time Message-ID: <3551724B.8ADC8D55@CPRO.DLO.NL> From: Johan van Ooijen Date: Thu, 07 May 1998 09:35:23 +0100 Reply-To: J DOT W DOT vanOOIJEN AT CPRO DOT DLO DOT NL References: <354DAFD3 DOT 8D277F06 AT CPRO DOT DLO DOT NL> <6iktlt$4j1 AT argo DOT telecom DOT cz> Organization: CPRO-DLO NNTP-Posting-Host: 10.194.2.147 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 58 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Radar wrote: > > >duration of 10^6 runs. For instance, two sessions I predict to take 34 > >and 68 hours, respectively (one should be exactly twice as long as the > >other), and they took 10 and 43 hours. It is fine that the sessions take > >shorter, but it is strange that the second is not even close to taking > >twice as long as the other. So this leaves me with the uncertain feeling > >of the correctness of the results, although they appear to be what I > >expect. > > Which function do you use for timing ? I had some strange problems with one > called PCTIMER13. Now I use standard uclock and it looks OK. > Because run-time takes hours, I simply get the time and date: FILE *out; time_t time; struct tm *tblock; for (...millions...) { timer= time(NULL); tblock= localtime(&timer); fprintf(out,"%s",asctime(tblock); .... } > >whatsoever. The program uses little memory, it does millions of > >malloc()'s and free()'s, but total used memory doesn't grow (so that is > >OK) and there is no swapping activity. > > Are you sure that the program doesn't swap to disk ? As I know (but I am not > an expert) there is trouble to have certainty that you allocate physical > memory and not only virtual and swap to disk. Your problem could be caused > be fragmentation of memory and then swapping to disk in the larger > simulation (??). In protected mode you do not know when you call > malloc(1000) how much it really allocates, only that it is at least 1000. I > haven't found any way how to get to know if program swaps to disk inside my > program. All memory that is allocated before the iterations is something fixed between 50 and 100 Kbytes. The millions of malloc()'s and free()'s concern only less than 1 Kb. I don't see any swapping activity, and I don't think that swapping is necessary with this amount of memory on a 32 Mbytes machine; as said "go32" (yes the older version 1.12, used with gcc 2.6.0) reports megabytes of free memory. > I use CWSDPMI server, so I would try run it only with physical memory (there > is some switch, -s- I think ), disable all swapping and if the program > doesnt die on short memory, I would be sure that program doesn't swap. > > I work on similar problem, but smaller simulation and measure time so If you > find something about this problem I would appreciate If you could share your > experience with GCC & GO32 & simulation. > > Paul > p_radar AT hotmail DOT com