below_model/open_source/gpu_stats_collector_plugin.rs
1// Copyright (c) Facebook, Inc. and its affiliates.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15use anyhow::Result;
16use async_trait::async_trait;
17
18use crate::collector_plugin::AsyncCollectorPlugin;
19
20pub type SampleType = gpu_stats::GpuSample;
21
22pub struct GpuStatsCollectorPlugin {}
23
24impl GpuStatsCollectorPlugin {
25 pub fn new(_logger: slog::Logger) -> Result<Self> {
26 Ok(Self {})
27 }
28}
29
30// Wrapper plugin for GpuStatsCollector
31#[async_trait]
32impl AsyncCollectorPlugin for GpuStatsCollectorPlugin {
33 type T = SampleType;
34
35 async fn try_collect(&mut self) -> Result<Option<SampleType>> {
36 Ok(None)
37 }
38}