feat: add scheduler ui
This commit is contained in:
parent
45655233cf
commit
77530c1b09
|
@ -362,6 +362,28 @@ pub const Gui = struct {
|
||||||
zgui.text(" 1% Low: {:0>3} fps", .{stats[2]});
|
zgui.text(" 1% Low: {:0>3} fps", .{stats[2]});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
_ = zgui.begin("Scheduler", .{});
|
||||||
|
defer zgui.end();
|
||||||
|
|
||||||
|
const scheduler = cpu.sched;
|
||||||
|
|
||||||
|
zgui.text("tick: {X:0>16}", .{scheduler.tick});
|
||||||
|
zgui.separator();
|
||||||
|
|
||||||
|
const Event = std.meta.Child(@TypeOf(scheduler.queue.items));
|
||||||
|
|
||||||
|
var items: [20]Event = undefined;
|
||||||
|
const len = scheduler.queue.len;
|
||||||
|
|
||||||
|
std.mem.copy(Event, &items, scheduler.queue.items);
|
||||||
|
std.sort.sort(Event, items[0..len], {}, widgets.eventDesc(Event));
|
||||||
|
|
||||||
|
for (items[0..len]) |event| {
|
||||||
|
zgui.text("{X:0>16} | {?}", .{ event.tick, event.kind });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
zgui.showDemoWindow(null);
|
zgui.showDemoWindow(null);
|
||||||
}
|
}
|
||||||
|
@ -628,4 +650,12 @@ const widgets = struct {
|
||||||
zgui.sameLine(.{});
|
zgui.sameLine(.{});
|
||||||
zgui.text("{s}", .{mode});
|
zgui.text("{s}", .{mode});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn eventDesc(comptime T: type) fn (void, T, T) bool {
|
||||||
|
return struct {
|
||||||
|
fn inner(_: void, left: T, right: T) bool {
|
||||||
|
return left.tick > right.tick;
|
||||||
|
}
|
||||||
|
}.inner;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue