#[perf]
Expand description
Wrap the method call with near_performance_metrics::stats::measure_performance function.
This derive can be used to provide performance metrics to method calls with Actors. Currently
we print performance stats per thread every minute, and we print a warning whenever a function
call exceeds took more than given time limit. It should have no performance impact unless
performance_stats
feature is enabled.
This function assumes it wraps around a method with &mut self, msg: NetworkClientMessages, ctx: &mut Self::Context<Self>
as arguments. There is currently a requirement that the second
argument is called msg.
§Examples
ⓘ
pub enum MyMessage {
ExampleMessage()
}
pub struct ExampleResponse {}
use actix::Context;
impl Handler<NetworkClientMessages> for ClientActor {
type Result = ExampleResponse;
#[perf]
fn handle(&mut self, msg: NetworkClientMessages, ctx: &mut Self::Context<Self>) -> Self::Result {
ExampleResponse{}
}
}