Skip to content

Commit

Permalink
moves the subsystem report to a new tab, adds a runtime counter
Browse files Browse the repository at this point in the history
  • Loading branch information
BurgerLUA committed Jun 28, 2023
1 parent c1ed408 commit 13592ed
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 11 deletions.
1 change: 1 addition & 0 deletions code/__defines/chat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#define CHAT_TYPE_COMBAT 0x8
#define CHAT_TYPE_RADIO (CHAT_TYPE_SAY)
#define CHAT_TYPE_PM (CHAT_TYPE_OOC | CHAT_TYPE_LOOC)
#define CHAT_TYPE_DEBUG 0x10

#define CHAT_TYPE_INFO CHAT_TYPE_SAY

Expand Down
5 changes: 4 additions & 1 deletion code/_core/client/chat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

var/output_target_list = list()

if(!(chat_type & CHAT_TYPE_COMBAT))
if(!(chat_type & (CHAT_TYPE_COMBAT|CHAT_TYPE_DEBUG)))
output_target_list += "chat_all.output"

if(chat_type & CHAT_TYPE_SAY)
Expand All @@ -27,6 +27,9 @@
if(chat_type & CHAT_TYPE_COMBAT)
output_target_list += "chat_combat.output"

if(chat_type & CHAT_TYPE_DEBUG)
output_target_list += "chat_debug.output"

if(chat_type & CHAT_TYPE_RADIO) //Prevents radio spam if you heard it already.
for(var/k in queued_chat_messages)
var/list/message_data = k
Expand Down
3 changes: 3 additions & 0 deletions code/_core/world/error.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ var/global/list/tracker_errors_spam = list()

/world/Error(var/exception/e)

if(SSreport)
SSreport.runtime_count += 1

var/error_title = "[e.name] in [e.file]:[e.line]"
var/error_details = "[e.desc]"

Expand Down
2 changes: 1 addition & 1 deletion code/_core/world/subsystems/logging.dm
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ SUBSYSTEM_DEF(logging)
list(
list(
"text" = span(identifier,log_string),
"output_target_list" = list("chat_all.output")
"output_target_list" = (identifier_to_rank[identifier] & FLAG_PERMISSION_DEVELOPER) ? list("chat_debug.output") : list("chat_all.output")
)
)
)
Expand Down
10 changes: 6 additions & 4 deletions code/_core/world/subsystems/report.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ SUBSYSTEM_DEF(report)
var/min_tick = INFINITY
var/max_tick = -INFINITY

var/runtime_count = 0

var/next_report = 0
var/profiling = 0

Expand Down Expand Up @@ -70,7 +72,8 @@ SUBSYSTEM_DEF(report)
Tick Usage: (\
MIN:<div class='[min_tick >= 50 ? "red bold" : "blue bold"]'>[min_tick]%</div>, \
MAX:<div class='[max_tick >= 90 ? "red bold" : "blue bold"]'>[max_tick]%</div>, \
AVG:<div class='[average_tick >= 75 ? "red bold" : "blue bold"]'>[average_tick]%</div>)<br>"
AVG:<div class='[average_tick >= 75 ? "red bold" : "blue bold"]'>[average_tick]%</div>)<br>\
Runtime Count:<div class='[runtime_count > 0 ? "red bold" : "blue bold"]'>[runtime_count]</div><br>"

if(length(sorted_profile_output_self))
string_to_send += "<u>Most Expensive Procs (self CPU%):</u><br>"
Expand All @@ -88,16 +91,15 @@ SUBSYSTEM_DEF(report)
var/value = sorted_profile_output_real[name]
string_to_send += "[name]: <div class='[value >= PROFILING_DELAY_SECONDS*0.5 ? "red bold" : "blue bold"]'>[CEILING(value,0.01)]</div> seconds.<br>"



broadcast_to_clients(span("debug",string_to_send))
broadcast_to_clients(span("debug",string_to_send),CHAT_TYPE_DEBUG)

average_cpu = initial(average_cpu)
min_cpu = initial(min_cpu)
max_cpu = initial(max_cpu)
average_tick = initial(average_tick)
min_tick = initial(min_tick)
max_tick = initial(max_tick)
runtime_count = initial(runtime_count)

profiling = FALSE

Expand Down
1 change: 1 addition & 0 deletions interface/interface.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
winset(src,"chat_combat.output","style='body{background-color:[white];}[STYLESHEET]'")
winset(src,"chat_looc.output","style='body{background-color:[white];}[STYLESHEET]'")
winset(src,"chat_ooc.output","style='body{background-color:[white];}[STYLESHEET]'")
winset(src,"chat_debug.output","style='body{background-color:[white];}[STYLESHEET]'")
winset(src,"chat_say.output","style='body{background-color:[white];}[STYLESHEET]'")

winset(src,"control.input","text-color=[white]")
Expand Down
29 changes: 24 additions & 5 deletions interface/interface.dmf
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ window "chat"
size = 800x800
anchor1 = -1,-1
anchor2 = -1,-1
background-color = none
saved-params = "pos;size;is-minimized;is-maximized"
title = "Chat Tabs"
titlebar = false
Expand All @@ -167,6 +168,8 @@ window "chat"
can-minimize = false
can-resize = false
is-pane = true
outer-size = 814x814
inner-size = 800x800
elem "tab"
type = TAB
pos = 0,0
Expand All @@ -175,8 +178,9 @@ window "chat"
anchor2 = 100,100
font-family = "Arial Narrow"
font-size = 10
background-color = none
saved-params = ""
tabs = "chat_all,chat_say,chat_looc,chat_ooc,chat_combat"
tabs = "chat_all,chat_say,chat_looc,chat_ooc,chat_combat,chat_debug"
current-tab = "chat_all"

window "chat_all"
Expand Down Expand Up @@ -230,6 +234,25 @@ window "chat_combat"
anchor2 = 100,100
saved-params = "max-lines"

window "chat_debug"
elem "chat_debug"
type = MAIN
pos = 281,0
size = 800x800
anchor1 = -1,-1
anchor2 = -1,-1
saved-params = "pos;size;is-minimized;is-maximized"
title = "Debug"
is-pane = true
can-scroll = vertical
elem "output"
type = OUTPUT
pos = 0,0
size = 800x800
anchor1 = 0,0
anchor2 = 100,100
saved-params = "max-lines"

window "chat_looc"
elem "chat_looc"
type = MAIN
Expand Down Expand Up @@ -385,20 +408,16 @@ window "edit"
size = 640x480
anchor1 = -1,-1
anchor2 = -1,-1
background-color = none
is-visible = false
border = sunken
saved-params = "pos;size;is-minimized;is-maximized"
title = "Edit"
outer-size = 656x538
inner-size = 640x499
elem "exit"
type = BUTTON
pos = 540,460
size = 100x20
anchor1 = 100,100
anchor2 = 100,100
background-color = none
saved-params = "is-checked"
text = "Save and Exit"
command = ""
Expand Down

0 comments on commit 13592ed

Please sign in to comment.