SAFS Init Files

本文详细介绍了如何通过IBT作为示例读取SAFS的部署文件,并阐述了如何使用多线程搜索参数进行图像比较。讨论了在Default Driver类中设置多线程使用的变量,以及在配置文件中获取客户端是否选择多线程的配置方法。同时,文章还展示了在测试.ini文件中正确配置IBT参数的方式。

There're many deployment files for configuration. We need to learn how SAFS read these depolyment files.

 

Let's use the IBT as the a small example for reading UseMultiThreadSearch parameter which determines if we use multi-thread algorithm for image comparing.

 

In the DefaultDriver.java, define a variable USE_MULTIPLE_THREADS to store client's choice about using multi-thread:

/**
 * Set true if image searches using BitTolerance 
 * should attempt to use parallel threading.
 * The current implementation of multi-threading is poor, 
 * and may actually be slower than NOT using multi-threading.
 * Current default is 'false'.
 * @see org.safs.image.SmallPieceComparator
 * @see org.safs.image.ScreenXYBTComparator  
 */
public static boolean USE_MULTIPLE_THREADS = false;

Then, in the DefaultDriver.java file, the initializeMiscConfigInfo() method will call configInfo's getNamedValue() method to read the configuration files. So in order to get client's choice of whether use multi-thread, we'll do:

String useMultiThread = configInfo.getNamedValue(DriverConstant.SECTION_SAFS_IBT, "UseMultiThreadSearch");
if(useMultiThread!=null) {
	ImageUtils.USE_MULTIPLE_THREADS = StringUtilities.convertBool(useMultiThread);
	Log.info("SAFS_IBT:UseMultiThreadSearch set to: "+ ImageUtils.USE_MULTIPLE_THREADS);
}

The corresponding test.ini file should be written like this:

[SAFS_IBT]
UseTwoDimensionMatch=true

Obviously the [SAFS_IBT]  is determined by parameter DriverConstant.SECTION_SAFS_IBT in configInfo.getNamedValue() method.

 

 

 

In org.safs.tools.drivers.DriverConstant.java, one constant DEFAULT_PROJECT_DATAPOOL is used to store test tables and app maps. Generally, all inputs except benchmarks are placed here.

Then, in org.safs.tools.drivers.AbstractDriver.java, in AbstractDriver class, the variable datapoolSource will use the DEFAULT_PROJECT_DATAPOOL as default value. In the method validateRootConfigureParameters() of AbstractDriver class, it will call:

datapoolSource = getProjectDirectoryInfo (configInfo.getNamedValue (
			                           DriverConstant.SECTION_SAFS_DIRECTORIES, "DataDir"),
			                           DriverConstant.DEFAULT_PROJECT_DATAPOOL);

for setting.

 

 

In jsafs.validateRootConfigureParameters() using datapoolSource = getProjectDirectoryInfo() get the directory of MAP files. 

 

转载于:https://www.cnblogs.com/kid551/p/4428921.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值