Skip to content

Commit cfe686e

Browse files
committed
feat: add new FIFO cmds
1 parent b260b17 commit cfe686e

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/shared.zig

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ pub const MarkerType = union(enum) {
3636
}
3737
};
3838

39+
pub const IntegrationMode = enum {
40+
Perf,
41+
Valgrind,
42+
Analysis,
43+
};
44+
3945
pub const Command = union(enum) {
4046
ExecutedBenchmark: struct {
4147
pid: u32,
@@ -55,6 +61,8 @@ pub const Command = union(enum) {
5561
marker: MarkerType,
5662
},
5763
SetVersion: u64,
64+
GetIntegrationMode,
65+
IntegrationModeResponse: IntegrationMode,
5866

5967
pub fn deinit(self: Command, allocator: std.mem.Allocator) void {
6068
switch (self) {
@@ -64,6 +72,8 @@ pub const Command = union(enum) {
6472
},
6573
.ExecutedBenchmark => |data| allocator.free(data.uri),
6674
.SetVersion => {},
75+
.GetIntegrationMode => {},
76+
.IntegrationModeResponse => {},
6777
else => {},
6878
}
6979
}
@@ -86,6 +96,8 @@ pub const Command = union(enum) {
8696
.Err => try writer.writeAll("Err"),
8797
.AddMarker => |data| try writer.print("AddMarker {{ pid: {d}, marker: {} }}", .{ data.pid, data.marker }),
8898
.SetVersion => |data| try writer.print("SetVersion {{ protocol_version: {d} }}", .{data}),
99+
.GetIntegrationMode => try writer.writeAll("GetIntegrationMode "),
100+
.IntegrationModeResponse => |mode| try writer.print("IntegrationModeResponse {}", .{mode}),
89101
}
90102
}
91103

@@ -129,6 +141,14 @@ pub const Command = union(enum) {
129141
.SetVersion => |other_data| self_data == other_data,
130142
else => false,
131143
},
144+
.GetIntegrationMode => switch (other) {
145+
.GetIntegrationMode => true,
146+
else => false,
147+
},
148+
.IntegrationModeResponse => |self_mode| switch (other) {
149+
.IntegrationModeResponse => |other_mode| self_mode == other_mode,
150+
else => false,
151+
},
132152
};
133153
}
134154
};

0 commit comments

Comments
 (0)