Force kill window manager if it hangs

Sometimes the window manager hangs and blocks the UI automation. Now the
window manager process will be force killed if it does not terminates in
30 seconds.
Is there a way to actually check that the process was killed?