From db1a3056296ea3ed13c5a425cf1f11602b43a6c7 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Tue, 17 Sep 2024 09:37:14 -0400 Subject: Add pool summary and elapsed time output * Add get_task_duration() * Add get_pool_show_summary() * Add signaled_by member to MultiProcessingTask * Add time_data member to MultiProcessingTask for duration tracking --- include/multiprocessing.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'include') diff --git a/include/multiprocessing.h b/include/multiprocessing.h index 4e89722..2356403 100644 --- a/include/multiprocessing.h +++ b/include/multiprocessing.h @@ -15,9 +15,14 @@ struct MultiProcessingTask { pid_t pid; ///< Program PID pid_t parent_pid; ///< Program PID (parent process) int status; ///< Child process exit status + int signaled_by; ///< Last signal received, if any char ident[255]; ///< Identity of the pool task char log_file[255]; ///< Path to stdout/stderr log file char parent_script[PATH_MAX]; ///< Path to temporary script executing the task + struct { + struct timespec t_start; + struct timespec t_stop; + } time_data; ///< Wall-time counters }; struct MultiProcessingPool { @@ -103,6 +108,13 @@ struct MultiProcessingTask *mp_task(struct MultiProcessingPool *pool, const char */ int mp_pool_join(struct MultiProcessingPool *pool, size_t jobs, size_t flags); +/** + * Show summary of pool tasks + * + * @pararm pool a pointer to MultiProcessingPool + */ +void mp_pool_show_summary(struct MultiProcessingPool *pool); + /** * Release resources allocated by mp_pool_init() * -- cgit