Hello,
I wonder about the CPU load measurements in SYS/BIOS on an AM3359. I have a 10 microseconds DMTimer triggered HWI, and I call the BIOS load functions in a 1 ms clock module triggered SWI, the code is
#include <ti/sysbios/utils/Load.h>
Uint32 cpu_load;
Load_Stat load_stat_hwi;
Load_Stat load_stat_swi;
Load_Stat load_stat_tsk;
Void
clockFxn_1ms()
{
/* get load statistics */
cpu_load = Load_getCPULoad();
Load_getGlobalHwiLoad(&load_stat_hwi);
Load_getGlobalSwiLoad(&load_stat_swi);
Load_getTaskLoad(task, &load_stat_tsk);
}
CPU load returns 28 %, HWI load reports in load_stat_hwi about 91630 / 600208 cycles = 15.3 %, load_stat_swi is neglectable, 769 / 600208 = 0.13 %, task load is 0.
For other timer periods (5, 20 microseconds) the reported cpu load is also nearly twice as big as the hwi load. What's the real load? What does the CPU in the time not reported by Load_get*()? Can anyone explain the difference?
Thanks.
The environment is
- Code Composer Studio v 6.0.1.00040 (c:/ti/ccsv6)
- Compiler TI v5.1.9
- Industrial SDK Version 1.1.0.4 (c:/ti/am335x_sysbios_ind_sdk_1.1.0.4)
- SYS/BIOS (c:/ti/bios_6_35_04_50)
- System Analyzer (UIA Target) 1.3.1.08 (loggin is off)
- RTSC (C:\ti\xdctools_3_25_03_72)
BIOS configuration is
var Defaults = xdc.useModule('xdc.runtime.Defaults');
var Diags = xdc.useModule('xdc.runtime.Diags');
var Error = xdc.useModule('xdc.runtime.Error');
var Log = xdc.useModule('xdc.runtime.Log');
var LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf');
var Main = xdc.useModule('xdc.runtime.Main');
var Memory = xdc.useModule('xdc.runtime.Memory')
var SysMin = xdc.useModule('xdc.runtime.SysMin');
var System = xdc.useModule('xdc.runtime.System');
var Text = xdc.useModule('xdc.runtime.Text');
var BIOS = xdc.useModule('ti.sysbios.BIOS');
var Clock = xdc.useModule('ti.sysbios.knl.Clock');
var Swi = xdc.useModule('ti.sysbios.knl.Swi');
var Task = xdc.useModule('ti.sysbios.knl.Task');
var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
var Hwi = xdc.useModule('ti.sysbios.hal.Hwi');
var Load = xdc.useModule('ti.sysbios.utils.Load');
/*
* Uncomment this line to globally disable Asserts.
* All modules inherit the default from the 'Defaults' module. You
* can override these defaults on a per-module basis using Module.common$.
* Disabling Asserts will save code space and improve runtime performance.
Defaults.common$.diags_ASSERT = Diags.ALWAYS_OFF;
*/
/*
* Uncomment this line to keep module names from being loaded on the target.
* The module name strings are placed in the .const section. Setting this
* parameter to false will save space in the .const section. Error and
* Assert messages will contain an "unknown module" prefix instead
* of the actual module name.
Defaults.common$.namedModule = false;
*/
/*
* Minimize exit handler array in System. The System module includes
* an array of functions that are registered with System_atexit() to be
* called by System_exit().
*/
System.maxAtexitHandlers = 4;
/*
* Uncomment this line to disable the Error print function.
* We lose error information when this is disabled since the errors are
* not printed. Disabling the raiseHook will save some code space if
* your app is not using System_printf() since the Error_print() function
* calls System_printf().
Error.raiseHook = null;
*/
/*
* Uncomment this line to keep Error, Assert, and Log strings from being
* loaded on the target. These strings are placed in the .const section.
* Setting this parameter to false will save space in the .const section.
* Error, Assert and Log message will print raw ids and args instead of
* a formatted message.
Text.isLoaded = false;
*/
/*
* Uncomment this line to disable the output of characters by SysMin
* when the program exits. SysMin writes characters to a circular buffer.
* This buffer can be viewed using the SysMin Output view in ROV.
SysMin.flushAtExit = false;
*/
/*
* The BIOS module will create the default heap for the system.
* Specify the size of this default heap.
*/
BIOS.heapSize = 0x1000;
/*
* Build a custom SYS/BIOS library from sources.
*/
BIOS.libType = BIOS.LibType_Custom;
/* System stack size (used by ISRs and Swis) */
Program.stack = 0x2000;
/* Circular buffer size for System_printf() */
SysMin.bufSize = 0x200;
/*
* Create and install logger for the whole system
*/
var loggerBufParams = new LoggerBuf.Params();
loggerBufParams.numEntries = 512;
loggerBufParams.instance.name = "logger0";
loggerBufParams.exitFlush = true;
Program.global.logger0 = LoggerBuf.create(loggerBufParams);
Defaults.common$.logger = Program.global.logger0;
Main.common$.diags_INFO = Diags.ALWAYS_ON;
System.SupportProxy = SysMin;
var hwi0Params = new Hwi.Params();
hwi0Params.instance.name = "hwi_synctimer";
hwi0Params.maskSetting = xdc.module("ti.sysbios.interfaces.IHwi").MaskingOption_NONE;
Program.global.hwi_synctimer = Hwi.create(95, "&hwiFxn_synctimer", hwi0Params);
var clock0Params = new Clock.Params();
clock0Params.instance.name = "clock_1ms";
clock0Params.startFlag = true;
clock0Params.period = 1;
Program.global.clock_1ms = Clock.create("&clockFxn_1ms", 1, clock0Params);
Load.hwiEnabled = true;
Load.swiEnabled = true;
Load.windowInMs = 1;
BIOS.cpuFreq.lo = 600000000;
LoggerBuf.enableFlush = true;
Load.taskEnabled = true;
Hwi.dispatcherTaskSupport = true;
Hwi.dispatcherIrpTrackingSupport = true;
Hwi.checkStackFlag = true;