summaryrefslogtreecommitdiff
path: root/src/termio/Thread.zig
diff options
context:
space:
mode:
authorMitchell Hashimoto <mitchell.hashimoto@gmail.com>2022-11-07 07:45:46 -0800
committerMitchell Hashimoto <mitchell.hashimoto@gmail.com>2022-11-07 07:45:46 -0800
commit5b52333e51042053d17dee8122bd36953fd66b68 (patch)
treec26ad6b4c29165bd468a9f95baf3651571fd7686 /src/termio/Thread.zig
parent46a99987620abe2d0b16ad42ee4b2c238c0aa5fd (diff)
name threads and add more tracing
Diffstat (limited to 'src/termio/Thread.zig')
-rw-r--r--src/termio/Thread.zig10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/termio/Thread.zig b/src/termio/Thread.zig
index af175aeab..e8db4d3ff 100644
--- a/src/termio/Thread.zig
+++ b/src/termio/Thread.zig
@@ -7,6 +7,8 @@ const builtin = @import("builtin");
const libuv = @import("libuv");
const termio = @import("../termio.zig");
const BlockingQueue = @import("../blocking_queue.zig").BlockingQueue;
+const tracy = @import("tracy");
+const trace = tracy.trace;
const Allocator = std.mem.Allocator;
const log = std.log.scoped(.io_thread);
@@ -133,6 +135,8 @@ pub fn threadMain(self: *Thread) void {
}
fn threadMain_(self: *Thread) !void {
+ tracy.setThreadName("pty io");
+
// Run our thread start/end callbacks. This allows the implementation
// to hook into the event loop as needed.
var data = try self.impl.threadEnter(self.loop);
@@ -151,6 +155,9 @@ fn threadMain_(self: *Thread) !void {
/// Drain the mailbox, handling all the messages in our terminal implementation.
fn drainMailbox(self: *Thread) !void {
+ const zone = trace(@src());
+ defer zone.end();
+
// This holds the mailbox lock for the duration of the drain. The
// expectation is that all our message handlers will be non-blocking
// ENOUGH to not mess up throughput on producers.
@@ -184,6 +191,9 @@ fn drainMailbox(self: *Thread) !void {
}
fn wakeupCallback(h: *libuv.Async) void {
+ const zone = trace(@src());
+ defer zone.end();
+
const t = h.getData(Thread) orelse {
// This shouldn't happen so we log it.
log.warn("wakeup callback fired without data set", .{});