[Insight-developers] memory probe test

Nicholas Tustison ntustison at gmail.com
Thu Aug 12 20:13:40 EDT 2010


Hi Developers,

I posted a question a couple days ago about the itkTimeAndMemoryProbeTest on the users' list but after doing some more digging, I was hoping somebody on the developer's list could tell me where my thinking is incorrect.  Four different memory situations from 1KB to 1024 KB (see below) are tested.  However, if you look at the output from different platforms on the dashboard, the reported values are mostly 0 (which is what I see on my machines) with the occasional exception which oftentimes does not match the testing value.  Perhaps I'm missing something but are these zero values that are being reported for this test correct?  Also, even if the output is 0 for all test cases, shouldn't the occasional nonzero values throw an exception?

Thanks,
Nick




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;
}



More information about the Insight-developers mailing list