Thursday, August 19, 2010

Dhrystone and Whetstone

Dhrystone and whetstone are open source synthetic benchmark programs. These benchmarks are used in the following cases:
  • to measure and compare the performance of two different processors
  • to measure the performance of compilers for a processor

What is benchmark?

Benchmark is the standard based on which the performance is measured. Benchmarking is the act of measuring the performance of a system against a standard.

Benchmark programs are the set of programs which are used to assess the relative performance of a system. The benchmark programs are written such that they impose a particular type of workload on a system. And provide the metrics on the system performance for the workload imposed.

One way of writing the benchmark program is to first take the statistics of all the operations from various application program. Then, get the proportion of each operation and write the program based on the derived proportion. Thus created benchmark programs are called synthetic benchmark programs.


Dhrystone:

Dhrystone is the indicator of integer arithmetic performance. It stresses the ALU. Dhrystone doesn't contain any floating point operations. The name dhrystone is a pun on the name of another benchmark program "whetstone" (which is for floating point operations).

Dhrystone measures the performance in "Dhrystone per second". "Dhrystone per second" implies the number of times the program can run in a second.

Dhrystone doesn't provide the result in number of instructions per second. There is reason. Assume a task say 'x'. In a RISC machine, to accomplish this tasks it requires 2 instructions. Whereas the CISC machine requires 1 instruction. But the task 'x' is done faster in RISC machine than the CISC machine. So, here the performance measure in instruction count fails. Hence dhrystone performs the calculation in a machine specific way (of counting the number of program completion per second).

The main drawback of dhrystone is in most cases it is not the representation of the real-life programs. Also Dr. Reinhold Weicker who created Dhrystone says that “Although the Dhrystone benchmark that I published in 1984 was useful at the time, it cannot claim to be useful for modern workloads and CPUs because it is so short, it fits in on‐chip caches, and fails to stress the memory system. Also, because it is so short and does not read from an input file, special compiler optimizations can benefit Dhrystone performance more than normal program performance.”



Whetstone:

Whetstone is the indicator of floating point arithmetic performance. It stresses the FPU. Whetstone measures the performance in MWIPS (Million Whetstone Instructions Per Second). Whetstone is named after the town Whetstone in England where it was designed.

Whetstone mostly contains the floating point data and operations. In general, whetstone can be defined as the mix of operations that are typically performed in scientific applications.

The drawback of whetstone is, it doesn't show-up the advantages of architectures such as RISC. This is because, most of the variables in whetstone are global. Whereas, the large amount of processor registers that are available with RISC architectures would get exploited only for handling the local variables.


References:
http://en.wikipedia.org/wiki/Dhrystone
http://www.johnloomis.org/NiosII/dhrystone/ECLDhrystoneWhitePaper.pdf
http://dhrystone-benchmark.downloadaces.com/
http://www.dell.com/downloads/global/products/pedge/en/guide_to_server_benchmarks.pdf
http://www.keil.com/benchmarks/whetstone.asp
http://www.cse.dmu.ac.uk/~bb/Teaching/ComputerSystems/SystemBenchmarks/BenchMarks.html#whetstone
http://homepage.virgin.net/roy.longbottom/whetstone.htm
http://homepage.virgin.net/roy.longbottom/whetstone.pdf

Wednesday, August 18, 2010

My first usage of GTK!

Today I used the GTK for the first time. So what is GTK? GTK expands to GIMP ToolKit. GTK is the library to build graphical user interfaces. It is called GIMP ToolKit because, originally it was developed for the program GIMP (GNU Image Manipulation Program). Now many programs are using it.

I installed GTK in my ubuntu-9.10 desktop. With build essentials already with my system, I issued the following command at the terminal to install GTK+-2.0:

sudo apt-get install libgtk2.0-dev libgtk2.0-doc devhelp

libgtk2.0-dev installs the GTK library. libgtk2.0-doc and devhelp installs the documents of GTK and the browser for the documents respectively.

I wrote a simple hello world program. The program was written to create a window with a button on it. The button would have the label "Hello, World! Bye...". And once the button is clicked, the application would quit.

Download: helloworld_gtk.c

Compiled the hello world program and built the executable for the same by issuing the following command at the terminal:

gcc helloworld_gtk.c -o helloworld `pkg-config --cflags --libs gtk+-2.0`

Here,
  1. pkg-config is the program that reads the .pc which comes with GTK to determine what compiler switches are needed to compile programs that use GTK.
  2. pkg-config --cflags gtk+-2.0 will output a list of include directories for the compiler to look in
  3. pkg-config --libs gtk+-2.0 will output the list of libraries for the compiler to link with and the directories to find them in.