1 Reply Latest reply: Apr 27, 2010 5:14 AM by Kayaman RSS

    Profiling small algorithm

    843798
      Hi!

      I have a small algorithm (the compiled .class file is about 20kb). Now what I want to do is to measure how much memory is needed to run this algorithm. I've tried different profiling tools, but they mostly give a lot of overhead. All I want to do is to measure when the algorithm peak in number of kb/mb used during execution. Again this is a really small single-file algorithm.

      Also thought about RunTime.getTotalMemory - Runtime.getFreeMemory, before and after execution, but is doesnt tell me anything about memory used during execution. (Guess some garbage collecting is happening). Again when I run different java profiler they just show alot of classes and variables created which gives alot of overhead.

      Thanks in advance,
      Martinsen
        • 1. Re: Profiling small algorithm
          Kayaman
          Martinsen wrote:
          Also thought about RunTime.getTotalMemory - Runtime.getFreeMemory, before and after execution, but is doesnt tell me anything about memory used during execution.
          Indeed, it won't give you any better information.
          Again when I run different java profiler they just show alot of classes and variables created which gives alot of overhead.
          Well that's your best bet. You can try to remove the overhead from the calculations to get to whatever it is you want to profile.