2019-01-21 14:03:30 -05:00
|
|
|
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
2018-10-31 03:32:42 -04:00
|
|
|
#![allow(unused_imports)]
|
|
|
|
#![allow(dead_code)]
|
2019-01-15 07:06:25 -05:00
|
|
|
#![cfg_attr(
|
|
|
|
feature = "cargo-clippy",
|
|
|
|
allow(clippy::all, clippy::pedantic)
|
|
|
|
)]
|
2019-04-09 13:11:25 -04:00
|
|
|
use crate::state;
|
2018-10-31 03:32:42 -04:00
|
|
|
use flatbuffers;
|
2018-11-29 22:03:00 -05:00
|
|
|
use std::sync::atomic::Ordering;
|
|
|
|
|
2018-11-01 01:06:55 -04:00
|
|
|
// GN_OUT_DIR is set either by build.rs (for the Cargo build), or by
|
|
|
|
// build_extra/rust/run.py (for the GN+Ninja build).
|
2019-03-30 14:45:36 -04:00
|
|
|
include!(concat!(env!("GN_OUT_DIR"), "/gen/cli/msg_generated.rs"));
|
2018-11-29 22:03:00 -05:00
|
|
|
|
2019-04-09 13:11:25 -04:00
|
|
|
impl<'a> From<&'a state::Metrics> for MetricsResArgs {
|
|
|
|
fn from(m: &'a state::Metrics) -> Self {
|
2018-11-29 22:03:00 -05:00
|
|
|
MetricsResArgs {
|
|
|
|
ops_dispatched: m.ops_dispatched.load(Ordering::SeqCst) as u64,
|
|
|
|
ops_completed: m.ops_completed.load(Ordering::SeqCst) as u64,
|
|
|
|
bytes_sent_control: m.bytes_sent_control.load(Ordering::SeqCst) as u64,
|
|
|
|
bytes_sent_data: m.bytes_sent_data.load(Ordering::SeqCst) as u64,
|
|
|
|
bytes_received: m.bytes_received.load(Ordering::SeqCst) as u64,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|