CpuFree for VS1005 / VSOS

Discussion about writing software for VS1005 and the VSOS Operating System. Also posts about VS1005-related hardware design and device drivers should be posted here.
Post Reply
User avatar
VLSI Staff
Posts: 1201
Joined: Tue 2010-06-22 14:10

CpuFree for VS1005 / VSOS

Post by Henrik » Thu 2019-07-11 10:54


When developing code that has to work in real time, oftern the question arises: how much do I still have free CPU time? Am I close to the limits of the CPU, or do I still have a lot of juice left.

A new driver for VSOS 3.57 or higher, CpuFree, solves that issue. It can report CPU usage at given intervals, and then displays the result. Alternatively, it can analyze multiple time slices and give a summary of the lowest, mean, and highest processor time consumption. Relevenat parts of the README.TXT files is quoted below:

Code: Select all

S:>cpufree -h
Usage: CpuFree [-cx] [-h] [n]
-cx     Report every x'th time (default: 1)
-h      Show this help
x       Gather data at x ms intervals (default: 1000)

Example #1: Collect data for 10 seconds at the time

Add following line to config.txt:

To do the same from the VSOS Shell:
S:>driver +CpuFree 10000

Example output:
10.004s, used 62.55 MHz ( 72.7%), free 23.47 MHz ( 27.3%), tot 86.02 MHz

The example output tells that of a total available amount of 82.06 MHz,
all user programs used on average 62.55 MHz, or 72.7%. So, in this case,
there is slightly over one fourth of CPU time left, on average.

Example #2: Collect data every 100 millisecond, then report every 100th time
(approximately once every 10 seconds):
CPUFREE 100 -c100

To do the same from the VSOS Shell:
S:>driver +CpuFree 100 -c100

Example output:
10.666s n=100: L 61.69u 24.33f; M 62.55u 23.46f; H 72.64u 13.37f; T 86.02 MHz

Just as in Example #1, the output tells that the Mean processing time
requirement during the 10.45 second analysis was 62.55 MHz, leaving on
average 23.76 MHz free of the available 86.02 MHz clock. However, there
is more information on local processor time usage: you get the Lowest and
Highest processor time consumption of the 100 ms slices CpuFree recorded.
The bottom CPU consumption was 61.69 MHz, while the highest was as high as
72.64 MHz. This mode is very useful when testing algorithms that may have
high local processing time requirement peaks like in this example. In more
static code where the signal path is independent on data, the Low and High
numbers are often very close to each other.
I use CpuFree almost daily when developing DSP algorithms. I hope it will be useful for you, too. As always, comments and bug reports are very welcome!

Kind regards,
- Henrik
CpuFre v1.00 as VSIDE Solution
(9.65 KiB) Downloaded 149 times
Good signatures never die. They just fade away.

Post Reply