TIMER0 (located in \TOOLKIT\SAMPLES\OS2\TIMER0) creates four threads. Each thread does the following:

To start the TIMER0 sample from an OS/2 command line, type:

TIMER0

While the four threads are running, the main thread (the one that created the other four) is in an infinite loop.

Note: To break out of the loop, press any key.

This loop displays the values of each of the four counters incremented by the four threads. For example:

TIMER0$ opened.  File Handle is 3
Counter: 00008703  1:00000017 2:00000008 3:00000005 4:00000004

The counter is the value of the millisecond counter in timer TIMER0 device driver. This value gets incremented every millisecond and is very accurate. The other four values are the four counters and these values are incremented by each thread. The accuracy is dependent on the thread contention and other things that are going on in the system. Note that #2 is approximately one-half of #1, #3 is approximately one-third of #1, and #4 is approximately one-fourth of #1.


[Back] [Next]