Skip to content

Commit

Permalink
Add ODS counter for number of accelerators
Browse files Browse the repository at this point in the history
Differential Revision: D52448660
  • Loading branch information
brianc118 authored and facebook-github-bot committed Jan 2, 2024
1 parent ec1bae2 commit 1527984
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 6 additions & 2 deletions below/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,7 @@ fn record(
compress_opts.to_compression_mode()?,
store::Format::Cbor,
)?;
let mut stats = statistics::Statistics::new();
let mut stats = statistics::Statistics::new(init.clone());

let (exit_buffer, bpf_errs) = if disable_exitstats {
(Arc::new(Mutex::new(procfs::PidMap::new())), None)
Expand Down Expand Up @@ -1058,13 +1058,17 @@ fn record(

match collected_sample {
Ok(s) => {
match store.put(post_collect_sys_time, &DataFrame { sample: s }) {
let frame = DataFrame { sample: s };
match store.put(post_collect_sys_time, &frame) {
Ok(/* new shard */ true) => {
cleanup_store(&store, &logger, store_size_limit, /* retention */ None)?
}
Ok(/* new shard */ false) => {}
Err(e) => error!(logger, "{:#}", e),
}
if below_config.enable_gpu_stats {
stats.report_nr_accelerators(&frame.sample);
}
}
Err(e) => {
// Handle cgroupfs errors
Expand Down
6 changes: 4 additions & 2 deletions below/src/open_source/statistics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,18 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use std::path::Path;
use crate::init;

pub struct Statistics {}

impl Statistics {
pub fn new() -> Statistics {
pub fn new(_init_token: init::InitToken) -> Statistics {
Statistics {}
}

pub fn report_store_size<P: AsRef<Path>>(&mut self, _dir: P) {}

pub fn report_collection_skew(&mut self) {}

pub fn report_nr_accelerators(&mut self, &model::Sample: sample) {}
}

0 comments on commit 1527984

Please sign in to comment.