src/main/java/org/apache/hadoop/hdfs/server/namenode/queries/Histograms.java
public static String toCsv(Map<String, List<Long>> histogram) {
    long s1 = System.currentTimeMillis();

    StringBuilder sb = new StringBuilder();
    for (Map.Entry<String, List<Long>> entry : histogram.entrySet()) {
      sb.append(entry.getKey());
      for (Long val : entry.getValue()) {
        sb.append(',');
        sb.append(val);
      }
      sb.append('\n');
    }

    long e1 = System.currentTimeMillis();
    String csv = sb.toString();
    LOG.debug(
        "Time to dump histogram3 to CSV String of {} chars took: {} ms.", csv.length(), (e1 - s1));
    return csv;
  }
/**
   * This function converts histogram map to csv string
   *
   * @param histogram data points of histogram
   * @return csv string of the input histogram.
   */
This function converts histogram map to csv string
@param histogram data points of histogram
@return csv string of the input histogram.
This function converts histogram map to csv string @param histogram data points of histogram @return csv string of the input histogram .
public static String toCsv(Map<String, List<Long>> histogram) {
    long s1 = System.currentTimeMillis();
    StringBuilder sb = new StringBuilder();
    for (Map.Entry<String, List<Long>> entry : histogram.entrySet()) {
      sb.append(entry.getKey());
      for (Long val : entry.getValue()) {
        sb.append(',');
        sb.append(val);
      }
      sb.append('\n');
    }
    long e1 = System.currentTimeMillis();
    String csv = sb.toString();
    LOG.debug(
        "Time to dump histogram3 to CSV String of {} chars took: {} ms.", csv.length(), (e1 - s1));
    return csv;
  }
public static String toCsv ( Map < String , List < Long > > histogram ) { long s1 = System . currentTimeMillis ( ) ; StringBuilder sb = new StringBuilder ( ) ; for ( Map . Entry < String , List < Long > > entry : histogram . entrySet ( ) ) { sb . append ( entry . getKey ( ) ) ; for ( Long val : entry . getValue ( ) ) { sb . append ( ',' ) ; sb . append ( val ) ; } sb . append ( '\n' ) ; } long e1 = System . currentTimeMillis ( ) ; String csv = sb . toString ( ) ; LOG . debug ( "Time to dump histogram3 to CSV String of {} chars took: {} ms." , csv . length ( ) , ( e1 - s1 ) ) ; return csv ; }
This function converts histogram map to csv string
 @param histogram data points of histogram
 @return csv string of the input histogram.
This function converts histogram map to csv string @param histogram data points of histogram @return csv string of the input histogram .