| 1 | // SPDX-License-Identifier: BSD-2-Clause |
| 2 | /* |
| 3 | * Copyright (c) 2025 Intel Corporation |
| 4 | */ |
| 5 | #ifndef _WORKLOAD_H_ |
| 6 | #define _WORKLOAD_H_ |
| 7 | |
| 8 | #include "config.h" |
| 9 | #include "stat.h" |
| 10 | #include "thread.h" |
| 11 | |
| 12 | struct thread_context; // Forward Declaration |
| 13 | |
| 14 | struct workload_config { |
| 15 | pthread_t workload_task_id; |
| 16 | uint64_t workload_sequence_counter; |
| 17 | pthread_mutex_t workload_mutex; |
| 18 | pthread_cond_t workload_cond; |
| 19 | void *workload_handler; |
| 20 | int (*workload_function)(int argc, char **argv); |
| 21 | int workload_argc; |
| 22 | char **workload_argv; |
| 23 | int (*workload_setup_function)(int argc, char **argv); |
| 24 | int workload_setup_argc; |
| 25 | char **workload_setup_argv; |
| 26 | volatile int workload_run; |
| 27 | volatile int workload_done; |
| 28 | enum stat_frame_type associated_frame; |
| 29 | }; |
| 30 | |
| 31 | void *workload_thread_routine(void *data); |
| 32 | void workload_context_init(struct thread_context *thread_context, char *workload_file, |
| 33 | char *workload_function, char *workload_argument, |
| 34 | char *workload_setup_function, char *workload_setup_argument, |
| 35 | enum stat_frame_type frame_type); |
| 36 | void workload_thread_free(struct thread_context *thread_context); |
| 37 | void workload_thread_wait_for_finish(struct thread_context *thread_context); |
| 38 | |
| 39 | void string_to_argc_argv(const char *input, int *argc, char ***argv); |
| 40 | |
| 41 | #endif /* _WORKLOAD_H_ */ |