xref: /xnu-12377.81.4/tests/sched/sched_test_harness/sched_clutch_harness.h (revision 043036a2b3718f7f0be807e2870f8f47d3fa0796)
1 // Copyright (c) 2023 Apple Inc.  All rights reserved.
2 
3 #pragma once
4 
5 /* Base harness interface */
6 #include "sched_harness_impl.h"
7 #include "sched_migration_harness.h"
8 
9 #include <sys/types.h>
10 #include <kern/sched.h>
11 
12 extern int root_bucket_to_highest_pri[TH_BUCKET_SCHED_MAX];
13 
14 /* Publish Clutch implementation-specific paramemeters for use in unit tests */
15 extern uint64_t clutch_root_bucket_wcel_us[TH_BUCKET_SCHED_MAX];
16 extern uint64_t clutch_root_bucket_warp_us[TH_BUCKET_SCHED_MAX];
17 extern int clutch_interactivity_score_max;
18 
19 /* Clutch trace codes */
20 extern const unsigned int CLUTCH_THREAD_SELECT;
21 
22 /* Used by the Edge harness */
23 extern void clutch_impl_init_topology(test_hw_topology_t hw_topology);
24 extern void clutch_impl_init_params(void);
25 extern void clutch_impl_init_tracepoints(void);
26 extern struct thread_group *clutch_impl_create_tg(int interactivity_score);
27 extern test_thread_t clutch_impl_create_thread(int root_bucket, struct thread_group *tg, int pri);
28 extern void clutch_impl_set_thread_sched_mode(test_thread_t thread, int mode);
29 extern void clutch_impl_set_thread_processor_bound(test_thread_t thread, int cpu_id);
30 extern void clutch_impl_cpu_set_thread_current(int cpu_id, test_thread_t thread);
31 extern test_thread_t clutch_impl_cpu_clear_thread_current(int cpu_id);
32 extern void clutch_impl_log_tracepoint(uint64_t trace_code, uint64_t a1, uint64_t a2, uint64_t a3, uint64_t a4);
33 extern void clutch_impl_pop_tracepoint(uint64_t clutch_trace_code, uint64_t *arg1, uint64_t *arg2, uint64_t *arg3, uint64_t *arg4);
34