timers for start times for later

This commit is contained in:
Mitchell Hashimoto
2024-08-29 15:19:09 -07:00
parent e6ae8107c4
commit 6f1a062b6c
2 changed files with 16 additions and 0 deletions

View File

@ -40,6 +40,14 @@ pub const GlobalState = struct {
/// Initialize the global state. /// Initialize the global state.
pub fn init(self: *GlobalState) !void { pub fn init(self: *GlobalState) !void {
// const start = try std.time.Instant.now();
// const start_micro = std.time.microTimestamp();
// defer {
// const end = std.time.Instant.now() catch unreachable;
// // "[updateFrame critical time] <START us>\t<TIME_TAKEN us>"
// std.log.err("[global init time] start={}us duration={}ns", .{ start_micro, end.since(start) / std.time.ns_per_us });
// }
// Initialize ourself to nothing so we don't have any extra state. // Initialize ourself to nothing so we don't have any extra state.
// IMPORTANT: this MUST be initialized before any log output because // IMPORTANT: this MUST be initialized before any log output because
// the log function uses the global state. // the log function uses the global state.

View File

@ -20,6 +20,14 @@ pub fn init(gpa: Allocator) !void {
// Not supported on Windows currently, doesn't build. // Not supported on Windows currently, doesn't build.
if (comptime builtin.os.tag == .windows) return; if (comptime builtin.os.tag == .windows) return;
// const start = try std.time.Instant.now();
// const start_micro = std.time.microTimestamp();
// defer {
// const end = std.time.Instant.now() catch unreachable;
// // "[updateFrame critical time] <START us>\t<TIME_TAKEN us>"
// std.log.err("[sentry init time] start={}us duration={}ns", .{ start_micro, end.since(start) / std.time.ns_per_us });
// }
var arena = std.heap.ArenaAllocator.init(gpa); var arena = std.heap.ArenaAllocator.init(gpa);
defer arena.deinit(); defer arena.deinit();
const alloc = arena.allocator(); const alloc = arena.allocator();