Project hours should incorporate the actual CPU workload the code produces

I recently got a bit annoyed at the project hour system, because as the admin of many linux servers who wants to test stuff out on glitch, I find that the project hours idea is great, but the execution is lacking. I’m not saying they should be increased - I think instead it would be good to incorporate the CPU workload into the calculation.

In practice, I would do this by using the load data stored by the kernel in /proc/loadavg:
0.55 0.36 0.22 [irrelevant other info follows]
The first number is the relation of used CPU time to actually passed time in the last minute, the second is the same but for 5 minutes, the third 15 minutes.

I think you see where I’m going with this. Every minute, glitch should check /proc/loadavg, take the first value, and bill for 1min * 0.55load = 0.55min which in this case would bill about 30 seconds, because that’s how much work the CPU had actually done.

This would make project hours actually reflect the complexity of the project. A project which consumes 100% CPU all the time shouldn’t be treated equal to a project that sits at 8% all the time.

Maybe the RAM usage could also be incorporated.

Also, I think it is worth mentioning that glitch seems to always run some other stuff in the background, so billing the actual CPU time of all running processes that are running as the user, or use the figures presented in the status panel makes even more sense, tho I am now sure how to accomplish this.

1 Like