Calculate cycles burnt rate of spacific shared method

hi there,
i want to calculate cycles burn rate of spacific method of my canister . is there any way to calculate it,
public shared func exampleMethod() : async () {
let cycles_before = Cycles.balance();
// Perform operations here
let cycles_after = Cycles.balance();
Debug.print("Cycles before: " # Int.toText(cycles_before));
Debug.print("Cycles after: " # Int.toText(cycles_after));
}
i use this as example but i don’t know why it return me 0 before and after .
Developers DFINITY

Check out this forum post where we discussed why you cannot use cycles.balance and you should use the performance counter instead:

1 Like