home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!ccut!news.u-tokyo.ac.jp!yayoi!tansei1!mhiroshi
- From: mhiroshi@tansei.cc.u-tokyo.ac.jp (H. Murakami)
- Newsgroups: fj.os.386bsd
- Subject: A Disk I/O transfer rate measurement program.
- Message-ID: <3979@tansei1.tansei.cc.u-tokyo.ac.jp>
- Date: 24 Jan 93 00:13:38 GMT
- Sender: news@tansei.cc.u-tokyo.ac.jp
- Distribution: fj
- Organization: Hokkaido Univ. However I am subject to tansei for JUNET.
- Lines: 66
-
- To: fj.os.386bsd
- Subject: Disk I/O transfer rate measurement program.
-
- /****************************************************
- * *
- * Disk I/O transfer rate measurement test *
- * by sequentially reading the raw device disk. *
- * *
- * NOTE: No write to disk is attempted. *
- * *
- * Usage: modify the definition of DEVICE below *
- * suitably for your environment. *
- * Then compile and run on the non-busy machine. *
- * *
- ***************************************************/
-
- #define DEVICE "/dev/rwd0c" /* Raw device to be tested. */
-
-
-
- #include <stdio.h>
- #include <sys/file.h>
- #include <sys/types.h>
- #include <sys/times.h>
-
- #define NB (512*200)
- static char buf[NB];
-
- #define AHZ 60 /* different system may be different. */
- #define MEGA (1024*1024)
-
-
- main()
- {
- int d, nbytes, nread;
- clock_t t1, t2;
- double t;
- static struct tms tm1, tm2;
- int nsect, size;
- int from=10, step=10, until=100; /* modify as you like.*/
-
- for (nsect=from; nsect<=until; nsect+=step) {
-
- size = 512 * nsect;
- nread = 0;
- if ((d=open(DEVICE, O_RDONLY, 0444)) <= 0) {
- fprintf(stderr, "Error at open.\n");
- exit(1); }
- if (size > NB) {
- fprintf(stderr, "Program error. size > NB.\n");
- exit(1); }
- t1 = times(&tm1);
- while (1) {
- nbytes = read(d, buf, size);
- if (nbytes <= 0) break;
- nread += nbytes;
- }
- t2 = times(&tm2);
- t = (double) (t2 - t1) / AHZ;
- printf("Device: %s\n", DEVICE);
- printf("%3u: %6.2lf MB read. %6.2lf Sec. %6.2lf MB/Sec.\n",
- nsect, (double) nread / MEGA, t, nread / t / MEGA);
- close(d);
- }
- }
- /* THE END. */
-