toolPageGenerationStarted constant is defined very early in script execution (in fact, it is part of my debugging framework, and included before any other scripts, if available).
Not that it matters for 5.4, but for earlier versions you get more reliable results.