Personally, I would take the stats_logging route with SQLX. An sqlstats_logging plugin would be fairly easy to make. If you make a thread in the Scripting section, I can give you some pointers.
Where are those lines of code where stats are written into csstats.dat?? In Module? :/