class LegacyCpuUsageDataSeries implements DataSeries<Long> {

  @Override
  public List<SeriesData<Long>> getDataForRange(@NotNull Range timeCurrentRangeUs) {
    // Get an extra padding on each side, to have a smooth rendering at the edges.
    // TODO: Change the CPU API to allow specifying this padding in the request as number of samples.
    long bufferNs = TimeUnit.SECONDS.toNanos(1);
    CpuDataRequest.Builder dataRequestBuilder = CpuDataRequest.newBuilder()
      .setSession(mySession)
      .setStartTimestamp(TimeUnit.MICROSECONDS.toNanos((long)timeCurrentRangeUs.getMin()) - bufferNs)
      .setEndTimestamp(TimeUnit.MICROSECONDS.toNanos((long)timeCurrentRangeUs.getMax()) + bufferNs);
    CpuDataResponse response = myClient.getData(dataRequestBuilder.build());
    return IntStream.range(0, response.getDataList().size() - 1)
      // Calculate CPU usage percentage from two adjacent CPU usage data.
      .mapToObj(index -> CpuUsage.getCpuUsageData(response.getData(index), response.getData(index + 1), myIsOtherProcess))
      .collect(Collectors.toList());
  }

  public  LegacyCpuUsageDataSeries(@NotNull CpuServiceGrpc.CpuServiceBlockingStub client,
                                  Common.Session session,
                                  boolean isOtherProcess);

}