2023-06-11 09:00:19 +02:00
|
|
|
#[cfg(feature = "tracing")]
|
2023-01-28 09:30:33 +01:00
|
|
|
use std::env;
|
2023-06-11 09:00:19 +02:00
|
|
|
|
|
|
|
#[cfg(feature = "tracing")]
|
2023-01-28 09:30:33 +01:00
|
|
|
use std::path::PathBuf;
|
|
|
|
|
2023-06-04 09:36:26 +02:00
|
|
|
#[cfg(feature = "tracing")]
|
2023-01-28 09:30:33 +01:00
|
|
|
use lttng_ust_generate::{Provider, Generator, CTFType, CIntegerType};
|
|
|
|
|
2023-06-11 09:00:19 +02:00
|
|
|
|
2023-06-04 09:36:26 +02:00
|
|
|
#[cfg(feature = "tracing")]
|
|
|
|
fn setup_tracepoints() {
|
2023-01-28 09:30:33 +01:00
|
|
|
// the provider is called calendar
|
|
|
|
let mut provider = Provider::new("calendar");
|
|
|
|
|
|
|
|
// class for drawing events
|
|
|
|
let draw_class = provider.create_class("draw")
|
|
|
|
.add_field("width", CTFType::Integer(CIntegerType::I32))
|
|
|
|
.add_field("height", CTFType::Integer(CIntegerType::I32));
|
|
|
|
|
|
|
|
// drawing events
|
|
|
|
draw_class.instantiate("draw_entry");
|
|
|
|
draw_class.instantiate("draw_exit");
|
2024-05-12 07:38:27 +02:00
|
|
|
draw_class.instantiate("draw_calendar_entry");
|
|
|
|
draw_class.instantiate("draw_calendar_exit");
|
|
|
|
draw_class.instantiate("draw_events_entry");
|
|
|
|
draw_class.instantiate("draw_events_exit");
|
2023-09-10 11:01:05 +02:00
|
|
|
|
|
|
|
// class for application events
|
|
|
|
let app_class = provider.create_class("app");
|
|
|
|
|
|
|
|
// application events
|
|
|
|
app_class.instantiate("view_entry");
|
|
|
|
app_class.instantiate("view_exit");
|
2023-01-28 09:30:33 +01:00
|
|
|
|
|
|
|
Generator::default()
|
|
|
|
.generated_lib_name("calendar_tracepoints")
|
|
|
|
.register_provider(provider)
|
|
|
|
.output_file_name(PathBuf::from(env::var("OUT_DIR").unwrap()).join("tracepoints.rs"))
|
|
|
|
.generate()
|
|
|
|
.expect("Unable to generate tracepoint bindings");
|
2023-06-04 09:36:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
#[cfg(feature = "tracing")]
|
|
|
|
setup_tracepoints();
|
|
|
|
}
|