gpg-agent timer tick
Alan Jenkins
alan-jenkins at tuffmail.co.uk
Fri Jan 11 18:09:11 CET 2008
gpg-agent has a 2 second timer tick.
alan at singularity:~$ gpg-agent --daemon
GPG_AGENT_INFO=/tmp/gpg-21C85K/S.gpg-agent:28978:1; export
GPG_AGENT_INFO;
alan at singularity:~$ sudo powertop -d -t 5 | grep gpg-agent
0.2% ( 0.6) gpg-agent : schedule_timeout (process_timeout)
gpg-agent:1557:handle_connections(int listen_fd, int listen_fd_ssh):
time_ev = pth_event (PTH_EVENT_TIME, pth_timeout (2, 0));
This is potentially a Bad Thing for CPU power consumption, because it
reduces the amount of time the CPU can spend in deep sleep states. I
saw something similar in ssh-agent, but I couldn't interest anyone in my
patch. Let me know if you're interested here and I'll submit a patch.
Specifically, gpg-agent uses the timer tick to handle the case where the
"command-line" argument is present:
gpg-agent --daemon [command-line]
In that case it runs the command given. The tick handler is used to
check, every two seconds, whether the command is still running; if not,
gpg-agent quits.
A better way to do this is to run the command as a child of gpg-agent,
and rely on the SIGCHLD signal instead of a timer tick.
The timer tick is also used to check the Scdaemon (whatever that is :-)
is still running. However, since it use waitpid() to check this,
Scdaemon must already be being run a child, so that shouldn't be a problem.
I noticed this problem because I got interested the powertop project,
and gpg-agent gets started by some package management software I use.
Thanks,
Alan
More information about the Gnupg-devel
mailing list