Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Sun, 15 Jul 2001 12:24:41 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Sun, 15 Jul 2001 12:24:32 -0400 Received: from weta.f00f.org ([203.167.249.89]:11396 "HELO weta.f00f.org") by vger.kernel.org with SMTP id ; Sun, 15 Jul 2001 12:24:22 -0400 Date: Mon, 16 Jul 2001 04:24:26 +1200 From: Chris Wedgwood To: Alan Cox Cc: Daniel Phillips , Andrew Morton , Andreas Dilger , "Albert D. Cahalan" , Ben LaHaise , Ragnar Kjxrstad , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, mike@bigstorage.com, kevin@bigstorage.com, linux-lvm@sistina.com Subject: Re: [PATCH] 64 bit scsi read/write Message-ID: <20010716042426.D10713@weta.f00f.org> In-Reply-To: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="dc+cDN39EJAMEtIO" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.3.18i X-No-Archive: Yes Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org --dc+cDN39EJAMEtIO Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sun, Jul 15, 2001 at 04:32:59PM +0100, Alan Cox wrote: Another way is to time write block write barrier write same block write barrier repeat If the write barrier is working you should be able to measure the drive rpm 8) OK, I just wrote this in order to test just that, test on a raw device and turn caching off if you can. For my drives, I cannot disable caching (I don't know if it is on or not) and I get abysmal speed, but nothing unrealistic, Anyhow, I just wrote this and tested it a couple of times, if it breaks or east your disk, don't bitch at me. Otherwise, flames and comments on my god awful code welcome. --cw --dc+cDN39EJAMEtIO Content-Type: text/x-csrc; charset=us-ascii Content-Description: More of Blondie's awful code Content-Disposition: attachment; filename="write-bench.c" /* * write-bench.c * * test write-performance to a device for n loops, designed for * testing to a raw device where the underlying physical device has * caching turned off * * cw@f00f.org --- Mon Jul 16 04:21:12 NZST 2001 * * USE AT YOUR OWN RISK! NO WARRANTY GIVEN OR IMPLIED */ #include #include #include #include #include #include #include /* #include */ /* XXX edit for your CPU */ const float MHz = 860.947 * 1000 * 1000; /* some kind of 64-bit tsc is required */ #ifdef __i386__ #define rdtsc(low,high) \ __asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high)) #else /* __i386__ */ #error "Please define rdtsc(low32,high32) for your architecture" #endif /* __i386__ */ int main(int argc,char *argv[]) { const int secsize = 512; int f, i, loops; char *buf; double sum = 0.0, sumsq = 0.0, duration; union jack { unsigned int l[2]; unsigned long long v; }before_io, after_io; if(argc != 3){ fprintf(stderr,"please supply two arguments; " "the device and the number of loops\n"); return 2; } loops = atoi(argv[2]); if(!(buf = malloc(secsize))){ perror("malloc"); return 1; } if(((long)buf) % secsize){ free(buf); if(!(buf = malloc(secsize*2 - 1))){ perror("malloc"); return 1; } (long)buf = ((long)buf + secsize - 1) & ~(secsize - 1); } /* memfill(buf, secsize, "wibble", 6); */ memset(buf, 'r', secsize); if(-1 == (f = open(argv[1], O_RDWR))){ perror("open"); return 1; } rdtsc(before_io.l[0],before_io.l[1]); for(i=0;i