/** get the profiling results for "name" from this database. */
  public ProfilerResults(ProfilerDB db, String name) {
    this.name = name;
    this.db = db;

    // XXX: if "name" is non existing, an empty data will be created
    ProfiledData data = db.getDataset(name);

    this.count = data.getSize();
    this.memories = data.memories;
    this.ids = data.ids;
    this.times = data.times;

    this.current = -1;

    // calc min/max:
    min_times = Integer.MAX_VALUE;
    max_times = Integer.MIN_VALUE;
    min_mems = Long.MAX_VALUE;
    max_mems = Long.MIN_VALUE;

    for (int i = 0; i < count; i++) {
      min_mems = Math.min(min_mems, memories[i]);
      max_mems = Math.max(max_mems, memories[i]);
      min_times = Math.min(min_times, times[i]);
      max_times = Math.max(max_times, times[i]);
    }
  }