So I suffer from neck and shoulder pain, and I have written a dmenu-based script where I can log my pain level each day in an easy, menu-based way.
Of course, there is a relationship with my time spent in front of the compuer and the pain. I would like to meaure the relationship more precisly, so I can load my measurement of pain and my computertime into R and look at correlations and the like.
But how do I get a measure of active computertime? I can get something like uptime, bt that's way too inaccurate - I'm looking for some way of measuring the time where I'm activley using the keyboard, or something like that: I have the worktimer Workrave installed, and it seems pretty good at detecting mouse and keyboard input so as to judge wether I am "working" - and the timer should be counting - and wether it's "idle" - and the timer stops. This is basically what I'm looking for.
something like procinfo might be it, from the man page:
user: The amount of time spent running jobs in user space.
nice: The amount of time spent running niced jobs in user space.
system: The amount of time spent running in kernel space. Note: the time spent servicing interrupts is not counted by the kernel (and noth‐ ing that procinfo can do about it).
idle: The amount of time spent doing nothing.
uptime: The time that the system has been up. The above four should more or less add up to this one.
So this might be it, but I'm not really sure what the "idle" type is - "the amount of time doing nothing" - is that in terms of cpu/ram usage, I'm guessing it is - and if that's the case, this is not useful for this purpose. And if not that program, what else could be used?
I'm on a Lubuntu 20.04 machine.