CPU Speed

[Home]   [Puzzles & Projects]    [Delphi Techniques]   [Math topics]   [Library]   [Utilities]

 

 

Search

Search WWW

Search DelphiForFun.org

As of October, 2016, Embarcadero is offering a free release of Delphi (Delphi 10.1 Berlin Starter Edition ).     There are a few restrictions, but it is a welcome step toward making more programmers aware of the joys of Delphi.  They do say "Offer may be withdrawn at any time", so don't delay if you want to check it out.  Please use the feedback link to let me know if the link stops working.

 

Support DFF - Shop

 If you shop at Amazon anyway,  consider using this link. 

     

We receive a few cents from each purchase.  Thanks

 


Support DFF - Donate

 If you benefit from the website,  in terms of knowledge, entertainment value, or something otherwise useful, consider making a donation via PayPal  to help defray the costs.  (No PayPal account necessary to donate via credit card.)  Transaction is secure.

Mensa® Daily Puzzlers

For over 15 years Mensa Page-A-Day calendars have provided several puzzles a year for my programming pleasure.  Coding "solvers" is most fun, but many programs also allow user solving, convenient for "fill in the blanks" type.  Below are Amazon  links to the two most recent years.

Mensa® 365 Puzzlers  Calendar 2017

Mensa® 365 Puzzlers Calendar 2018

(Hint: If you can wait, current year calendars are usually on sale in January.)

Contact

Feedback:  Send an e-mail with your comments about this program (or anything else).

Search DelphiForFun.org only

 

 

 

 

Here's a clever little program that will report CPU speed in Mhz (megahertz - millions of instruction cycles per second).   I found it in the Delphi section of experts-exchange.com (search for rdtsc),  where it was proposed to resolve a problem of code running slowly on a client's machine.  The problem identified in this case was Intel's "SpeedStep" feature for recent mobile processor models  which, on some operating systems (e.g.  XP), slows the processor to conserve power  when operating on batteries.   CPUSpeed showed that the processor was only running at 10% of its rated speed!  Disabling the feature, resolved the problem.

 

The program uses the ReadTimeStampCounter  (rdtsc) machine instruction to get cycle counter values before and after a 1/2 second delay and subtracting to get the number of instruction cycles during that half-second.   An Intel paper available at  http://cedar.intel.com/software/idap/media/pdf/rdtscpm1.pdf   describes the considerations for using rdtsc.  The calculation is almost self defining:  cycles per second = cycles / seconds, or, as reported,   millions of cycles per second = cycles / microseconds.   The programs sets priorities to high values before performing the calculation and restores them after to increase the accuracy of the timing.   I've tried it on four computers here and results match  CPU specs.    

 

Cool example of using inline assembler instructions  and running a windows program with no form  (even if you probably won't really need it very often). 

 

October 24, 2016:  A kind viewer let me know today that the executable version of CPUSpeed is being flagged as a virus or malware by some security checking software, including Windows Defender on my W10 system.  It is a false positive but not worth trying to get the diagnosis changed. 

  

I'm removing the executable download, but leaving the source download.  Delphi users can download the source and run it locally with no errors.    Zipping the recompiled version locally and  running it from there produces a message from Windows "SmartScreen" warning that an unrecognized program is trying to run but it runs fine anyway.   Increased security rarely makes everyday operations easier,  but is the price we pay to avoid the catastrophic.   

 

Download Source

Download Executable

 

Created: February 5, 2003

Modified: May 11, 2018

 
  [Feedback]   [Newsletters (subscribe/view)] [About me]
Copyright © 2000-2018, Gary Darby    All rights reserved.