home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!boulder!alumni.cs.colorado.edu!stasica
- From: stasica@alumni.cs.colorado.edu (The Legacy)
- Subject: System Testing
- Message-ID: <1992Dec21.172506.6739@colorado.edu>
- Sender: news@colorado.edu (The Daily Planet)
- Nntp-Posting-Host: alumni.cs.colorado.edu
- Organization: Damage, Inc.
- References: <gs-310856102441@gs.statlab.uni-heidelberg.de>
- Date: Mon, 21 Dec 1992 17:25:06 GMT
- Lines: 46
-
-
- I'll try this again since no one answered it the first time.
-
- I am trying to test system memory, I/O, and CPU.
-
- Here are some very simple, yet intensive busy work routines I have written.
- Can someone give me an idea if these are valid at all or should I go about
- the algorithm via some other "C" methods:
-
- 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)*/
- free(p);
- }
-
- 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)/2372;
- }
- /* Or should I so some other busywork, as this tests FPU's more than CPU */
- /* But what kind of busy work? just loop for 1 billion times? */
-
- void io_test()
- {
- int i; char c; FILE *tmp;
- tmp=fopen("tmp$$$.tmp","w");
- for (i=0;i<FILECHARS;i++) putc('a',tmp); /* Write chars to a file */
- fclose(tmp);
- tmp=fopen("tmp$$$.tmp","r");
- for (i=0;i<51200;i++) c=getc(tmp); /* Read chars from a file */
- fclose(tmp);
- }
-
- All these tests take a certain amount of time (around 10 secs each on my
- system). Are these all good or is there too much overhead in either "C"
- or basic system architecture to make these busywork tests invalid?
- --
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * "What do you mean I don't get to work on time... got nothing better to do." *
- * "What do you mean I don't pay my bills... why do you think I'm so broke?" *
- * stasica@alumni.cs.Colorado.EDU *
-