class LegacyGcStatsDataSeries implements DataSeries<GcDurationData> {

  @Override
  public List<SeriesData<GcDurationData>> getDataForRange(@NotNull Range timeCurrentRangeUs) {
    // TODO: Change the Memory API to allow specifying padding in the request as number of samples.
    long bufferNs = TimeUnit.SECONDS.toNanos(1);
    MemoryProfiler.MemoryRequest.Builder dataRequestBuilder = MemoryProfiler.MemoryRequest.newBuilder()
      .setSession(mySession)
      .setStartTime(TimeUnit.MICROSECONDS.toNanos((long)timeCurrentRangeUs.getMin()) - bufferNs)
      .setEndTime(TimeUnit.MICROSECONDS.toNanos((long)timeCurrentRangeUs.getMax()) + bufferNs);
    MemoryProfiler.MemoryData response = myClient.getData(dataRequestBuilder.build());

    List<SeriesData<GcDurationData>> seriesData = new ArrayList<>();
    for (MemoryProfiler.MemoryData.GcStatsSample sample : response.getGcStatsSamplesList()) {
      long dataTimestamp = TimeUnit.NANOSECONDS.toMicros(sample.getStartTime());
      long duration = TimeUnit.NANOSECONDS.toMicros(sample.getEndTime() - sample.getStartTime());
      seriesData.add(new SeriesData<>(dataTimestamp, new GcDurationData(duration)));
    }
    return seriesData;
  }

  public  LegacyGcStatsDataSeries(@NotNull MemoryServiceGrpc.MemoryServiceBlockingStub client, @NotNull Common.Session session);

}