Function updateTimeReportCompile [src]

Prototype

pub fn updateTimeReportCompile(ws: *WebServer, opts: struct { compile: *Build.Step.Compile, use_llvm: bool, stats: abi.time_report.CompileResult.Stats, ns_total: u64, llvm_pass_timings_len: u32, files_len: u32, decls_len: u32, trailing: []const u8, }) void

Parameters

ws: *WebServeropts: struct { compile: *Build.Step.Compile, use_llvm: bool, stats: abi.time_report.CompileResult.Stats, ns_total: u64, llvm_pass_timings_len: u32, files_len: u32, decls_len: u32, /// The trailing data of `abi.time_report.CompileResult`, except the step name. trailing: []const u8, }

Source

pub fn updateTimeReportCompile(ws: *WebServer, opts: struct { compile: *Build.Step.Compile, use_llvm: bool, stats: abi.time_report.CompileResult.Stats, ns_total: u64, llvm_pass_timings_len: u32, files_len: u32, decls_len: u32, /// The trailing data of `abi.time_report.CompileResult`, except the step name. trailing: []const u8, }) void { const gpa = ws.gpa; const step_idx: u32 = for (ws.all_steps, 0..) |s, i| { if (s == &opts.compile.step) break @intCast(i); } else unreachable; const old_buf = old: { ws.time_report_mutex.lock(); defer ws.time_report_mutex.unlock(); const old = ws.time_report_msgs[step_idx]; ws.time_report_msgs[step_idx] = &.{}; break :old old; }; const buf = gpa.realloc(old_buf, @sizeOf(abi.time_report.CompileResult) + opts.trailing.len) catch @panic("out of memory"); const out_header: *align(1) abi.time_report.CompileResult = @ptrCast(buf[0..@sizeOf(abi.time_report.CompileResult)]); out_header.* = .{ .step_idx = step_idx, .flags = .{ .use_llvm = opts.use_llvm, }, .stats = opts.stats, .ns_total = opts.ns_total, .llvm_pass_timings_len = opts.llvm_pass_timings_len, .files_len = opts.files_len, .decls_len = opts.decls_len, }; @memcpy(buf[@sizeOf(abi.time_report.CompileResult)..], opts.trailing); { ws.time_report_mutex.lock(); defer ws.time_report_mutex.unlock(); assert(ws.time_report_msgs[step_idx].len == 0); ws.time_report_msgs[step_idx] = buf; ws.time_report_update_times[step_idx] = ws.now(); } ws.notifyUpdate(); }