In web we have PerformanceLongTaskTiming API which represents job units that occupy the UI thread.
And we have TBT metric, which measures how long browser had been blocked during page load. But we measure it only until a first quite window. And it does not cover entire page lifetime. Yes, there is new INP metric, which measure paint after interactions, but not background job.
My question is which formula for long tasks f(...long_tasks) we could use to measure web page blocking during entire page life?
There is Event Loop Lag, for example, but it was design for long running server-side applications, not for typical web pages surfing.
TBT is traditionally just the LongTasks API constrained between FCP and TTI. And it was traditionally done like that because before FCP the user is unlikely to interact with the page, and at TTI lab-based tools like Lighthouse typically stop measuring and TBT was usually measured in lab-based tools.
If you don’t want it constrained between those times then don’t constrain it to those times! Just measure all long tasks throughout the life time of the page. Many RUM products do this.
You may also wish to look at the Long Animation Frames API which is the successor to Long Tasks API and about to launch in Chrome: https://developer.chrome.com/docs/web-platform/long-animation-frames