Bastian <bastian-fvwm-org-20121...@t6l.de> writes:

> On 02Jun14 01:44 +0200, lee wrote:
>> des...@verizon.net (Dan.Espen) writes:
>> 
>> > lee <l...@yun.yagibdah.de> writes:
>> >
>> >> Hi,
>> >>
>> >> I would like to make a function that suspends the corresponding process
>> >> when I iconify a window and unsuspends it when I uniconify the window.
>> >>
>> >> Particularly, I want to (un-)suspend seamonkey with this (because it
>> >> uses ridiculous amounts of CPU time and memory the latter of which might
>> >> be swapped out more easily when the process is suspended than when it is
>> >> not).
>
> Have you thought about this process is behaving mad? buggy? memory
> leaking? 

It`s seamonkey, and I haven`t found a good replacement for it yet.
Other than needing resources like every other comparable web browser,
it`s working remarkably well.

> I would assume STOPPING STARTING is _not_ a solution to this kind of
> problem.

It`s a nice workaround.  Do you have a solution?

> Btw, try to find an overall load on your machine which does _not_
> require memory swapping. 

That would require to not use some applications I`m using the most, and
it won`t solve the problem of wasting CPU time.

>> >> The kill command works nicely for it, i. e. 'kill -STOP <PID of
>> >> process>' and 'kill -CONT <PID of process>' work fine.
>> >>
>> >> I googled for a solution and found some suggestions as to obtain the
>> >> process ID, yet none of them seemed to work.  Since seamonkey is usually
>> >> started through fvwm with a starter function, I might be able to obtain
>> >> the PID when starting it and use that.  However, this approach would be
>> >> somewhat limited.
>> >
>> > X windows don't have an associated PID, after all, the window might be
>> > from a remote system.
>> >
>> > For your case, pgrep might give you the PID.
>
> To increase the probability to chose the correct PID to SIGSTOP, try to
> run xprop on the window ID. This will give you among others:
>
>   WM_CLIENT_MACHINE(STRING) = "${YOUR_HOSTNAME}"
>   WM_COMMAND(STRING) = { "xlogo", "-rv" }
>
> Here you can see the window id is attached to a process running on
> YOUR_HOSTNAME and this process was started with the command (in the
> above example)  $(xlogo -rv).

That`s nice for verification, thanks.  What I`m having trouble with is
how to use things like this with fvwm.  It`s easy to get very unexpected
results and very difficult to debug.

>> Hm, it would be better to remember the PID when starting the application
>> and then use it to suspend it.  I`m not sure yet how to do that, though
>> ...
>
> Setting and remembering the PID when starting seamonkey, could be solved
> by using an environment variable.  But this requires that seamonkey is
> startet via a fvwm function which in turn sets this variable.
> Starting seamonkey from e.g. a console would by-pass this mechanism.

It`s already started from a function, so that would work.


-- 
Knowledge is volatile and fluid.  Software is power.

Reply via email to