blob: 331fdc343b6b51393b2a2bd5d5682c71eaa7e058 [file] [log] [blame]
/*
* Copyright 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <vector>
namespace tuningfork {
template <typename T>
class TimeSeries {
std::vector<T> data_;
public:
TimeSeries(size_t capacity) { data_.reserve(capacity); }
size_t Count() const { return data_.size(); }
void Add(const T& value) { data_.push_back(value); }
void Clear() { data_.clear(); }
const std::vector<T>& Samples() const { return data_; }
};
} // namespace tuningfork