devel/jobwatch: report unit job transitions per tick - #1639
Alistair-Afton wants to merge 1 commit into
Conversation
|
A possibly useful note: I'm currently looking to see if there is an interposable vmethod we can use to hijack control during job auctions. It typically takes us a few days after a DF release to locate |
Per ab9rf (DFHack/scripts#1639): handle_job_applications pushes a crashlog minidump entry of type 0xf on entry and removes it on exit, giving a deterministic in-process signal for when an auction pass is running. Also records its v0.50.16 Steam/Windows address and the version-relocation caveat.
|
Useful indeed — I have recorded the 0xf minidump marker and the handle_job_applications address in the job-assignment notes (DFHack/df_misc#90). For jobwatch purposes the minidump list is probably the cheapest deterministic auction-in-flight signal short of an interposable vmethod; if you do find a clean vmethod seam, a per-pass hook would make this tool (and any future job-assignment instrumentation) strictly better. |
I did spend some time looking for one but wasn't able to locate one, at least not yet. One thing we've talked about is writing a tool that will run in a separate thread, periodically sample the crashlogger's "what am i doing" state, and generate a usage histogram so users can see what DF is spending the most time doing. The main problem with this right now is that we don't have a reliable way to find the crashlogger's state object (as it's unpublished). Maybe should ask @Putnam3145 if this variable can be exposed as a published global. |
Adds a
devel/monitor that pollsunit.job.current_jobfor all activeunits once per tick and prints a console line whenever a unit gains,
loses, or switches jobs — including switches between two jobs of the same
type, which is how claim races appear.
Useful when investigating job churn: the assignment pass runs entirely
inside the tick, so from Lua only its effects on
current_jobareobservable. Complements the external heap sampler in
DFHack/df_misc#90 (which sees the bids; this sees the outcomes).
Commands:
start/stop(orenable/disable),unit <id>|alltofilter,
verboseto also print job id, posting index, anddo_now/specialflags.Verified live on 53.16: snapshot diffing showed dozens of transitions
tracked correctly over a ~25s window (e.g. unit 112: job 169032→169037,
unit 1026: none→169122). Output goes to the DFHack console like the
other
devel/*-monitortools.