Skip to content

Commit 235bb5c

Browse files
committed
[TOGSim] Add comments feature in trace files
1 parent 09753bc commit 235bb5c

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

Simulator/simulator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ def __init__(self, config_path=None, togsim_path=None) -> None:
238238
self.fifo_dir = os.path.join("/tmp", f"togsim_fifo_{os.getpid()}")
239239
os.makedirs(self.fifo_dir, exist_ok=True)
240240
self.trace_file_path = os.path.join(self.fifo_dir, "cmd_fifo")
241-
self.trace_log = ""
241+
self.trace_log = "# command_type, kernel_id, device_index, stream_index, tog_path, attribute_path, timestamp\n"
242242

243243
# Create FIFOs if they don't exist
244244
if os.path.exists(self.trace_file_path):

TOGSim/src/main.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ void process_trace_file(Simulator* simulator, std::string trace_file_path, const
3939
continue;
4040
}
4141

42+
// Skip comment lines starting with #
43+
if (line[0] == '#') {
44+
continue;
45+
}
46+
4247
// Parse command: command_type,kernel_id,device_index,stream_index,tog_path,attribute_path,timestamp
4348
std::istringstream iss(line);
4449
std::string token;
@@ -119,14 +124,14 @@ int main(int argc, char** argv) {
119124

120125
/* Create simulator */
121126
cmd_parser.set_if_defined("config", &config_path);
122-
127+
123128
// Load config once for reuse
124129
YAML::Node config_yaml;
125130
if (!loadConfig(config_path, config_yaml)) {
126131
spdlog::error("[TOGSim] Failed to load config file: {}", config_path);
127132
exit(1);
128133
}
129-
134+
130135
auto simulator = create_simulator(config_yaml);
131136

132137
// Get trace file path

0 commit comments

Comments
 (0)