@@ -15,10 +15,45 @@ SUBSYSTEM_DEF(time_track)
15
15
var /last_tick_realtime = 0
16
16
var /last_tick_byond_time = 0
17
17
var /last_tick_tickcount = 0
18
+ #ifdef SENDMAPS_PROFILE
19
+ var /list /sendmaps_names_map = list (
20
+ " SendMaps" = " send_maps" ,
21
+ " SendMaps: Initial housekeeping" = " initial_house" ,
22
+ " SendMaps: Cleanup" = " cleanup" ,
23
+ " SendMaps: Client loop" = " client_loop" ,
24
+ " SendMaps: Per client" = " per_client" ,
25
+ " SendMaps: Per client: Deleted images" = " deleted_images" ,
26
+ " SendMaps: Per client: HUD update" = " hud_update" ,
27
+ " SendMaps: Per client: Statpanel update" = " statpanel_update" ,
28
+ " SendMaps: Per client: Map data" = " map_data" ,
29
+ " SendMaps: Per client: Map data: Check eye position" = " check_eye_pos" ,
30
+ " SendMaps: Per client: Map data: Update chunks" = " update_chunks" ,
31
+ " SendMaps: Per client: Map data: Send turfmap updates" = " turfmap_updates" ,
32
+ " SendMaps: Per client: Map data: Send changed turfs" = " changed_turfs" ,
33
+ " SendMaps: Per client: Map data: Send turf chunk info" = " turf_chunk_info" ,
34
+ " SendMaps: Per client: Map data: Send obj changes" = " obj_changes" ,
35
+ " SendMaps: Per client: Map data: Send mob changes" = " mob_changes" ,
36
+ " SendMaps: Per client: Map data: Send notable turf visual contents" = " send_turf_vis_conts" ,
37
+ " SendMaps: Per client: Map data: Send pending animations" = " pending_animations" ,
38
+ " SendMaps: Per client: Map data: Look for movable changes" = " look_for_movable_changes" ,
39
+ " SendMaps: Per client: Map data: Look for movable changes: Check notable turf visual contents" = " check_turf_vis_conts" ,
40
+ " SendMaps: Per client: Map data: Look for movable changes: Check HUD/image visual contents" = " check_hud/image_vis_contents" ,
41
+ " SendMaps: Per client: Map data: Look for movable changes: Loop through turfs in range" = " turfs_in_range" ,
42
+ " SendMaps: Per client: Map data: Look for movable changes: Movables examined" = " movables_examined" ,
43
+ )
44
+ #endif
18
45
19
46
/ datum / controller/ subsystem/ time_track/ Initialize(start_timeofday)
20
47
. = .. ()
21
48
GLOB . perf_log = " [ GLOB . log_directory] /perf- [ GLOB . round_id ? GLOB . round_id : " NULL" ] - [ SSmapping. config?. map_name] .csv"
49
+ #ifdef SENDMAPS_PROFILE
50
+ world . Profile(PROFILE_RESTART , type = " sendmaps" )
51
+ // Need to do the sendmaps stuff in its own file, since it works different then everything else
52
+ var /list /sendmaps_shorthands = list ()
53
+ for (var /proper_name in sendmaps_names_map)
54
+ sendmaps_shorthands += sendmaps_names_map[proper_name]
55
+ sendmaps_shorthands += " [ sendmaps_names_map[proper_name]] _count"
56
+ #endif
22
57
log_perf (
23
58
list (
24
59
" time" ,
@@ -42,7 +77,11 @@ SUBSYSTEM_DEF(time_track)
42
77
" air_network_count" ,
43
78
" air_delta_count" ,
44
79
" air_superconductive_count"
80
+ #ifdef SENDMAPS_PROFILE
81
+ ) + sendmaps_shorthands
82
+ #else
45
83
)
84
+ #endif
46
85
)
47
86
48
87
/ datum / controller/ subsystem/ time_track/ fire()
@@ -65,6 +104,21 @@ SUBSYSTEM_DEF(time_track)
65
104
last_tick_realtime = current_realtime
66
105
last_tick_byond_time = current_byondtime
67
106
last_tick_tickcount = current_tickcount
107
+
108
+ #ifdef SENDMAPS_PROFILE
109
+ var /sendmaps_json = world . Profile(PROFILE_REFRESH , type = " sendmaps" , format= " json" )
110
+ var /list /send_maps_data = json_decode(sendmaps_json)
111
+ var /send_maps_sort = send_maps_data. Copy() // Doing it like this guarentees us a properly sorted list
112
+
113
+ for (var /list /packet in send_maps_data)
114
+ send_maps_sort[packet[" name" ]] = packet
115
+
116
+ var /list /send_maps_values = list ()
117
+ for (var /list /packet in send_maps_sort)
118
+ send_maps_values += packet[" value" ]
119
+ send_maps_values += packet[" calls" ]
120
+ #endif
121
+
68
122
SSblackbox. record_feedback(" associative" , " time_dilation_current" , 1 , list (" [ SQLtime()] " = list (" current" = " [ time_dilation_current] " , " avg_fast" = " [ time_dilation_avg_fast] " , " avg" = " [ time_dilation_avg] " , " avg_slow" = " [ time_dilation_avg_slow] " )))
69
123
log_perf (
70
124
list (
@@ -89,5 +143,21 @@ SUBSYSTEM_DEF(time_track)
89
143
length (SSair. networks),
90
144
length (SSair. high_pressure_delta),
91
145
length (SSair. active_super_conductivity)
146
+ #ifdef SENDMAPS_PROFILE
147
+ ) + send_maps_values
148
+ #else
92
149
)
150
+ #endif
93
151
)
152
+
153
+ #ifdef SENDMAPS_PROFILE
154
+ / datum / controller/ subsystem/ time_track/ proc / scream_maptick_data()
155
+ var /current_profile_data = world . Profile(PROFILE_REFRESH , type = " sendmaps" , format= " json" )
156
+ log_world (current_profile_data)
157
+ current_profile_data = json_decode(current_profile_data)
158
+ var /output = " "
159
+ for (var /list /entry in current_profile_data)
160
+ output += " [ entry[" name" ]] , [ entry[" value" ]] , [ entry[" calls" ]] \n "
161
+ log_world (output)
162
+ return output
163
+ #endif
0 commit comments