⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 itktimeandmemoryprobetest.cxx

📁 DTMK软件开发包,此为开源软件,是一款很好的医学图像开发资源.
💻 CXX
字号:
/*=========================================================================

Program:   Insight Segmentation & Registration Toolkit
Module:    $RCSfile: itkTimeAndMemoryProbeTest.cxx,v $
Language:  C++
Date:      $Date: 2008-04-05 16:31:54 $
Version:   $Revision: 1.2 $

Copyright (c) Insight Software Consortium. All rights reserved.
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.

This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.  See the above copyright notices for more information.

=========================================================================*/

#include "itkTimeProbe.h"
#include "itkMemoryProbesCollectorBase.h"

#include <iostream>

int itkTimeAndMemoryProbeTest(int argc,char* argv[])
{
  (void)argc;
  (void)argv;

  itk::TimeProbe timeProbe;
  itk::MemoryProbesCollectorBase memoryProbes;

  timeProbe.Start();

  memoryProbes.Start("1KB Test");
  char* foo = new char[1*1024];
  memoryProbes.Stop("1KB Test");

  memoryProbes.Start("70KB Test");
  char* foo2 = new char[70*1024];
  memoryProbes.Stop("70KB Test");

  memoryProbes.Start("170KB Test");
  char* foo3 = new char[170*1024];
  memoryProbes.Stop("170KB Test");

  memoryProbes.Start("1024KB Test");
  char* foo4 = new char[1024*1024];
  memoryProbes.Stop("1024KB Test");

  memoryProbes.Report( std::cout );
  memoryProbes.Clear();

  memoryProbes.Start("Release Test");
  delete[] foo;
  delete[] foo2;
  delete[] foo3;
  delete[] foo4;
  memoryProbes.Stop("Release Test");

  memoryProbes.Report( std::cout );

  timeProbe.Stop();
  std::cout<<" The test has last "<<timeProbe.GetMean()<<timeProbe.GetUnit()<<std::endl;

  return EXIT_SUCCESS;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -