# Calculate cycles burnt rate of spacific shared method

**URL:** <https://forum.dfinity.org/t/calculate-cycles-burnt-rate-of-spacific-shared-method/39287>\
**Category:** Motoko\
**Tags:** Functional-Programming, Discussing, community-consideration\
**Created:** [December 24, 2024, 9:58am UTC](https://forum.dfinity.org/t/calculate-cycles-burnt-rate-of-spacific-shared-method/39287 "2024-12-24T09:58:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alishan](https://avatars.discourse-cdn.com/v4/letter/a/d6d6ee/32.png) [@Alishan](https://forum.dfinity.org/u/Alishan)\
**Post date:** [December 24, 2024, 9:58am UTC](https://forum.dfinity.org/t/calculate-cycles-burnt-rate-of-spacific-shared-method/39287/1 "2024-12-24T09:58:59Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jennifertran](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/jennifertran/32/11558_2.png) [@jennifertran](https://forum.dfinity.org/u/jennifertran)\
**Post date:** [December 25, 2024, 11:00pm UTC](https://forum.dfinity.org/t/calculate-cycles-burnt-rate-of-spacific-shared-method/39287/2 "2024-12-25T23:00:30Z")

</div>

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

> [@Can I use the ic\_cdk::api::canister\_balance() when enter/exist a function to measure how much cycles consumed in this method?](https://forum.dfinity.org/t/can-i-use-the-ic-cdk-canister-balance-when-enter-exist-a-function-to-measure-how-much-cycles-consumed-in-this-method/33856/):
>
