Skip to content

Commit

Permalink
Fix printed information
Browse files Browse the repository at this point in the history
  • Loading branch information
ruilopesm committed May 13, 2023
1 parent bc5ae79 commit 03d62a3
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/tracer.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ int execute_program(char *full_program, char **parsed_program, int monitor_fd) {

if (child_pid == 0) {
// Child
wprintf("Running PID %d\n", pid);

PROGRAM_INFO *execute_info =
create_program_info(pid, full_program, start_time);
write_to_fd(monitor_fd, execute_info, sizeof(PROGRAM_INFO), NEW);
Expand Down Expand Up @@ -210,9 +212,9 @@ int execute_status(int monitor_fd) {
timeval_subtract(&diff, &current_timestamp, &answer_data->initial_timestamp);

while (type != DONE) {
printf(
"Program '%s' running (%d) for %.3lf ms\n", answer_data->command,
answer_data->pid, timeval_to_ms(&diff)
wprintf(
"%d %s %.3lf ms\n", answer_data->pid, answer_data->command,
timeval_to_ms(&diff)
);
answer_data = read_from_fd(pid_fd, &type);
}
Expand Down Expand Up @@ -242,6 +244,8 @@ int execute_pipeline(
pid_t child_pid = fork();
if (child_pid == 0) {
// Child
wprintf("Running PID %d\n", pid);

PROGRAM_INFO *info = create_program_info(pid, pipeline, start_time);
write_to_fd(monitor_fd, info, sizeof(PROGRAM_INFO), PIPELINE);

Expand Down

0 comments on commit 03d62a3

Please sign in to comment.