about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--extrace.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/extrace.c b/extrace.c
index 9f5f166..9753f43 100644
--- a/extrace.c
+++ b/extrace.c
@@ -362,12 +362,21 @@ handle_msg(struct cn_msg *cn_hdr)
 
 		if (show_exit || !flat) {
 			for (i = 0; i < PID_DB_SIZE - 1; i++)
-				if (pid_db[i].pid == 0)
+				if (pid_db[i].pid == 0 || pid_db[i].pid == pid)
 					break;
 			if (i == PID_DB_SIZE - 1)
 				print_runtime_error("extrace: warning: pid_db of "
 				    "size %d overflowed\n", PID_DB_SIZE);
 
+			if (show_exit && pid_db[i].pid == pid) {
+				if (!flat)
+					fprintf(output, "%*s", 2*d, "");
+				fprintf(output, "%d- %s execed time=%.3fs\n",
+				    pid,
+				    pid_db[i].cmdline,
+				    (ev->timestamp_ns - pid_db[i].start) / 1e9);
+			}
+
 			pid_db[i].pid = pid;
 			pid_db[i].depth = d;
 			pid_db[i].start = ev->timestamp_ns;