home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!usc!srhqla!quest!kdq
- From: kdq@quest.UUCP (Kevin D. Quitt)
- Newsgroups: comp.lang.c
- Subject: Re: System Testing
- Message-ID: <LZP8VB2w165w@quest.UUCP>
- Date: Tue, 22 Dec 92 17:58:08 PST
- References: <1992Dec21.172506.6739@colorado.edu>
- Reply-To: srhqla!quest!kdq
- Organization: Job quest (805) 251-8210, So Cal: (800) 400-8210
- Lines: 39
-
- stasica@alumni.cs.colorado.edu (The Legacy) writes:
- >
- > void memory_test()
- > {
- > int *p, i;
- > p=malloc(8388608); /* Malloc 8M memory */
- > for (i=0;i<8388600;i++) /* Write to all 8M 1 char at a time */
- > *(p+i)='\0'; /* BTW this doesn't work....why??? (memory violation)*/
-
- Perhaps because p is a null pointer? You should always check the
- return from malloc.
-
- > void cpu_test()
- > {
- > int i; double d;
- > for (i=0;i<30000000;i++) /* Do a bunch of calculations */
- > d=(23423423+2394823/234763287*3276472364/2347632+23876322-123123)/237
-
- Any compiler worth its salt will reduce this loop to no code at
- all. It you're going to do this, try something like d += (double)i++;
- Of course, a REALLY clever compiler could replace that with
-
- d = 30000000 * 30000001 / 2;
-
- and then just generate the single assignment, or drop it altogether.
-
-
- If you want to benchmark your system, you should examine some of
- the standard benchmark programs, like whetstone and dhrystone to see
- what they do to overcome compiler cleverness. Also important to
- remember is that benchmarks are of little meaning if the computers are
- significantly different in architecture; even comparing between 68000s
- and 68020s can lead to some bogus results (with the 68000 coming in
- ahead!). If you can't find anything you like at simtel, send me a
- note and I'll ship you my collection.
-
-
- _
- Kevin D. Quitt 96.37% of all statistics are made up. srhqla!quest!kdq
-