docs: long calculateDelta()
    {
      try {
        long[] allThreadIds = threadMXBean.getAllThreadIds();
        // the call time depends on number of threads, for 500 threads the estimated time is 4 ms
        long[] bytes = (long[]) getThreadAllocatedBytes.invoke(threadMXBean, (Object) allThreadIds);
        long sum = 0;
        Long2LongMap newResults = new Long2LongOpenHashMap();
        newResults.defaultReturnValue(NO_DATA);
        for (int i = 0; i < allThreadIds.length; i++) {
          long threadId = allThreadIds[i];
          long previous = previousResults.get(threadId);
          long current = bytes[i];
          newResults.put(threadId, current);
          // a) some threads can be terminated and their ids won't be present
          // b) if new threads ids can collide with terminated threads ids then the current allocation can be lesser than
          // before
          if (previous == NO_DATA || previous > current) {
            sum += current;
          } else {
            sum += current - previous;
          }
        }
        previousResults = newResults;
        return sum;
      }
      catch (ReflectiveOperationException e) {
        log.error(e, "Cannot calculate delta"); // it doesn't make sense after initialization is complete
      }
      return 0;
    }