2021-12-30 00:14:23 +00:00
|
|
|
/*
|
2022-06-02 18:51:06 +00:00
|
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
2021-12-30 00:14:23 +00:00
|
|
|
* 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.
|
|
|
|
|
2022-10-03 19:18:55 +00:00
|
|
|
use clap::Parser;
|
2022-06-30 21:56:20 +00:00
|
|
|
use reverie::Error;
|
|
|
|
use reverie::Subscription;
|
|
|
|
use reverie::Tool;
|
2021-12-30 00:14:23 +00:00
|
|
|
use reverie_util::CommonToolArguments;
|
|
|
|
|
2022-11-03 19:53:11 +00:00
|
|
|
#[derive(Debug, Default)]
|
2021-12-30 00:14:23 +00:00
|
|
|
struct NoopTool;
|
|
|
|
|
|
|
|
#[reverie::tool]
|
|
|
|
impl Tool for NoopTool {
|
2022-11-18 20:36:51 +00:00
|
|
|
type GlobalState = ();
|
|
|
|
type ThreadState = ();
|
|
|
|
|
2021-12-30 00:14:23 +00:00
|
|
|
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()
|
|
|
|
}
|