mirror of
https://github.com/facebookexperimental/reverie.git
synced 2024-12-01 04:14:41 +00:00
cc40e95c91
Summary: Now that `Tool` doesn't require `Serialize` and `Deserialize`, we can remove these unnecessary derives. Hopefully this will have a slight improvement to compile-times. Reviewed By: wkhughes Differential Revision: D40958697 fbshipit-source-id: 88aa1f4ee2b953ba287d749c88d200c2887ccd46
38 lines
1 KiB
Rust
38 lines
1 KiB
Rust
/*
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
* All rights reserved.
|
|
*
|
|
* This source code is licensed under the BSD-style license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
//! This instrumentation tool intercepts events but does nothing with them. It is
|
|
//! useful for observing the overhead of interception, and as a starting point.
|
|
|
|
use clap::Parser;
|
|
use reverie::Error;
|
|
use reverie::Subscription;
|
|
use reverie::Tool;
|
|
use reverie_util::CommonToolArguments;
|
|
|
|
#[derive(Debug, Default)]
|
|
struct NoopTool;
|
|
|
|
#[reverie::tool]
|
|
impl Tool for NoopTool {
|
|
fn subscriptions(_cfg: &()) -> Subscription {
|
|
Subscription::none()
|
|
}
|
|
}
|
|
|
|
#[tokio::main]
|
|
async fn main() -> Result<(), Error> {
|
|
let args = CommonToolArguments::from_args();
|
|
let log_guard = args.init_tracing();
|
|
let tracer = reverie_ptrace::TracerBuilder::<NoopTool>::new(args.into())
|
|
.spawn()
|
|
.await?;
|
|
let (status, _global_state) = tracer.wait().await?;
|
|
drop(log_guard); // Flush logs before exiting.
|
|
status.raise_or_exit()
|
|
}
|