From: Ed Leiby Newsgroups: comp.os.msdos.djgpp Subject: Re: Intermittent Run-Time of DJGPP App under Win95 Date: 30 Nov 1997 21:18:07 GMT Organization: Frontier Internet Rochester N.Y. (716)-777-SURF Lines: 39 Message-ID: <3481D7AC.44FD@frontiernet.net> References: <347C6732 DOT 718B AT frontiernet DOT net> Reply-To: eiby AT frontiernet DOT net NNTP-Posting-Host: srv-7-34.roc.ny.frontiernet.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Ed Leiby wrote: > I tried the -pg/gprof angle and was able to identify where a general > purpose floating pt. complex correlation routine was showing a total > ms/call of 0.04 ( slow case ) compared to 5.11 total us/call. Assuming > ms=milliseconds and us =microseconds this is a ~8:1 delta. This routine > is simple and seems to give the same results whether its running slow or > fast. > > I was wondering whether or not alignment might not be a factor in this. > Is there anything that win95 could do at run-time to change the > alignment of float data? If so, what is the difference in machine cycles > between a float access for a "good" alignment and a "bad" alignment? > Would this affect both reads/fetches and writes? If a misaligned access > is cached, is there a subsequent cycle hit on all further fetches? > > Sorry for all the questions, hope they're close enough to topic. I also > hope somebody will answer them. > I am now fairly sure that alignment has something to do with the slowdowns I have been seeing. I went into the above-mentioned correlation routine and got the "address" ( with & operator ) of some local variables and printed them out to screen ( after being cast to int ). Every time that the app was in slow mode, the local variables were not aligned on 4 byte boundaries. Everytime the app was moving fast, these local vars were aligned on 4 byte boundaries. When I went into the correlation routine and made the offending dynamic vars static, the app started running faster and with no intermittencies. The local variables are actually two float structures used for the complex ( real, imaginary ) correlation. I tried using __attribute__ ((aligned(4)) on the structure definition, but it did not change things. Is it possible under non-error conditions for a dynamically allocated structure to be mis-aligned, or is the SP possible scrogged ? Thanks in advance Ed Leiby