xref: /xnu-10063.121.3/tests/sched_thread_group_fairness.c (revision 2c2f96dc2b9a4408a43d3150ae9c105355ca3daa)
1*2c2f96dcSApple OSS Distributions #include <unistd.h>
2*2c2f96dcSApple OSS Distributions #include <stdlib.h>
3*2c2f96dcSApple OSS Distributions #include <pthread.h>
4*2c2f96dcSApple OSS Distributions #include <spawn.h>
5*2c2f96dcSApple OSS Distributions #include <mach/mach.h>
6*2c2f96dcSApple OSS Distributions #include <mach/mach_time.h>
7*2c2f96dcSApple OSS Distributions #include <TargetConditionals.h>
8*2c2f96dcSApple OSS Distributions #include <sys/work_interval.h>
9*2c2f96dcSApple OSS Distributions #include <sys/stat.h>
10*2c2f96dcSApple OSS Distributions #include <sys/sysctl.h>
11*2c2f96dcSApple OSS Distributions 
12*2c2f96dcSApple OSS Distributions #include <darwintest.h>
13*2c2f96dcSApple OSS Distributions #include <perfdata/perfdata.h>
14*2c2f96dcSApple OSS Distributions 
15*2c2f96dcSApple OSS Distributions extern unsigned char sched_thread_group_fairness_workload_config_plist[];
16*2c2f96dcSApple OSS Distributions extern unsigned int sched_thread_group_fairness_workload_config_plist_len;
17*2c2f96dcSApple OSS Distributions 
18*2c2f96dcSApple OSS Distributions #include "sched_thread_group_fairness_workload_config.h"
19*2c2f96dcSApple OSS Distributions 
20*2c2f96dcSApple OSS Distributions T_GLOBAL_META(T_META_NAMESPACE("xnu.scheduler"),
21*2c2f96dcSApple OSS Distributions     T_META_RADAR_COMPONENT_NAME("xnu"),
22*2c2f96dcSApple OSS Distributions     T_META_RADAR_COMPONENT_VERSION("scheduler"),
23*2c2f96dcSApple OSS Distributions     T_META_TAG_PERF);
24*2c2f96dcSApple OSS Distributions 
25*2c2f96dcSApple OSS Distributions static const size_t MAX_PDJ_PATH_LEN = 256;
26*2c2f96dcSApple OSS Distributions static unsigned int num_cores;
27*2c2f96dcSApple OSS Distributions static unsigned int num_perf_levels;
28*2c2f96dcSApple OSS Distributions 
29*2c2f96dcSApple OSS Distributions static bool
platform_is_amp(void)30*2c2f96dcSApple OSS Distributions platform_is_amp(void)
31*2c2f96dcSApple OSS Distributions {
32*2c2f96dcSApple OSS Distributions 	if (num_perf_levels != 0) {
33*2c2f96dcSApple OSS Distributions 		return num_perf_levels > 1;
34*2c2f96dcSApple OSS Distributions 	}
35*2c2f96dcSApple OSS Distributions 	int ret;
36*2c2f96dcSApple OSS Distributions 	num_perf_levels = 0;
37*2c2f96dcSApple OSS Distributions 	ret = sysctlbyname("hw.nperflevels", &num_perf_levels, &(size_t){ sizeof(num_perf_levels) }, NULL, 0);
38*2c2f96dcSApple OSS Distributions 	T_QUIET; T_ASSERT_POSIX_SUCCESS(ret, "hw.nperflevels");
39*2c2f96dcSApple OSS Distributions 	return num_perf_levels > 1;
40*2c2f96dcSApple OSS Distributions }
41*2c2f96dcSApple OSS Distributions 
42*2c2f96dcSApple OSS Distributions static unsigned int
get_ncpu(void)43*2c2f96dcSApple OSS Distributions get_ncpu(void)
44*2c2f96dcSApple OSS Distributions {
45*2c2f96dcSApple OSS Distributions 	int ret;
46*2c2f96dcSApple OSS Distributions 	int ncpu;
47*2c2f96dcSApple OSS Distributions 	char cpu_sysctl_name[32];
48*2c2f96dcSApple OSS Distributions 	if (platform_is_amp()) {
49*2c2f96dcSApple OSS Distributions 		sprintf(cpu_sysctl_name, "hw.perflevel%u.logicalcpu", num_perf_levels - 1);
50*2c2f96dcSApple OSS Distributions 	} else {
51*2c2f96dcSApple OSS Distributions 		sprintf(cpu_sysctl_name, "hw.ncpu");
52*2c2f96dcSApple OSS Distributions 	}
53*2c2f96dcSApple OSS Distributions 	ret = sysctlbyname(cpu_sysctl_name, &ncpu, &(size_t){ sizeof(ncpu) }, NULL, 0);
54*2c2f96dcSApple OSS Distributions 	T_QUIET; T_ASSERT_POSIX_SUCCESS(ret, "%s", cpu_sysctl_name);
55*2c2f96dcSApple OSS Distributions 	return (unsigned int) ncpu;
56*2c2f96dcSApple OSS Distributions }
57*2c2f96dcSApple OSS Distributions 
58*2c2f96dcSApple OSS Distributions extern char **environ;
59*2c2f96dcSApple OSS Distributions 
60*2c2f96dcSApple OSS Distributions static void
execute_clpcctrl(char * const clpcctrl_args[])61*2c2f96dcSApple OSS Distributions execute_clpcctrl(char *const clpcctrl_args[])
62*2c2f96dcSApple OSS Distributions {
63*2c2f96dcSApple OSS Distributions 	int ret, pid;
64*2c2f96dcSApple OSS Distributions 	ret = posix_spawn(&pid, clpcctrl_args[0], NULL, NULL, clpcctrl_args, environ);
65*2c2f96dcSApple OSS Distributions 	T_QUIET; T_ASSERT_POSIX_SUCCESS(ret, "posix_spawn");
66*2c2f96dcSApple OSS Distributions 	waitpid(pid, &ret, 0);
67*2c2f96dcSApple OSS Distributions 	T_QUIET; T_ASSERT_POSIX_SUCCESS(ret, "waitpid");
68*2c2f96dcSApple OSS Distributions }
69*2c2f96dcSApple OSS Distributions 
70*2c2f96dcSApple OSS Distributions static void
clpcctrl_cleanup(void)71*2c2f96dcSApple OSS Distributions clpcctrl_cleanup(void)
72*2c2f96dcSApple OSS Distributions {
73*2c2f96dcSApple OSS Distributions 	char *const recommend_all_cores_args[] = {"/usr/local/bin/clpcctrl", "-C", "all", NULL};
74*2c2f96dcSApple OSS Distributions 	execute_clpcctrl(recommend_all_cores_args);
75*2c2f96dcSApple OSS Distributions 	char *const restore_dynamic_control_args[] = {"/usr/local/bin/clpcctrl", "-d", NULL};
76*2c2f96dcSApple OSS Distributions 	execute_clpcctrl(restore_dynamic_control_args);
77*2c2f96dcSApple OSS Distributions }
78*2c2f96dcSApple OSS Distributions 
79*2c2f96dcSApple OSS Distributions static void
workload_config_load(void)80*2c2f96dcSApple OSS Distributions workload_config_load(void)
81*2c2f96dcSApple OSS Distributions {
82*2c2f96dcSApple OSS Distributions 	int ret;
83*2c2f96dcSApple OSS Distributions 	size_t len = 0;
84*2c2f96dcSApple OSS Distributions 	ret = sysctlbyname("kern.workload_config", NULL, &len,
85*2c2f96dcSApple OSS Distributions 	    sched_thread_group_fairness_workload_config_plist,
86*2c2f96dcSApple OSS Distributions 	    sched_thread_group_fairness_workload_config_plist_len);
87*2c2f96dcSApple OSS Distributions 	if (ret == -1 && errno == ENOENT) {
88*2c2f96dcSApple OSS Distributions 		T_SKIP("kern.workload_config failed");
89*2c2f96dcSApple OSS Distributions 	}
90*2c2f96dcSApple OSS Distributions 	T_QUIET; T_ASSERT_POSIX_SUCCESS(ret, "kern.workload_config");
91*2c2f96dcSApple OSS Distributions }
92*2c2f96dcSApple OSS Distributions 
93*2c2f96dcSApple OSS Distributions static void
workload_config_cleanup(void)94*2c2f96dcSApple OSS Distributions workload_config_cleanup(void)
95*2c2f96dcSApple OSS Distributions {
96*2c2f96dcSApple OSS Distributions 	size_t len = 0;
97*2c2f96dcSApple OSS Distributions 	sysctlbyname("kern.workload_config", NULL, &len, "", 1);
98*2c2f96dcSApple OSS Distributions }
99*2c2f96dcSApple OSS Distributions 
100*2c2f96dcSApple OSS Distributions static void
environment_init(void)101*2c2f96dcSApple OSS Distributions environment_init(void)
102*2c2f96dcSApple OSS Distributions {
103*2c2f96dcSApple OSS Distributions 	num_cores = get_ncpu();
104*2c2f96dcSApple OSS Distributions 
105*2c2f96dcSApple OSS Distributions 	if (platform_is_amp()) {
106*2c2f96dcSApple OSS Distributions 		/*
107*2c2f96dcSApple OSS Distributions 		 * Derecommend all clusters except the E cores, to ensure that thread groups
108*2c2f96dcSApple OSS Distributions 		 * compete over the same cores irrespective of CLPC's cluster recommendations
109*2c2f96dcSApple OSS Distributions 		 */
110*2c2f96dcSApple OSS Distributions 		T_ATEND(clpcctrl_cleanup);
111*2c2f96dcSApple OSS Distributions 		char *const clpcctrl_args[] = {"/usr/local/bin/clpcctrl", "-C", "e", NULL};
112*2c2f96dcSApple OSS Distributions 		execute_clpcctrl(clpcctrl_args);
113*2c2f96dcSApple OSS Distributions 	}
114*2c2f96dcSApple OSS Distributions 
115*2c2f96dcSApple OSS Distributions 	/*
116*2c2f96dcSApple OSS Distributions 	 * Load a test workload plist containing a Workload ID with
117*2c2f96dcSApple OSS Distributions 	 * WorkloadClass == DISCRETIONARY, in order to mark the thread group
118*2c2f96dcSApple OSS Distributions 	 * for that workload as THREAD_GROUP_FLAGS_EFFICIENT
119*2c2f96dcSApple OSS Distributions 	 */
120*2c2f96dcSApple OSS Distributions 	T_ATEND(workload_config_cleanup);
121*2c2f96dcSApple OSS Distributions 	workload_config_load();
122*2c2f96dcSApple OSS Distributions }
123*2c2f96dcSApple OSS Distributions 
124*2c2f96dcSApple OSS Distributions static void
set_work_interval_id(work_interval_t * handle,uint32_t work_interval_flags)125*2c2f96dcSApple OSS Distributions set_work_interval_id(work_interval_t *handle, uint32_t work_interval_flags)
126*2c2f96dcSApple OSS Distributions {
127*2c2f96dcSApple OSS Distributions 	int ret;
128*2c2f96dcSApple OSS Distributions 	mach_port_t port = MACH_PORT_NULL;
129*2c2f96dcSApple OSS Distributions 
130*2c2f96dcSApple OSS Distributions 	ret = work_interval_copy_port(*handle, &port);
131*2c2f96dcSApple OSS Distributions 	T_QUIET; T_ASSERT_POSIX_ZERO(ret, "work_interval_copy_port");
132*2c2f96dcSApple OSS Distributions 
133*2c2f96dcSApple OSS Distributions 	struct work_interval_workload_id_params wlid_params = {
134*2c2f96dcSApple OSS Distributions 		.wlidp_flags = WORK_INTERVAL_WORKLOAD_ID_HAS_ID,
135*2c2f96dcSApple OSS Distributions 		.wlidp_wicreate_flags = work_interval_flags,
136*2c2f96dcSApple OSS Distributions 		.wlidp_name = (uintptr_t)"com.test.myapp.discretionary",
137*2c2f96dcSApple OSS Distributions 	};
138*2c2f96dcSApple OSS Distributions 
139*2c2f96dcSApple OSS Distributions 	ret = __work_interval_ctl(WORK_INTERVAL_OPERATION_SET_WORKLOAD_ID, port, &wlid_params, sizeof(wlid_params));
140*2c2f96dcSApple OSS Distributions 	T_QUIET; T_ASSERT_POSIX_ZERO(ret, "WORK_INTERVAL_OPERATION_SET_WORKLOAD_ID");
141*2c2f96dcSApple OSS Distributions }
142*2c2f96dcSApple OSS Distributions 
143*2c2f96dcSApple OSS Distributions static uint32_t
make_work_interval(work_interval_t * handle,uint32_t work_type_flags)144*2c2f96dcSApple OSS Distributions make_work_interval(work_interval_t *handle, uint32_t work_type_flags)
145*2c2f96dcSApple OSS Distributions {
146*2c2f96dcSApple OSS Distributions 	int ret;
147*2c2f96dcSApple OSS Distributions 	uint32_t work_interval_flags = WORK_INTERVAL_FLAG_JOINABLE | WORK_INTERVAL_FLAG_GROUP | work_type_flags;
148*2c2f96dcSApple OSS Distributions 	ret = work_interval_create(handle, work_interval_flags);
149*2c2f96dcSApple OSS Distributions 	T_QUIET; T_ASSERT_POSIX_SUCCESS(ret, "work_interval_create");
150*2c2f96dcSApple OSS Distributions 
151*2c2f96dcSApple OSS Distributions 	if (work_type_flags & WORK_INTERVAL_FLAG_HAS_WORKLOAD_ID) {
152*2c2f96dcSApple OSS Distributions 		set_work_interval_id(handle, work_interval_flags);
153*2c2f96dcSApple OSS Distributions 	}
154*2c2f96dcSApple OSS Distributions 	return work_interval_flags;
155*2c2f96dcSApple OSS Distributions }
156*2c2f96dcSApple OSS Distributions 
157*2c2f96dcSApple OSS Distributions struct thread_data {
158*2c2f96dcSApple OSS Distributions 	work_interval_t *handle;
159*2c2f96dcSApple OSS Distributions 	uint32_t work_interval_flags;
160*2c2f96dcSApple OSS Distributions };
161*2c2f96dcSApple OSS Distributions 
162*2c2f96dcSApple OSS Distributions static void *
spin_thread_fn(void * arg)163*2c2f96dcSApple OSS Distributions spin_thread_fn(void *arg)
164*2c2f96dcSApple OSS Distributions {
165*2c2f96dcSApple OSS Distributions 	struct thread_data *info = (struct thread_data *)arg;
166*2c2f96dcSApple OSS Distributions 	int ret;
167*2c2f96dcSApple OSS Distributions 
168*2c2f96dcSApple OSS Distributions 	/* Join the thread group associated with the work interval handle */
169*2c2f96dcSApple OSS Distributions 	ret = work_interval_join(*(info->handle));
170*2c2f96dcSApple OSS Distributions 	T_QUIET; T_ASSERT_POSIX_ZERO(ret, "work_interval_join");
171*2c2f96dcSApple OSS Distributions 
172*2c2f96dcSApple OSS Distributions 	/* Spin indefinitely */
173*2c2f96dcSApple OSS Distributions 	volatile uint64_t spin_count = 0;
174*2c2f96dcSApple OSS Distributions 	while (mach_absolute_time() < UINT64_MAX) {
175*2c2f96dcSApple OSS Distributions 		spin_count++;
176*2c2f96dcSApple OSS Distributions 	}
177*2c2f96dcSApple OSS Distributions 	return NULL;
178*2c2f96dcSApple OSS Distributions }
179*2c2f96dcSApple OSS Distributions 
180*2c2f96dcSApple OSS Distributions static void
start_threads(pthread_t * threads,struct thread_data * thread_datas,work_interval_t * handle,uint32_t work_interval_flags)181*2c2f96dcSApple OSS Distributions start_threads(pthread_t *threads, struct thread_data *thread_datas, work_interval_t *handle, uint32_t work_interval_flags)
182*2c2f96dcSApple OSS Distributions {
183*2c2f96dcSApple OSS Distributions 	int ret;
184*2c2f96dcSApple OSS Distributions 	for (unsigned int i = 0; i < num_cores; i++) {
185*2c2f96dcSApple OSS Distributions 		thread_datas[i].handle = handle;
186*2c2f96dcSApple OSS Distributions 		thread_datas[i].work_interval_flags = work_interval_flags;
187*2c2f96dcSApple OSS Distributions 		ret = pthread_create(&threads[i], NULL, spin_thread_fn, &thread_datas[i]);
188*2c2f96dcSApple OSS Distributions 		T_QUIET; T_ASSERT_POSIX_ZERO(ret, "pthread_create");
189*2c2f96dcSApple OSS Distributions 	}
190*2c2f96dcSApple OSS Distributions }
191*2c2f96dcSApple OSS Distributions 
192*2c2f96dcSApple OSS Distributions static uint64_t
snapshot_user_time_usec(pthread_t * threads)193*2c2f96dcSApple OSS Distributions snapshot_user_time_usec(pthread_t *threads)
194*2c2f96dcSApple OSS Distributions {
195*2c2f96dcSApple OSS Distributions 	kern_return_t kr;
196*2c2f96dcSApple OSS Distributions 	uint64_t cumulative_user_time_usec = 0;
197*2c2f96dcSApple OSS Distributions 	mach_msg_type_number_t count = THREAD_BASIC_INFO_COUNT;
198*2c2f96dcSApple OSS Distributions 	for (unsigned int i = 0; i < num_cores; i++) {
199*2c2f96dcSApple OSS Distributions 		mach_port_t thread_port = pthread_mach_thread_np(threads[i]);
200*2c2f96dcSApple OSS Distributions 		thread_basic_info_data_t info;
201*2c2f96dcSApple OSS Distributions 		kr = thread_info(thread_port, THREAD_BASIC_INFO, (thread_info_t)&info, &count);
202*2c2f96dcSApple OSS Distributions 		T_QUIET; T_ASSERT_MACH_SUCCESS(kr, "thread_info");
203*2c2f96dcSApple OSS Distributions 		uint64_t thread_usr_usec = (uint64_t) (info.user_time.seconds) * USEC_PER_SEC + (uint64_t) info.user_time.microseconds;
204*2c2f96dcSApple OSS Distributions 		cumulative_user_time_usec += thread_usr_usec;
205*2c2f96dcSApple OSS Distributions 	}
206*2c2f96dcSApple OSS Distributions 	return cumulative_user_time_usec;
207*2c2f96dcSApple OSS Distributions }
208*2c2f96dcSApple OSS Distributions 
209*2c2f96dcSApple OSS Distributions T_DECL(thread_group_fairness,
210*2c2f96dcSApple OSS Distributions     "Ensure that thread groups tagged as higher priority do not starve out "
211*2c2f96dcSApple OSS Distributions     "thread groups tagged as lower priority when both behave as CPU spinners",
212*2c2f96dcSApple OSS Distributions     T_META_ASROOT(YES))
213*2c2f96dcSApple OSS Distributions {
214*2c2f96dcSApple OSS Distributions 	T_SETUPBEGIN;
215*2c2f96dcSApple OSS Distributions 
216*2c2f96dcSApple OSS Distributions 	environment_init();
217*2c2f96dcSApple OSS Distributions 
218*2c2f96dcSApple OSS Distributions 	/*
219*2c2f96dcSApple OSS Distributions 	 * Create two work intervals with corresponding thread groups that would
220*2c2f96dcSApple OSS Distributions 	 * be associated with differing priorities.
221*2c2f96dcSApple OSS Distributions 	 */
222*2c2f96dcSApple OSS Distributions 	work_interval_t lower_pri_handle, higher_pri_handle;
223*2c2f96dcSApple OSS Distributions 	uint32_t lower_pri_flags = make_work_interval(&lower_pri_handle, WORK_INTERVAL_TYPE_DEFAULT | WORK_INTERVAL_FLAG_HAS_WORKLOAD_ID);
224*2c2f96dcSApple OSS Distributions 	uint32_t higher_pri_flags = make_work_interval(&higher_pri_handle, WORK_INTERVAL_TYPE_DEFAULT);
225*2c2f96dcSApple OSS Distributions 
226*2c2f96dcSApple OSS Distributions 	/* Start threads to join the lower priority thread group */
227*2c2f96dcSApple OSS Distributions 	pthread_t lower_threads[num_cores];
228*2c2f96dcSApple OSS Distributions 	struct thread_data lower_thread_datas[num_cores];
229*2c2f96dcSApple OSS Distributions 	start_threads(lower_threads, lower_thread_datas, &lower_pri_handle, lower_pri_flags);
230*2c2f96dcSApple OSS Distributions 
231*2c2f96dcSApple OSS Distributions 	/* Start threads to join the higher priority thread group  */
232*2c2f96dcSApple OSS Distributions 	pthread_t higher_threads[num_cores];
233*2c2f96dcSApple OSS Distributions 	struct thread_data higher_thread_datas[num_cores];
234*2c2f96dcSApple OSS Distributions 	start_threads(higher_threads, higher_thread_datas, &higher_pri_handle, higher_pri_flags);
235*2c2f96dcSApple OSS Distributions 
236*2c2f96dcSApple OSS Distributions 	T_SETUPEND;
237*2c2f96dcSApple OSS Distributions 
238*2c2f96dcSApple OSS Distributions 	/* Snapshot thread runtimes */
239*2c2f96dcSApple OSS Distributions 	uint64_t start_lower_priority_runtime_usec = snapshot_user_time_usec(lower_threads);
240*2c2f96dcSApple OSS Distributions 	uint64_t start_higher_priority_runtime_usec = snapshot_user_time_usec(higher_threads);
241*2c2f96dcSApple OSS Distributions 
242*2c2f96dcSApple OSS Distributions 	/* Allow thread groups time to compete */
243*2c2f96dcSApple OSS Distributions 	sleep(3);
244*2c2f96dcSApple OSS Distributions 
245*2c2f96dcSApple OSS Distributions 	/*
246*2c2f96dcSApple OSS Distributions 	 * Snapshot runtimes again and compare the usage ratio between the lower and
247*2c2f96dcSApple OSS Distributions 	 * higher priority thread groups, to determine whether the lower priority group
248*2c2f96dcSApple OSS Distributions 	 * has been starved
249*2c2f96dcSApple OSS Distributions 	 */
250*2c2f96dcSApple OSS Distributions 	uint64_t finish_lower_priority_runtime_usec = snapshot_user_time_usec(lower_threads);
251*2c2f96dcSApple OSS Distributions 	uint64_t finish_higher_priority_runtime_usec = snapshot_user_time_usec(higher_threads);
252*2c2f96dcSApple OSS Distributions 
253*2c2f96dcSApple OSS Distributions 	uint64_t lower_priority_runtime = finish_lower_priority_runtime_usec - start_lower_priority_runtime_usec;
254*2c2f96dcSApple OSS Distributions 	uint64_t higher_priority_runtime = finish_higher_priority_runtime_usec - start_higher_priority_runtime_usec;
255*2c2f96dcSApple OSS Distributions 
256*2c2f96dcSApple OSS Distributions 	T_QUIET; T_ASSERT_GT(lower_priority_runtime, 10000LL, "lower priority thread group got at least 10ms of CPU time");
257*2c2f96dcSApple OSS Distributions 	T_QUIET; T_ASSERT_GT(higher_priority_runtime, 10000LL, "higher priority thread group got at least 10ms of CPU time");
258*2c2f96dcSApple OSS Distributions 
259*2c2f96dcSApple OSS Distributions 	/* Record the observed runtime ratio */
260*2c2f96dcSApple OSS Distributions 	char pdj_path[MAX_PDJ_PATH_LEN];
261*2c2f96dcSApple OSS Distributions 	pdwriter_t writer = pdwriter_open_tmp("xnu", "scheduler.thread_group_fairness", 0, 0, pdj_path, MAX_PDJ_PATH_LEN);
262*2c2f96dcSApple OSS Distributions 	T_QUIET; T_WITH_ERRNO; T_ASSERT_NOTNULL(writer, "pdwriter_open_tmp");
263*2c2f96dcSApple OSS Distributions 
264*2c2f96dcSApple OSS Distributions 	double runtime_ratio_value;
265*2c2f96dcSApple OSS Distributions 	double total_runtime = (double)(lower_priority_runtime + higher_priority_runtime);
266*2c2f96dcSApple OSS Distributions 	if (lower_priority_runtime <= higher_priority_runtime) {
267*2c2f96dcSApple OSS Distributions 		runtime_ratio_value = (double)(lower_priority_runtime) / total_runtime;
268*2c2f96dcSApple OSS Distributions 	} else {
269*2c2f96dcSApple OSS Distributions 		runtime_ratio_value = (double)(higher_priority_runtime) / total_runtime;
270*2c2f96dcSApple OSS Distributions 	}
271*2c2f96dcSApple OSS Distributions 
272*2c2f96dcSApple OSS Distributions 	pdwriter_new_value(writer, "Thread Group Runtime Ratio", PDUNIT_CUSTOM(runtime_ratio), runtime_ratio_value);
273*2c2f96dcSApple OSS Distributions 	pdwriter_record_larger_better(writer);
274*2c2f96dcSApple OSS Distributions 	pdwriter_close(writer);
275*2c2f96dcSApple OSS Distributions 	/* Ensure that the perfdata file can be copied by BATS */
276*2c2f96dcSApple OSS Distributions 	T_QUIET; T_ASSERT_POSIX_ZERO(chmod(pdj_path, 0644), "chmod");
277*2c2f96dcSApple OSS Distributions 
278*2c2f96dcSApple OSS Distributions 	T_END;
279*2c2f96dcSApple OSS Distributions }
280