Skip to content

Commit 8276d5e

Browse files
committed
add system entry to activity
1 parent 59c712b commit 8276d5e

File tree

2 files changed

+25
-14
lines changed

2 files changed

+25
-14
lines changed

OSL Programs/apps/System/.Install_system.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@
249249
"path": "Origin/(A) System/User Applications",
250250
"name": "Activity.osl",
251251
"icon": "c #84d5f5 w 10 square 0 0 5 5 c #111 w 8 square 0 0 5 5 dot 0 0 w 1.5 c #84d5f5 line -7 0 -6 0 cont -5 2 cont -3 -2 cont -1 5 cont 2 -4 cont 4 0 cont 7 0",
252-
"version":"7.7"
252+
"version":"7.8"
253253
},
254254
{
255255
"url": "https://origin.mistium.com/OSL%20Programs/apps/System/Summit.osl",

OSL Programs/apps/System/Activity.osl

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,6 @@ def "tab" "name" (
2828
text name 8 : c#txtc
2929
)
3030

31-
def arrSum(arr) (
32-
local out = 0
33-
for i arr.len (
34-
out += arr[i]
35-
)
36-
return out
37-
)
38-
3931
rightclick_menu = [
4032
"Unknown",
4133
"-",
@@ -81,6 +73,15 @@ def getWindowsData() (
8173
draw: windows_drawtimes[i]
8274
})
8375
)
76+
windows_total_time = windows_draw_main.sum()
77+
number system_time = max(0, floor(((delta_time * 1000) - windows_total_time) * 10) / 10)
78+
vals.append({
79+
name: "System",
80+
time: system_time,
81+
id: -1,
82+
draw: [system_time]
83+
})
84+
windows_list.append(vals[-1])
8485

8586
vals @= vals.sortBy("time").reverse()
8687
windows_list @= windows_list.sortBy("time").reverse()
@@ -96,7 +97,7 @@ last_timer = timer
9697
next_update = 0.5
9798
high = 0
9899
low = 250
99-
graph = 1000.newArray()
100+
graph = (1 to 1000).fill(null)
100101

101102
getWindowsData()
102103

@@ -185,7 +186,7 @@ if activity_info (
185186

186187
wwm = window_width - 50 / 100
187188
whm = window_height / 300
188-
if paused.not() (
189+
if !paused (
189190
// only add to the fps usage graph when not paused
190191
// fixes: https://discord.com/channels/1147362734300725298/1336340461555552319
191192
usage = (fps / fps_limit).clamp(0,1)
@@ -206,8 +207,8 @@ loc 2 2 23 - (high.len * 5) -70
206207
text high 10
207208
loc 2 2 12 -90
208209
text "high" 7
209-
loc 2 2 23 - (low.round().len * 5) -120
210-
text low.round() 10
210+
loc 2 2 23 - (round(low).len * 5) -120
211+
text round(low) 10
211212
loc 2 2 13.5 -140
212213
text "low" 7
213214
loc 2 2 23 - (delta.len * 5) -170
@@ -243,7 +244,7 @@ if timer - last_timer > next_update and !paused (
243244
last_timer = timer
244245
dt = delta_time
245246
getWindowsData()
246-
number cpu_usage = roturLink.cpu.percent ?? (arrSum(windows_draw_main) / (1000 / fps_limit) * 100)
247+
number cpu_usage = roturLink.cpu.percent ?? (windows_total_time / (1000 / fps_limit) * 100)
247248
cpu_percent = round(cpu_usage).clamp(1,100)
248249
delta = cpu_percent ++ "%"
249250
updated = true
@@ -310,6 +311,16 @@ switch current_tab (
310311
)
311312

312313
// handle right clicking
314+
if windows_ids[count] == -1 (
315+
loc 2 2 25 y
316+
icon "origin-logo" 0.7 : c#txtc
317+
text "System" 7 : chx#20 c#txtc
318+
loc -2 2 -15 y
319+
d = windows_drawtimes[count][1]
320+
rigtext d.toStr() ++ "ms" 7
321+
y -= 40
322+
continue
323+
)
313324
object win_top @= windows_list[count] ?? {}
314325
object win @= win_top.window ?? {file: {uuid: win_top.uuid}}
315326
rightclick_menu[1] = "> " ++ win.file.uuid

0 commit comments

Comments
 (0)