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


C++ TicToc::toc方法代码示例

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


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

示例1: main

int main(int argc, char * argv[])
{
  double portion = 0.9;
  uint64 memory_size = getMemorySize() * portion;
  uint64 page_size = sysconf(_SC_PAGESIZE);
  uint64 page_nums = memory_size/page_size;
  // Need to Configure Parse
  bool debug = true;

  if(debug)
  {
    printf("*--------------------------*\nMemory Information... \n*--------------------------*\n");
    printf("Memory Size (bytes): %lu | ",memory_size);
    printf("Page Size (bytes): %lu | ",page_size);
    printf("Number of Pages: %lu \n",page_nums);
    printf("Note: We allocte %f of the memory \n",portion*100);
  }

  // Allocate memory
  Byte * memory = (Byte * ) malloc(memory_size);

  double iterations = 10;
  double total_mem_time = 0;
  double total_alligned_page = 0;
  double total_unalligned_page =0;

  for(double j =0 ; j < iterations; j++)
  {
      TicToc timer;
      timer.tic();
      memset(memory,0,memory_size);
      total_mem_time+= (timer.toc()/1000000);

      timer.tic();
      for(uint64 i =0 ; i < page_nums; i++ )
      {
         memset(memory + i* page_size,i,page_size);
      }
      total_alligned_page+= (timer.toc()/page_size);

      timer.tic();
      for(uint64 i =0 ; i < page_nums - 1 ; i++ )
      {
         memset(memory + i * page_size + 2,i,page_size);
      }
      total_unalligned_page+=(timer.toc()/(page_size - 1));

  }
  printf("*--------------------------*\nBenchmarking Starting... \n*--------------------------*\n");
  printf("Memory Access Time: %f (secs)\n",total_mem_time/iterations);
  printf("Alligned Page Access Time: %f (usec)\n",total_alligned_page/iterations);
  printf("Unalligned Page Access Time: %f (usec)\n",total_unalligned_page/iterations);

  // Free allocated memory
  free(memory);
}
开发者ID:ahmedatya,项目名称:Benchmark,代码行数:56,代码来源:bus_bench.cpp

示例2: fromROSMsg

void
compute (const sensor_msgs::PointCloud2::ConstPtr &input, PolygonMesh &output,
         float leaf_size, float iso_level, int use_dot)
{
  PointCloud<PointNormal>::Ptr xyz_cloud (new pcl::PointCloud<PointNormal> ());
  fromROSMsg (*input, *xyz_cloud);

  boost::shared_ptr<MarchingCubes<PointNormal> > marching_cubes;
  if (use_dot)
    marching_cubes.reset (new MarchingCubesGreedyDot<PointNormal> ());
  else
    marching_cubes.reset (new MarchingCubesGreedy<PointNormal> ());

  marching_cubes->setLeafSize (leaf_size);
  marching_cubes->setIsoLevel (iso_level);
  marching_cubes->setInputCloud (xyz_cloud);


  TicToc tt;
  tt.tic ();

  print_highlight ("Computing ");
  marching_cubes->reconstruct (output);

  print_info ("[done, "); print_value ("%g", tt.toc ()); print_info (" ms]\n");
}
开发者ID:MorS25,项目名称:pcl-fuerte,代码行数:26,代码来源:marching_cubes_reconstruction.cpp

示例3: xyznormals

void
compute (const sensor_msgs::PointCloud2::ConstPtr &input, sensor_msgs::PointCloud2 &output,
         int k, double radius)
{
  // Convert data to PointCloud<T>
  PointCloud<PointNormal>::Ptr xyznormals (new PointCloud<PointNormal>);
  fromROSMsg (*input, *xyznormals);

  // Estimate
  TicToc tt;
  tt.tic ();
  
  print_highlight (stderr, "Computing ");

  FPFHEstimation<PointNormal, PointNormal, FPFHSignature33> ne;
  ne.setInputCloud (xyznormals);
  ne.setInputNormals (xyznormals);
  ne.setSearchMethod (search::KdTree<PointNormal>::Ptr (new search::KdTree<PointNormal>));
  ne.setKSearch (k);
  ne.setRadiusSearch (radius);
  
  PointCloud<FPFHSignature33> fpfhs;
  ne.compute (fpfhs);

  print_info ("[done, "); print_value ("%g", tt.toc ()); print_info (" ms : "); print_value ("%d", fpfhs.width * fpfhs.height); print_info (" points]\n");

  // Convert data back
  sensor_msgs::PointCloud2 output_fpfhs;
  toROSMsg (fpfhs, output_fpfhs);
  concatenateFields (*input, output_fpfhs, output);
}
开发者ID:rbart,项目名称:guide-dog,代码行数:31,代码来源:fpfh_estimation.cpp

示例4: if

void
saveCloud (const string &filename, const pcl::PCLPointCloud2 &output)
{
  TicToc tt;
  tt.tic ();

  print_highlight ("Saving "); print_value ("%s ", filename.c_str ());

  PCDWriter w_pcd;
  PLYWriter w_ply;
  std::string output_ext = boost::filesystem::extension (filename);
  std::transform (output_ext.begin (), output_ext.end (), output_ext.begin (), ::tolower);

  if (output_ext.compare (".pcd") == 0)
  {
    w_pcd.writeBinaryCompressed (filename, output);
  }
  else if (output_ext.compare (".ply") == 0)
  {
    w_ply.writeBinary (filename, output);
  }
  else if (output_ext.compare (".vtk") == 0)
  {
    w_ply.writeBinary (filename, output);
  }
  
  print_info ("[done, "); print_value ("%g", tt.toc ()); print_info (" ms : "); print_value ("%d", output.width * output.height); print_info (" points]\n");
}
开发者ID:BITVoyager,项目名称:pcl,代码行数:28,代码来源:uniform_sampling.cpp

示例5: return

bool
loadPCLZF (const std::string &filename_rgb, 
           const std::string &filename_depth,
           const std::string &filename_params,
           pcl::PointCloud<pcl::PointXYZRGBA> &cloud)
{
  TicToc tt;
  print_highlight ("Loading "); print_value ("%s ", filename_rgb.c_str ());
  tt.tic ();

  pcl::io::LZFRGB24ImageReader rgb;
  pcl::io::LZFBayer8ImageReader bayer;
  pcl::io::LZFYUV422ImageReader yuv;
  pcl::io::LZFDepth16ImageReader depth;

  rgb.readParameters (filename_params);
  bayer.readParameters (filename_params);
  depth.readParameters (filename_params);
  yuv.readParameters (filename_params);

  if (!rgb.read (filename_rgb, cloud))
    if (!yuv.read (filename_rgb, cloud))
      bayer.read (filename_rgb, cloud);

  depth.read (filename_depth, cloud);

  print_info ("[done, "); print_value ("%g", tt.toc ()); print_info (" ms : "); print_value ("%d", cloud.width * cloud.height); print_info (" points]\n");
  print_info ("Available dimensions: "); print_value ("%s\n", pcl::getFieldsList (cloud).c_str ());

  return (true);
}
开发者ID:2php,项目名称:pcl,代码行数:31,代码来源:pclzf2pcd.cpp

示例6: load

    bool
    load (const std::string &file)
    {
      // Load the input file
      TicToc tt; tt.tic ();
      print_highlight (stderr, "Loading "); 
      print_value (stderr, "%s ", file.c_str ());
      cloud_.reset (new PointCloud<PointT>);
      if (io::loadPCDFile (file, *cloud_) < 0) 
      {
        print_error (stderr, "[error]\n");
        return (false);
      }
      print_info ("[done, "); print_value ("%g", tt.toc ()); 
      print_info (" ms : "); print_value ("%lu", cloud_->size ()); print_info (" points]\n");
      
      if (cloud_->isOrganized ())
        search_.reset (new search::OrganizedNeighbor<PointT>);
      else
        search_.reset (new search::KdTree<PointT>);

      search_->setInputCloud (cloud_);

      return (true);
    }
开发者ID:SunBlack,项目名称:pcl,代码行数:25,代码来源:pcd_select_object_plane.cpp

示例7: idx

void
compute (ConstCloudPtr &input, Cloud &output, int max_window_size, float slope, float max_distance, float initial_distance, float cell_size, float base, bool exponential)
{
  // Estimate
  TicToc tt;
  tt.tic ();

  print_highlight (stderr, "Computing ");

  std::vector<int> ground;

  ProgressiveMorphologicalFilter<PointType> pmf;
  pmf.setInputCloud (input);
  pmf.setMaxWindowSize (max_window_size);
  pmf.setSlope (slope);
  pmf.setMaxDistance (max_distance);
  pmf.setInitialDistance (initial_distance);
  pmf.setCellSize (cell_size);
  pmf.setBase (base);
  pmf.setExponential (exponential);
  pmf.extract (ground);

  PointIndicesPtr idx (new PointIndices);
  idx->indices = ground;

  ExtractIndices<PointType> extract;
  extract.setInputCloud (input);
  extract.setIndices (idx);
  extract.setNegative (false);
  extract.filter (output);

  print_info ("[done, "); print_value ("%g", tt.toc ()); print_info (" ms : "); print_value ("%d", output.width * output.height); print_info (" points]\n");
}
开发者ID:Eilvrin,项目名称:pcl,代码行数:33,代码来源:progressive_morphological_filter.cpp

示例8: xyz

void
compute (const sensor_msgs::PointCloud2::ConstPtr &input, sensor_msgs::PointCloud2 &output,
         int k, double radius)
{
  // Convert data to PointCloud<T>
  PointCloud<PointXYZ>::Ptr xyz (new PointCloud<PointXYZ>);
  fromROSMsg (*input, *xyz);

  // Estimate
  TicToc tt;
  tt.tic ();
  
  print_highlight (stderr, "Computing ");

  NormalEstimation<pcl::PointXYZ, pcl::Normal> ne;
  ne.setInputCloud (xyz);
//  ne.setSearchMethod (pcl::search::KdTree<pcl::PointXYZ>::Ptr (new pcl::search::KdTree<pcl::PointXYZ>));
  ne.setKSearch (k);
  ne.setRadiusSearch (radius);
  
  PointCloud<Normal> normals;
  ne.compute (normals);

  print_info ("[done, "); print_value ("%g", tt.toc ()); print_info (" ms : "); print_value ("%d", normals.width * normals.height); print_info (" points]\n");

  // Convert data back
  sensor_msgs::PointCloud2 output_normals;
  toROSMsg (normals, output_normals);
  concatenateFields (*input, output_normals, output);
}
开发者ID:diegodgs,项目名称:PCL,代码行数:30,代码来源:normal_estimation.cpp

示例9: xyz

void
compute (const pcl::PCLPointCloud2::ConstPtr &input, pcl::PCLPointCloud2 &output,
         double radius)
{
  // Convert data to PointCloud<T>
  PointCloud<PointXYZ>::Ptr xyz (new PointCloud<PointXYZ>);
  fromPCLPointCloud2 (*input, *xyz);

  // Estimate
  TicToc tt;
  tt.tic ();
  
  print_highlight (stderr, "Computing ");

  UniformSampling<PointXYZ> us;
  us.setInputCloud (xyz);
  us.setRadiusSearch (radius);
  PointCloud<PointXYZ> output_;
  us.filter (output_);

  print_info ("[done, "); print_value ("%g", tt.toc ()); print_info (" ms : "); print_value ("%d", output_.size()); print_info (" points]\n");

  // Convert data back
  toPCLPointCloud2 (output_, output);
}
开发者ID:2php,项目名称:pcl,代码行数:25,代码来源:uniform_sampling.cpp

示例10: xyz

void
compute (const pcl::PCLPointCloud2::ConstPtr &input, pcl::PCLPointCloud2 &output,
         float sigma_s = 5.f, float sigma_r = 0.03f)
{
  // Convert data to PointCloud<T>
  PointCloud<PointXYZ>::Ptr xyz (new PointCloud<PointXYZ>);
  fromPCLPointCloud2 (*input, *xyz);

  TicToc tt;
  tt.tic ();

  // Apply the filter
  FastBilateralFilter<PointXYZ> fbf;
  fbf.setInputCloud (xyz);
  fbf.setSigmaS (sigma_s);
  fbf.setSigmaR (sigma_r);
  PointCloud<PointXYZ> xyz_filtered;
  fbf.filter (xyz_filtered);

  print_highlight ("Filtered data in "); print_value ("%g", tt.toc ()); print_info (" ms for "); print_value ("%zu", xyz_filtered.size ()); print_info (" points.\n");

  // Convert data back
  pcl::PCLPointCloud2 output_xyz;
  toPCLPointCloud2 (xyz_filtered, output_xyz);
  concatenateFields (*input, output_xyz, output);
}
开发者ID:5irius,项目名称:pcl,代码行数:26,代码来源:fast_bilateral_filter.cpp

示例11:

void
compute (const CloudT::Ptr &input, std::vector<FeatureT::Ptr> &trained_features,
         CloudLT::Ptr &out,
         float normal_radius_search,
         float fpfh_radius_search,
         float feature_threshold)
{
  TicToc tt;
  tt.tic ();
  
  print_highlight ("Computing ");

  UnaryClassifier<PointT> classifier;
  classifier.setInputCloud (input);
  classifier.setTrainedFeatures (trained_features);
  classifier.setNormalRadiusSearch (normal_radius_search);
  classifier.setFPFHRadiusSearch (fpfh_radius_search);
  classifier.setFeatureThreshold (feature_threshold);

  classifier.segment (out);

  print_info ("[done, "); 
  print_value ("%g", tt.toc ()); 
  print_info (" ms : "); print_value ("%d", out->width * out->height); 
  print_info (" points]\n");

}
开发者ID:2php,项目名称:pcl,代码行数:27,代码来源:unary_classifier_segment.cpp

示例12: cloud

void
compute (const PointCloud<PointNormal>::Ptr &input, pcl::PolygonMesh &output,
         double mu, double radius)
{
  // Estimate
  TicToc tt;
  tt.tic ();
  
  print_highlight (stderr, "Computing ");


  PointCloud<PointNormal>::Ptr cloud (new PointCloud<PointNormal> ());
  for (size_t i = 0; i < cloud->size (); ++i)
    if (pcl_isfinite (input->points[i].x))
      cloud->push_back (input->points[i]);

  cloud->width = static_cast<uint32_t> (cloud->size ());
  cloud->height = 1;
  cloud->is_dense = false;


  GreedyProjectionTriangulation<PointNormal> gpt;
  gpt.setSearchMethod (pcl::search::KdTree<pcl::PointNormal>::Ptr (new pcl::search::KdTree<pcl::PointNormal>));
  gpt.setInputCloud (cloud);
  gpt.setSearchRadius (radius);
  gpt.setMu (mu);


  gpt.reconstruct (output);

  print_info ("[done, "); print_value ("%g", tt.toc ()); print_info (" ms : "); print_value ("%zu", output.polygons.size ()); print_info (" polygons]\n");
}
开发者ID:rbart,项目名称:guide-dog,代码行数:32,代码来源:gp3_surface.cpp

示例13: fromROSMsg

void
compute (const sensor_msgs::PointCloud2::ConstPtr &input, PolygonMesh &output,
         int hoppe_or_rbf, float iso_level, int grid_res, float extend_percentage, float off_surface_displacement)
{
  PointCloud<PointNormal>::Ptr xyz_cloud (new pcl::PointCloud<PointNormal> ());
  fromROSMsg (*input, *xyz_cloud);

  MarchingCubes<PointNormal> *mc;
  if (hoppe_or_rbf == 0)
    mc = new MarchingCubesHoppe<PointNormal> ();
  else
  {
    mc = new MarchingCubesRBF<PointNormal> ();
    (reinterpret_cast<MarchingCubesRBF<PointNormal>*> (mc))->setOffSurfaceDisplacement (off_surface_displacement);
  }

  mc->setIsoLevel (iso_level);
  mc->setGridResolution (grid_res, grid_res, grid_res);
  mc->setPercentageExtendGrid (extend_percentage);
  mc->setInputCloud (xyz_cloud);

  TicToc tt;
  tt.tic ();

  print_highlight ("Computing ");
  mc->reconstruct (output);
  delete mc;

  print_info ("[done, "); print_value ("%g", tt.toc ()); print_info (" ms]\n");
}
开发者ID:hitsjt,项目名称:StanfordPCL,代码行数:30,代码来源:marching_cubes_reconstruction.cpp

示例14: savePNGFile

void
saveImage (const std::string &filename, const pcl::PCLImage& image)
{
  TicToc tt;
  tt.tic ();
  print_highlight ("Saving "); print_value ("%s ", filename.c_str ());
  savePNGFile (filename, image);
  print_info ("[done, "); print_value ("%g", tt.toc ()); print_info (" ms : "); print_value ("%d", image.width * image.height); print_info (" points]\n");
}
开发者ID:2php,项目名称:pcl,代码行数:9,代码来源:pcd2png.cpp

示例15: main

int main(int argc, char *argv[])
{
	if (argc < 2)
	{
		print_help(argv);
		return -1;
	}

	// Parse the command line arguments for .pcd files
	vector<int> txt_file_indices;
	txt_file_indices = parse_file_extension_argument(argc, argv, ".pcd");
	if (txt_file_indices.size () != 1)
	{
		print_error("Need one input PCD file to continue.\n");
		return -1;
	}

	string inputFileName = string(argv[txt_file_indices[0]]);
	size_t ext = inputFileName.find(".pcd");
	string outputFileName = inputFileName.substr(0, ext) + string(".vtk");

	PointCloud<PointNormal>::Ptr cloud_with_normals(new PointCloud<PointNormal>);
	loadPCDFile<PointNormal>(argv[1], *cloud_with_normals);

	search::KdTree<PointNormal>::Ptr tree2 (new search::KdTree<PointNormal>);
  	tree2->setInputCloud (cloud_with_normals);

	// Initialize objects
  	GreedyProjectionTriangulation<PointNormal> gp3;
  	PolygonMesh triangles;

  	// Set the maximum distance between connected points (maximum edge length)
  	gp3.setSearchRadius (0.025);

  	// Set typical values for the parameters
  	gp3.setMu (2.5);
  	gp3.setMaximumNearestNeighbors(500);
  	gp3.setMaximumSurfaceAngle(M_PI/4); // 45 degrees
  	gp3.setMinimumAngle(M_PI/18); // 10 degrees
  	gp3.setMaximumAngle(2*M_PI/3); // 120 degrees
  	gp3.setNormalConsistency(false);

  	// Get result of triangulation
  	gp3.setInputCloud (cloud_with_normals);
  	gp3.setSearchMethod (tree2);

  	TicToc tt;
  	tt.tic();
  	print_highlight("Computing GreedyProjectionTriangulation ");
  	gp3.reconstruct (triangles);
  	print_info("[done, "); print_value("%g", tt.toc()); print_info(" ms]\n");
	
	saveVTKFile (outputFileName, triangles);
	print_highlight(string(string("Saving ") + outputFileName + string("\n")).c_str());

	return 0;
}
开发者ID:mohitd,项目名称:IntrepidPCL,代码行数:57,代码来源:pcd-to-vtk.cpp


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