Add console commands to dump station flow stats
This commit is contained in:
@@ -2072,6 +2072,20 @@ DEF_CONSOLE_CMD(ConMapStats)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEF_CONSOLE_CMD(ConStFlowStats)
|
||||||
|
{
|
||||||
|
if (argc == 0) {
|
||||||
|
IConsoleHelp("Dump station flow stats.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern void DumpStationFlowStats(char *b, const char *last);
|
||||||
|
char buffer[32768];
|
||||||
|
DumpStationFlowStats(buffer, lastof(buffer));
|
||||||
|
PrintLineByLine(buffer);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
DEF_CONSOLE_CMD(ConDumpGameEvents)
|
DEF_CONSOLE_CMD(ConDumpGameEvents)
|
||||||
{
|
{
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
@@ -2442,6 +2456,7 @@ void IConsoleStdLibRegister()
|
|||||||
IConsoleCmdRegister("dump_cpdp_stats", ConDumpCpdpStats, nullptr, true);
|
IConsoleCmdRegister("dump_cpdp_stats", ConDumpCpdpStats, nullptr, true);
|
||||||
IConsoleCmdRegister("dump_veh_stats", ConVehicleStats, nullptr, true);
|
IConsoleCmdRegister("dump_veh_stats", ConVehicleStats, nullptr, true);
|
||||||
IConsoleCmdRegister("dump_map_stats", ConMapStats, nullptr, true);
|
IConsoleCmdRegister("dump_map_stats", ConMapStats, nullptr, true);
|
||||||
|
IConsoleCmdRegister("dump_st_flow_stats", ConStFlowStats, nullptr, true);
|
||||||
IConsoleCmdRegister("dump_game_events", ConDumpGameEvents, nullptr, true);
|
IConsoleCmdRegister("dump_game_events", ConDumpGameEvents, nullptr, true);
|
||||||
IConsoleCmdRegister("dump_load_debug_log", ConDumpLoadDebugLog, nullptr, true);
|
IConsoleCmdRegister("dump_load_debug_log", ConDumpLoadDebugLog, nullptr, true);
|
||||||
IConsoleCmdRegister("check_caches", ConCheckCaches, nullptr, true);
|
IConsoleCmdRegister("check_caches", ConCheckCaches, nullptr, true);
|
||||||
|
@@ -5007,6 +5007,24 @@ void FlowStatMap::SortStorage()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DumpStationFlowStats(char *b, const char *last)
|
||||||
|
{
|
||||||
|
btree::btree_map<uint, uint> count_map;
|
||||||
|
const Station *st;
|
||||||
|
FOR_ALL_STATIONS(st) {
|
||||||
|
for (CargoID i = 0; i < NUM_CARGO; i++) {
|
||||||
|
const GoodsEntry &ge = st->goods[i];
|
||||||
|
for (FlowStatMap::const_iterator it(ge.flows.begin()); it != ge.flows.end(); ++it) {
|
||||||
|
count_map[(uint32)it->size()]++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
b += seprintf(b, last, "Flow state shares size distribution:\n");
|
||||||
|
for (const auto &it : count_map) {
|
||||||
|
b += seprintf(b, last, "%-5u %-5u\n", it.first, it.second);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
extern const TileTypeProcs _tile_type_station_procs = {
|
extern const TileTypeProcs _tile_type_station_procs = {
|
||||||
DrawTile_Station, // draw_tile_proc
|
DrawTile_Station, // draw_tile_proc
|
||||||
GetSlopePixelZ_Station, // get_slope_z_proc
|
GetSlopePixelZ_Station, // get_slope_z_proc
|
||||||
|
Reference in New Issue
Block a user