This sample displays instance names, process identifiers, CPU-time as a percentage, high and low thresholds of the CPU-time, and the process priorities of instances of Microsoft® SQL Server™ 2000 running on the local computer. The sample also manages process priorities and gives users the option of setting them manually.
You must install Microsoft Platform Software Development Kit (SDK) to compile and run this sample.
C:\Program Files\Microsoft SQL Server\80\Tools\Devtools\Samples\Utils\pbalance
The sample extracts the CPU real time (the percentage) consumed by each running instance once in every fixed time interval. The default value of this time interval is 5 seconds. Users have the option to set this time interval to a different value. If the CPU-time consumed by a running instance is higher than the high threshold or lower than the low threshold, the application then lowers or raises the process priority by one level. If the priority is already at the top or bottom level and cannot be lowered or raised, the priority will then remain the same. Users also have the option to set the high and low thresholds.