code: public static <T> Observable.Transformer<T, T> benchmark(final String name, final Logger logger){
          final long[] startTime = new long[1];
          return new Observable.Transformer<T, T>() {
              @Override
              public Observable<T> call(Observable<T> tObservable) {
                  return tObservable
                          .doOnSubscribe(new Action0() {
                              @Override
                              public void call() {
                                  startTime[0] = System.nanoTime();
                              }
                          })
                          .doOnCompleted(new Action0() {
                              @Override
                              public void call() {
                                  long timeMs = TimeUnit.NANOSECONDS.toMillis(startTime[0]);
                                  logger.log(Log.DEBUG, "[%s] Observable Duration: %s", name, TimeUtils.getTimeAgo(timeMs));
                              }
                          });
              }
          };
      }
docs: <p>
  Benchmark an observable from the point of subscription to the point of completion
  </p>
  
  @param name      the name of the observable to print in log statement
  @param <T>       The transformation type
  @return          The transformer