Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

Is it prossible to report how many calculations where executed by a section of code?

I know the benchmark gem will report on runtime, but don't believe it'll count the number of calculations done.

Just to be clear, I'm talking about at the processor level.

share|improve this question

2 Answers 2

About memory usage, if you define the macro CALC_EXACT_MALLOC_SIZE (not sure where, but in ruby.h may work) and recompile Ruby, you will be able to call GC.malloc_allocated_size to know how much memory is allocated by malloc (almost everything), in bytes.

share|improve this answer
    
+1 @LBg: It was my fault for including the reference to memory, the question is really about calculation reporting. If I post another question related to Ruby memory reporting and link to it would you be willing to move your answer to it. If so I'll do that, and remove the reference to memory in this question. Thanks! –  blunders Dec 5 '11 at 18:25
up vote 1 down vote accepted

No, it appears it is not possible.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.