Need clarity on how singlestore computes Total CPU percent

I recently came across active profiling and I’m trying to understand how does it work. So I read a blog where it mentioned upon initiating manual profiling, Singlestore takes a snapshot of the mv_activities and after the manual duration ends it takes a snapshot again and then compares both the tables to get the total cpu percent which will be displayed after profiling

My questions over here are :

  • how the total CPU percent is calculated? I tried calculating in the similar way but I couldn’t arrive nearby the values which singlestore shows on the screen. The formula I’m trying to apply in → case 1 : if the cpu time of snap shot 2 > cpu time of snap shot 1 : then cpu time 2 - cpu time 1 / duration window * 1000 case 2 : if cpu time 1 >= cpu time 2 : then cpu time 2 / duration window * 1000 Assuming that this will be the formula. I also tried adding the no of VCPUs in the denominator but still I couldn’t get somewhere nearer to the answer. Should I multiply no of vcpus to denominator or divide the CPU time by total run count (run_count + success_count + failure_count)?

  • How frequent or what’s the criteria for mv_activities table to get refreshed?