当前位置: 首页>>代码示例>>C++>>正文


C++ DataCollector::stopSection方法代码示例

本文整理汇总了C++中DataCollector::stopSection方法的典型用法代码示例。如果您正苦于以下问题:C++ DataCollector::stopSection方法的具体用法?C++ DataCollector::stopSection怎么用?C++ DataCollector::stopSection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataCollector的用法示例。


在下文中一共展示了DataCollector::stopSection方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main()
{	
	//create factory
	PerformerFactory *pf = getPerfFactory();
	
	//config objects
	ConfigFile *vecConf = pf->createConfigObject("results/vecResult.xml");
	ConfigFile *listConf = pf->createConfigObject("results/listResult.xml");
	ConfigFile *setConf = pf->createConfigObject("results/setResult.xml");
	
	//create data collectors
	DataCollector *vecDc = pf->createDataCollector(vecConf);
	DataCollector *listDc = pf->createDataCollector(listConf);
	DataCollector *setDc = pf->createDataCollector(setConf);
	
	//create a vector, list and set of ints
	vector<int> intVec;
	list<int> intList;
	set<int> intSet;
	
	//add operations to fill all three containers
	
	vecDc->startSection("push_back"); //measure from here
	
	for(int i=0; i<10; i++){
		intVec.push_back(i);
	}
	
	vecDc->stopSection(); //stop measuring here
	
	listDc->startSection("insert"); //measure list push_back
	
	for(int i=0; i<10; i++){
		intList.push_back(i);
	}
	listDc->stopSection();
	
	setDc->startSection("insert"); //measure set insert
	
	for(int i=0; i<10; i++){
		intSet.insert(i);
	}
	setDc->stopSection();
	
	
	//search a value in the container
	
	vecDc->startSection("find"); //measure find algorithm for vector
	find(intVec.begin(), intVec.end(), 5);
	vecDc->stopSection();
	
	listDc->startSection("find"); //measure find algorithm for list
	find(intList.begin(), intList.end(), 5);
	listDc->stopSection();
	
	setDc->startSection("find"); //measure find find algorithm for set
	find(intSet.begin(), intSet.end(), 5);	
	setDc->stopSection();
	
	//erase
	
	vecDc->startSection("erase"); //measure erase algorithm for vector
	intVec.erase(intVec.begin(), intVec.end());
	vecDc->stopSection();
	
	listDc->startSection("erase"); //measure erase algorithm for list
	intList.erase(intList.begin(), intList.end());
	listDc->stopSection();
	
	setDc->startSection("erase"); //measure erase algorithm for set
	intSet.erase(intSet.begin(), intSet.end());
	setDc->stopSection();
	
	//insert operatins to refill containers
	
	vecDc->startSection("insert");
	for(int i=0; i<=100; i++){
		intVec.push_back(i);
	}
	vecDc->stopSection();
	
	listDc->startSection("insert");
	for(int i=0; i<100; i++){
		intList.push_back(i);
	}
	listDc->stopSection();
	
	setDc->startSection("insert");
	for(int i=0; i<100; i++){
		intSet.insert(i);
	}
	setDc->stopSection();
	
	//modify values via fill algorithm in container
	int y = 1;
	
	vecDc->startSection("fill"); //measure fill algorithm with vector
	fill(intVec.begin(), intVec.end(), (++y)*2);
	vecDc->stopSection();
	
//.........这里部分代码省略.........
开发者ID:iq-dot,项目名称:performer,代码行数:101,代码来源:load_results.cpp


注:本文中的DataCollector::stopSection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。