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


C++ Cube::def_region方法代码示例

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


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

示例1: generate

void CubeTree::generate (Cube &c, Cnode *parent, CallstackTree *ctree, 
	UIParaverTraceConfig *pcf, const string &sourceDir, unsigned depth)
{
	CodeRefTriplet crt = ctree->getCodeRefTriplet();

	string routine, file;
	unsigned bline, eline, line;

	/* If this is the top of the tree and the node is a fake main,
	   rename the routine into "main*" */
	if (depth == 0 && crt.getCaller() == 0)
	{
		routine = "main*";
		file = "";
		bline = eline = 0;
	}
	else
	{
		pcfcommon::lookForCallerFullInfo (pcf, crt.getCaller(),
		  crt.getCallerLine(), crt.getCallerLineAST(), routine,
		  file, line, bline, eline);
	}

	/* Create a node for this routine */
	cube_region = c.def_region (routine, routine, "", "", bline, eline, "", "",
	  sourceDir+"/"+file);
	cube_node = c.def_cnode (cube_region, sourceDir + "/" + file, 0, parent);
	tree_node = ctree;

	/* Recursively create the children for this ctree node */
	vector<CallstackTree*> vctree = ctree->getChildren();
	for (const auto & child : vctree)
	{
		CubeTree *tmp = new CubeTree;
		tmp->generate (c, cube_node, child, pcf, sourceDir, depth+1);
		children.push_back (tmp);
	}
}
开发者ID:bsc-performance-tools,项目名称:folding,代码行数:38,代码来源:cube-tree.C

示例2: main

/**
* Main program. 
* - Create an object "cube"
* - Specify mirrors for onilne help.
* - Specify information related to the file (optional)
* - Build metric tree 
* - Build call tree
* - Build location tree
* - Severity mapping
* - Building a topology
*    - create 1st cartesian.
*    - create 2nd cartesian
* - Output to a cube file
*
* - For a test read the cube again and save it in another file.
* - end.
*/
int main(int argc, char* argv[]) {
  Metric *met0, *met1, *met2;
  Region *regn0, *regn1, *regn2;
  Cnode  *cnode0, *cnode1, *cnode2;
  Machine* mach;
  Node* node;
  Process* proc0, *proc1;
  Thread *thrd0, *thrd1;

  Cube cube;

  // Specify mirrors (optional)
  cube.def_mirror("http://icl.cs.utk.edu/software/kojak/");

  // Specify information related to the file (optional)
  cube.def_attr("experiment time", "November 1st, 2004");
  cube.def_attr("description", "a simple example");

  // Build metric tree 
  met0 = cube.def_met("Time", "Uniq_name1", "", "sec", "", 
		      "@[email protected]#execution", 
		      "root node", NULL); // using mirror
  met1 = cube.def_met("User time", "Uniq_name2", "", "sec", "",  
                      "http://www.cs.utk.edu/usr.html", 
                      "2nd level", met0); // without using mirror
  met2 = cube.def_met("System time", "Uniq_name3", "", "sec", "", 
                       "http://www.cs.utk.edu/sys.html", 
                      "2nd level", met0); // without using mirror
 
  // Build call tree
  string mod    = "/ICL/CUBE/example.c";
  regn0  = cube.def_region("main", 21, 100, "", "1st level", mod);
  regn1  = cube.def_region("foo", 1, 10, "", "2nd level", mod);
  regn2  = cube.def_region("bar", 11, 20, "", "2nd level", mod);

  cnode0 = cube.def_cnode(regn0, mod, 21, NULL);
  cnode1 = cube.def_cnode(regn1, mod, 60, cnode0);
  cnode2 = cube.def_cnode(regn2, mod, 80, cnode0);

  // Build location tree
  mach  = cube.def_mach("MSC", "");
  node  = cube.def_node("Athena", mach);
  proc0 = cube.def_proc("Process 0", 0, node);
  proc1 = cube.def_proc("Process 1", 1, node);
  thrd0 = cube.def_thrd("Thread 0", 0, proc0);
  thrd1 = cube.def_thrd("Thread 1", 1, proc1);


  // Severity mapping

  cube.set_sev(met0, cnode0, thrd0, 4);
  cube.set_sev(met0, cnode0, thrd1, 0);
  cube.set_sev(met0, cnode1, thrd0, 5);
  cube.set_sev(met0, cnode1, thrd1, 9);
  cube.set_sev(met1, cnode0, thrd0, 2);
  cube.set_sev(met1, cnode0, thrd1, 1);
  // unset severities default to zero
  cube.set_sev(met1, cnode1, thrd1, 3);

  // building a topology
  // create 1st cartesian.
  int ndims = 2;
  vector<long> dimv;
  vector<bool> periodv;
  for (int i = 0; i < ndims; i++) {
    dimv.push_back(5);
    if (i % 2 == 0)
      periodv.push_back(true);
    else 
      periodv.push_back(false);
  }
  std::vector<std::string> namedims;
  namedims.push_back("first");
  namedims.push_back("second");     // comment this and no names will be recorded. The vector must have the
                                    // exact number of dimensions present in the current topology.
  //  namedims.push_back("third");  // uncomment this and no names at all will be recorded
  
  
  Cartesian* cart = cube.def_cart(ndims, dimv, periodv);
  cart->set_namedims(namedims);
  vector<long> p[2];
  p[0].push_back(0);
  p[0].push_back(0);
//.........这里部分代码省略.........
开发者ID:linearregression,项目名称:scalasca,代码行数:101,代码来源:cube_test.cpp


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