code: func (p *Profiler) ReportTopNResults(numResults int, criteria []string) []ExprStats {
  	p.processLastExpr()
  	stats := []ExprStats{}
  
  	for _, hits := range p.hits {
  		for _, stat := range hits {
  			stats = append(stats, stat)
  		}
  	}
  
  	// allowed criteria for sorting results
  	allowedCriteria := map[string]lessFunc{}
  	allowedCriteria["total_time_ns"] = func(stat1, stat2 *ExprStats) bool {
  		return stat1.ExprTimeNs > stat2.ExprTimeNs
  	}
  	allowedCriteria["num_eval"] = func(stat1, stat2 *ExprStats) bool {
  		return stat1.NumEval > stat2.NumEval
  	}
  	allowedCriteria["num_redo"] = func(stat1, stat2 *ExprStats) bool {
  		return stat1.NumRedo > stat2.NumRedo
  	}
  	allowedCriteria["file"] = func(stat1, stat2 *ExprStats) bool {
  		return stat1.Location.File > stat2.Location.File
  	}
  	allowedCriteria["line"] = func(stat1, stat2 *ExprStats) bool {
  		return stat1.Location.Row > stat2.Location.Row
  	}
  
  	sortFuncs := []lessFunc{}
  
  	for _, cr := range criteria {
  		if fn, ok := allowedCriteria[cr]; ok {
  			sortFuncs = append(sortFuncs, fn)
  		}
  	}
  
  	// if no criteria return all the stats
  	if len(sortFuncs) == 0 {
  		return stats
  	}
  
  	orderedBy(sortFuncs).Sort(stats)
  
  	// if desired number of results to be returned is less than or
  	// equal to 0 or exceed total available results,
  	// return all the stats
  	if numResults <= 0 || numResults > len(stats) {
  		return stats
  	}
  	return stats[:numResults]
  
  }
docs: // ReportTopNResults returns the top N results based on the given
  // criteria. If N <= 0, all the results based on the criteria are returned.