Stress test of a visual studio with a multi-core processor

how can I set up a visual studio test project to use the entire processor core.

When I run the test, I can see on my performance indicator that only one core is used (100%), and the remaining 7 cores are not used.

I have a load test inside the test project that calls the Unitary test.

I set 200 users to call one method. But I need to use all the cores.

+4
source share
4 answers

Dennis, according to MSDN :

"Adding a Visual Studio Virtual User Pack 2010 boot test to a non-standard controller script has the added benefit of unlocking all the machine processors to use. Without the Visual Virtual Virtual Pack 2010 2010 boot test test, your local computer can only use the first processor . After you add Visual Virtual Load Load Virtual User Pack 2010, load tests can use all processors on the machine when they start. "

Thus, it is not possible to unlock additional kernels if you do not have a license for the user package.

+5
source

See accepted answer here . Summary. To do this, you need the Visual Studio Team test system boot agent.

+2
source

Most likely, your test code is single-threaded. Unit tests are run sequentially, so if the code in each test is multi-threaded, it will work in only one thread.

Make sure that running tests in multiple threads can have adverse effects, unit tests should only test the device, and if it is multithreading, then the test should be single-threaded.

-1
source

You need to do the work in multiple threads. Try the following:

class Program { static bool isRunning = true; static void Main(string[] args) { BackgroundWorker bw1 = new BackgroundWorker(); BackgroundWorker bw2 = new BackgroundWorker(); bw1.DoWork += delegate(object sender, DoWorkEventArgs e) { while (isRunning) { } }; bw2.DoWork += delegate(object sender, DoWorkEventArgs e) { while (isRunning) { } }; bw1.RunWorkerAsync(); bw2.RunWorkerAsync(); Console.ReadLine(); isRunning = false; } } 

You can increase the number of background workers depending on how many cores you have (this example extends my dual-core computer). You can put your code after running workers, and then stop them by changing the isRunning value.

-1
source

Source: https://habr.com/ru/post/1309017/


All Articles