0

I would like to log the amount of time I spend in front of the computer - so not uptime for the PC, but the amount of time where I'm actively using input (mouse/keyboard).

The worktimer workrave does something like that - you can set an interval and after that, it will display a break-timer. But if you don't use the mouse/keyboard for perhaps 30 secs, the timer is suspended. So it can be done.

The best I could find was procinfo, but does not seem like 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 "idle time" might be it, but it seems to be idle-time in terms of cpu-usage and not idle in the terms I need it.

I'm on a Lubuntu 20.04 machine.

emilBeBri
  • 214
  • 1
  • 3
  • 15
  • I think you just cannot do that "natively", I think you have to build/write a monitor-like script that measure time you run applications in userland (from a list) & measures additions of all times (sessions) you did work/play with the machine. Another approach is to use a camera that measure (instead of saving film) the time it detects you (from face identification) on the chair on front of the machine. – francois P Nov 20 '21 at 14:05
  • What do you mean by natively? I'm sure what you mean by that. Workrave does it. – emilBeBri Nov 20 '21 at 16:07
  • I mean from standard shell commands – francois P Nov 20 '21 at 16:42
  • hmm. seems like you're right, judging from the responses. I'm surprised no one has developed something like this (or perhaps I just don't know how to define the right search terms – emilBeBri Nov 23 '21 at 17:50
  • 1
    I'm not so suprised as far as I don"t guess in which use-cases it can be both usefull and legal all the same. It relative to human-survey so .... – francois P Nov 23 '21 at 17:57
  • You might be able to build on this. The accepted answer works great for determining how long it has been since the mouse or keyboard was used. https://askubuntu.com/q/1368345/243321 – Organic Marble Dec 18 '21 at 14:23
  • Nice, thank you – emilBeBri Dec 18 '21 at 15:15

1 Answers1

0

Workrave keeps a folder in your home dir .workrave, where there are detailed stats about your use of the computer, saved in plaintext. these can be loaded into for example R or Python to do analysis of time spent in front of the computer.

two ressources to get you going: https://github.com/oysteinbf/workrave-stats/ https://medium.com/@ianmooreisme/getting-work-done-with-workrave-b80c4337aa79

emilBeBri
  • 214
  • 1
  • 3
  • 15