1

In C++, with this:

std::time_t first = time(NULL); /* .. code .. */ std::time_t second = time(NULL); std::cout << "Seg : " << difftime(second,first) << std::endl; 

I can determine my program's execution duration.

Can I determine its memory consumption at different points through the program?

8
  • For what platform? You're going to have to write something platform specific to do this... Commented Apr 22, 2011 at 4:07
  • Are you talking about stack space, or heap memory? Commented Apr 22, 2011 at 4:08
  • @EboMike: Or perhaps he's using an environment that employs something other than a heap for the free store. The language doesn't care what it is. Commented Apr 22, 2011 at 4:16
  • 2
    Override the basic new operators and count the memory used. Voila, you got your mechanism ;) ... you can also use profilers with or without instrumentation to achieve the same. Commented Apr 22, 2011 at 4:22
  • 1
    @GMan: How many milligrams do you want, sir? Sincerely, Doctor C++ Commented Apr 22, 2011 at 12:10

1 Answer 1

2

Not easily.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.