I fully agree that using the line by line monitor is the way to go, take a look at  %Monitor.System.LineByLine.cls which provides an API to turn this on/off and get information out of the line by line monitoring.

Also for mapping INT lines back to source lines you can look at the API in %Studio.Debugger.cls in method  SourceLine. This class does say it is internal but I think this particular method should be fine to use.

This is not possible, as you suggest you should put the methods you wish to call at generator time in another class and make sure you create a dependency with this other class using the 'DependsOn' keyword to make sure we fully compile this other class first.

If you want the sizes of a lot of routines the Studio open dialog query is very handy and you can sort by the routine size too. There is also a routine specific query in %Routine class to, but if you need to see classes, or CSP pages etc then the open dialog query is the best:

d ##class(%ResultSet).RunQuery("%RoutineMgr","StudioOpenDialog","*.*",,,,1)