Synopsis:
cttimer [ cycle-count ]There is a only one thread, which decrements a counter on each invocation. When the counter reaches zero, the thread exits, terminating the scheduler. Then the program displays the elapsed time in seconds, and the average time per cycle in microseconds.
The command line parameter, if present, should be a number specifying the number of times that the thread is to run. The program does not validate this parameter at all -- it merely calls atol() to convert the parameter to a long integer. If no such parameter is provided, the thread runs five million times.
This thread is near-minimal. Anything less would fall into an endless loop. Consequently almost all of the elapsed time is attributable to the overhead of the scheduler itself.
Your results will of course vary, depending on your hardware, compiler, compiler options, and other factors. For a given environment, however, cttimer should provide a reasonable estimate of the time consumed by the Cheap Threads scheduler. It may be useful to compare the results with similar estimates for other forms of multithreading.
This estimate is not terribly precise. If you need precision, you may be able to experiment with profiling tools, or with more refined variations of cttimer. For most applications, however, the bulk of the elapsed time should be consumed by the threads themselves, not by the scheduler.