C # Store processor in / around specified utilization percentage for testing purposes

I am currently working on a small internal testing application to create several types of computer load so that we can see how our software works under load. I get a hang on one request, since I am making a way to indicate the percentage of processor usage (say, 40%) before the user starts the program, and, I hope, will keep the processor in the range of + - 10% of what they invested. I was told that they had seen programs before, but everything that I saw, which claimed to be so, did not work. I am trying to read average usage and the sleep thread works so that the CPU load is reduced, but I found that this is not accurate. It will also be used on several servers, each of which has different processors, so I can not do very hard coding,since it should work on every server. I personally do not think that it can be done exactly, but I ask here, as a last effort, to see if other software like this is similar to someone, and knows how it will be written.

Edit: I tried using a thread with a lower priority, and was also told that it would not be useful to them (although I had an option created just for testing purposes, before it was requested by me).

+5
source share
2 answers

We did something similar again by setting up the application server. We found that our overall throughput was better when the processor was around 70%. Our solution was to deploy additional threads with a delay between them until the desired load is reached. If the CPU exceeded 80%, we reduced the number of running threads (we signaled the thread to complete its current work and then stop). If the CPU dropped below 60%, we started a new thread.

, . CPU -CPU (IO, ), . CPU, 1 ​​ 100%.

+3

Windows 8 Windows Jobs.

+2

All Articles