code: public String getTopMethods(int num) {
  		stopCollecting();
  		CountMap<String> selfms = new CountMap<String>(selfMethods);
  		CountMap<String> stackms = new CountMap<String>(stackMethods);
  		StringBuilder buff = new StringBuilder();
  		buff.append("Top methods over ").append(time).append(" ms (").append(pauseTime).append(" ms paused), with ")
  				.append(total).append(" counts:").append(LINE_SEPARATOR);
  		buff.append("Rank\tSelf\tStack\tMethod").append(LINE_SEPARATOR);
  		for (int i = 0, n = 0; selfms.size() > 0 && n < num; i++) {
  			int highest = 0;
  			List<Map.Entry<String, Integer>> bests = new ArrayList<Map.Entry<String, Integer>>();
  			for (Map.Entry<String, Integer> el : selfms.entrySet()) {
  				if (el.getValue() > highest) {
  					bests.clear();
  					bests.add(el);
  					highest = el.getValue();
  				} else if (el.getValue() == highest) {
  					bests.add(el);
  				}
  			}
  			for (Map.Entry<String, Integer> e : bests) {
  				selfms.remove(e.getKey());
  				int selfPercent = 100 * highest / Math.max(total, 1);
  				int stackPercent = 100 * stackms.remove(e.getKey()) / Math.max(total, 1);
  				buff.append(i + 1).append("\t").append(selfPercent).append("%\t").append(stackPercent).append("%\t")
  						.append(e.getKey()).append(LINE_SEPARATOR);
  				n++;
  			}
  		}
  		return buff.toString();
  	}
docs: Stop and obtain the top methods, ordered by their self execution time.
  
  @param num
  number of top methods
  
  @return the top methods