code: public static double getTotalGCPercentage() {
          long totalCollectionTime = getTotalCollectionTime();
          if(totalCollectionTime == -1) {
              return -1.0;
          }
          long uptime = ManagementFactory.getRuntimeMXBean().getUptime();
          return ((double) totalCollectionTime / (double) uptime);
      }
docs: Returns the time spent in GC as a proportion of the time elapsed since
  the JVM was started. If no data is available returns -1.
  
  @return the percentage of uptime spent in gc or -1.0