The CPU load metering explained

The CPU load metering explained

No Comments

Since modern computers have gone Multi/hyper-threaded with multicore CPUs, it has become rather complicated to measure CPU load of your software. In the case of Flowstone we have two ways of observing CPU load – the internal CPU meter (shown in bottom right corner when soundcard output is active) and the Windows Task Manager. Now here’s the question most of you probably asked while trying to measure CPU load: “They both show different values, so which one is more relevant?”

The answer is obviously not that straightforward. First you have to understand what the meter is actually showing and why. For practical reasons all modern computers have multitasking ability – thanks to that you may listen to music, render a video and read this article in your browser at the same time. The multitasking is managed by your operating system which may switch between different “threads” and distribute their execution in time and between your CPU cores. It does this by providing your running applications with certain amount of CPU cycles per time unit they are allowed to use. If your application uses less CPU at that given time the excess may be used by other apps. If an app uses all its CPU resources it is paused and must wait for another “CPU cycles delivery” and other apps are executed meanwhile.

The Windows Task Manager shows the REAL CPU load of a process – the % of all of your computer power. The meter in FS shows the % used by the streams from the maximum provided by your operating system. Because Flowsone is never given all CPU power of your computer (That would be impossible because Windows uses on its own) the FS internal meter will always show higher values than the Task Manager. To make things clear, FS meter shows only the streams CPU usage (which this article is mostly concerned about), but Task manager also displays CPU used by green, view redraw and ruby calculations – they may cause Task manager to occasionally (or always in case of streamless and stream-poor schematics) show higher values than FS internal meter.

I apologize for using Slovak on the images, still it shouldn’t be a problem .The relevant keywords like “Procesor” or “priorita” should be self-explanatory even without a dictionary, I believe.

CPU meters 1

So which one is more relevant? It depends on what “relevant” means in your case – Task Manager shows how much CPU cycles your App really uses, while FS internal meter indicates how much headroom you have, before you experience dropouts and crackles in your stream data. Flowstone streams run all on a single thread. One thread can be executed by a one single core only. For example my machine has dual-core hyper-threaded CPU (which practically means it behaves like 4-core CPU). When I push my stream calculations in FS to overload (that the internal meter shows 100%) the Task Manager shows that FS uses 25%. Why? Because FS runs only on a single core ( =1/4 of overall potential of my machine).

CPU meter 2

 

The provided CPU ceiling for your app depends on 4 things:

1. The amount of CPU cycles it uses and is expected to use

2. Core affinity setting (on which cores is the app allowed to run – on all by default)

3. Priority setting

4. CPU load of other apps

To show these effects we must arrange a slightly more complicated example. Open the same CPU heavy schematic in two instances of Flowstone (so that it shows in two windows and runs in parallel). A good one to use is the Code Speed tester. Push both schematics so that they use at least 40% CPU (on the internal FS meter). Now open Task Manager and you can see they both use about the same CPU. Now right click the process and change the affinity, so that the app is forced to run on a single core. Do this with both Flowstone instances, so that they are forced to run on the same core.

affinity

This will force your operating system to prioritize between the two Flowstones, rather than throwing them on different cores and calling it a day.

Now when you change the priority (You will be warned that it may cause system instability, but it will be OK – I promise! ) on one of the Flowstone apps you will see magic – The CPU load meters in the two Flowstones will show different values (try increasing or decreasing the CPU load of the code if you don’t see the effect), although they use the same code and same CPU (as indicated by the task manager). This happens because the CPU ceiling of that FS instance is set based on their relative priority.priority

Now close the Flowstone that shows lower values on FS CPU meter (has higher priority setting) and observe how the CPU meter on the second FS drops down. This happens because now more CPU space is available even for lower priority processes.

 

As you can see measuring CPU load can be quite tricky, since many variables are involved. For more consistent results on FS internal CPU meter you may:

1. Close all other unnecessary apps

2. Increase priority of Flowstone

3. Set affinity to single core

4. Setting your processor/power consumption to high-performance mode

The same practice may be used for measuring CPU load of any application including DAWs and computer games.

0 0 0 0 0
kohugaly

About the author:

Hello Synthmakers and Flowstoners! I'm 22 years old pharmacy student. You may know me form the FS and SM forums as KG_is_back. I'm using Flowstone since the times It was Synthmaker2. Whenever I'm not fiddling on a double-bass in some caves I'm lurking on the Flowstone forum ready to help if I can.

Add Comment Register



Leave a comment

You must be logged in to post a comment.

Back to Top