Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.017 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'cache': 0.07; 'measure': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:How': 0.10; 'api': 0.11; 'windows': 0.15; 'caching': 0.16; 'confuse': 0.16; 'flush': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:python': 0.16; 'size,': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'bit': 0.19; 'trying': 0.19; 'header:User-Agent:1': 0.23; 'tells': 0.24; 'question': 0.24; 'header:X-Complaints-To:1': 0.27; 'subject:) ': 0.29; "doesn't": 0.30; 'program,': 0.31; 'own,': 0.31; 'file': 0.32; 'run': 0.32; 'subject:time': 0.33; 'could': 0.34; 'subject: (': 0.35; 'something': 0.35; 'test': 0.35; 'but': 0.35; 'there': 0.35; 'really': 0.36; 'disk': 0.36; 'method': 0.36; 'charset:us-ascii': 0.36; 'example,': 0.37; 'performance': 0.37; 'arrange': 0.38; 'to:addr:python-list': 0.38; 'itself': 0.39; 'realize': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'results.': 0.60; 'information,': 0.61; "you're": 0.61; "you'll": 0.62; 'real': 0.63; 'subject:get': 0.81; 'low': 0.83; 'directories,': 0.84; 'milliseconds': 0.84; 'sectors': 0.91; 'thing,': 0.91; 'average': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dave Angel Subject: Re: How to get time (milisecond) of a python IO execution Date: Sun, 15 Sep 2013 11:31:43 +0000 (UTC) References: <8baf5318-f82c-417d-9a1d-956bf9cb3856@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: 174.32.174.29 User-Agent: XPN/1.2.6 (Street Spirit ; Linux) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 31 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1379244724 news.xs4all.nl 15919 [2001:888:2000:d::a6]:35686 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:54187 On 14/9/2013 22:59, Tal Bar-Or wrote: > Hi All > > i am trying to test measure some IO execution in milliseconds , but bit confuse about best method achive that under windows 7 Measuring any performance can be tricky, and I/O in particular. Windows will cache the recently used file information, at a few levels. So if you do the same thing repeatedly, you'll get an unnaturally low average time. if you really need to measure how long it takes to get a file size, you would need to write your own, very controlled, test code. For example, there is an APi call that tells Windows to flush its disk caching logic. However, it doesn't necessarily flush the buffers that the drive itself keeps. Worse, in order to run your program, you have to do some disk I/O, and if that happens to use some of the same sectors as the thing you're timing, you're biasing the results. If you have multiple partitions, you could arrange that the file in question is the only thing your system uses on that partition, to minimize the likelihood that something else has primed the pump. But realize also that once you're measuring the real thing, speed of exeution will vary enormously depending on the speed of the drive, the layout of the directories, and the fragmentation of the disk. -- DaveA