Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!ima!johnl From: johnl@ima.UUCP Newsgroups: comp.compilers Subject: Re: Static analysis of code for "flop counting"? Message-ID: <559@ima.UUCP> Date: Sat, 25-Apr-87 23:17:41 EDT Article-I.D.: ima.559 Posted: Sat Apr 25 23:17:41 1987 Date-Received: Wed, 29-Apr-87 06:28:56 EDT Sender: johnl@ima.UUCP Organization: U. of Waterloo, Ontario Lines: 26 Approved: compilers@ima.UUCP In-Reply-To: <1299@ames.UUCP> Cc: In article <1299@ames.UUCP> you write: [How can I count the number of floating point operations in a program in the absence of a helpful compiler?] You can also use a software monitor that does this. Frequently, the debug package for a machine will already do this. If not any machine level debugger with a step 1 instruction capability is a good starting point. On the Honeywell DPS-8, 88, 99 machines, this is in the debugger. Many mini and micro computers (68000 and PDP-11) have a hardware "trace mode" that makes writing such a program staight forward. The only problem with this, is that the program will be slow when running. However, usually when one is collecting statistics about such things the factor of 20-100 speed loss is not a problem. [A similar possibility is to write your own trace package that interprets the machine code. Interpreting the machine's own code is fairly easy since for most instructions you can just stick them in memory and execute them; you only need to fake things like branches. Then you can collect any statistics you want. It's an order of magnitude slower than running the program native, but you get 100% accurate numbers. -John] -- Send compilers articles to ima!compilers or, in a pinch, to Levine@YALE.ARPA Plausible paths are { ihnp4 | decvax | cbosgd | harvard | yale | cca}!ima Please send responses to the originator of the message -- I cannot forward mail accidentally sent back to compilers. Meta-mail to ima!compilers-request