20151208 xScope(cont.)
一:检测一个函数的运行时间
Within a function make a call toxscope_start() / xscope_stop() for a specified probe to signal a toggle instate from start to stop. This allows the time period between these points tobe measured.
//计算两者之间的时间(wait(150000))
void function_1(void)
{
xscope_start(FUNCTION_1);
wait(150000);
xscope_stop(FUNCTION_1);
}
//config.xscope文件内容
<xSCOPEconfig ioMode="none"enabled="true">*
<Probe name="Function 1"type="STARTSTOP" datatype="UINT" units="Value"enabled="true"/>
<Probe name="Function 2"type="STARTSTOP" datatype="UINT" units="Value"enabled="true"/>
<Probe name="Function 3"type="STARTSTOP" datatype="UINT" units="Value"enabled="true"/>
<Probe name="Function 4"type="STARTSTOP" datatype="UINT" units="Value"enabled="true"/>
</xSCOPEconfig>*
二:xscope的offline
如果使用xscope的offline模式,那么程序运行后(run configuration->run),数据会默认存在文件xscope.xmt中,打开offline xscope会自动导入xscope.xmt就可以看到波形。
如果选择xscope的offlineOptions中的output file并输入文件名,那么在程序运行后(run),打开offline xscope会自动导入该文件。
或者在edit的projectExplorer中双击该文件,也能进入offlinexscope中观察该文件中的数据。
三:重定向IO(比如:printf)(重定向函数xscope_config_io)
void xscope_user_init(void){
xscope_register(0);*
xscope_config_io(XSCOPE_IO_BASIC);
}
Type | xscope_IORedirectionMode |
---|---|
Description | Enum of all I/O redirection modes. |
Values | XSCOPE_IO_NONE I/O is not redirected. |
XSCOPE_IO_BASIC Basic I/O redirection. | |
XSCOPE_IO_TIMED Timed I/O redirection. |