1*c54f35caSApple OSS Distributions /*
2*c54f35caSApple OSS Distributions * Copyright (c) 2021 Apple Inc. All rights reserved.
3*c54f35caSApple OSS Distributions *
4*c54f35caSApple OSS Distributions * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5*c54f35caSApple OSS Distributions *
6*c54f35caSApple OSS Distributions * This file contains Original Code and/or Modifications of Original Code
7*c54f35caSApple OSS Distributions * as defined in and that are subject to the Apple Public Source License
8*c54f35caSApple OSS Distributions * Version 2.0 (the 'License'). You may not use this file except in
9*c54f35caSApple OSS Distributions * compliance with the License. The rights granted to you under the License
10*c54f35caSApple OSS Distributions * may not be used to create, or enable the creation or redistribution of,
11*c54f35caSApple OSS Distributions * unlawful or unlicensed copies of an Apple operating system, or to
12*c54f35caSApple OSS Distributions * circumvent, violate, or enable the circumvention or violation of, any
13*c54f35caSApple OSS Distributions * terms of an Apple operating system software license agreement.
14*c54f35caSApple OSS Distributions *
15*c54f35caSApple OSS Distributions * Please obtain a copy of the License at
16*c54f35caSApple OSS Distributions * http://www.opensource.apple.com/apsl/ and read it before using this file.
17*c54f35caSApple OSS Distributions *
18*c54f35caSApple OSS Distributions * The Original Code and all software distributed under the License are
19*c54f35caSApple OSS Distributions * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20*c54f35caSApple OSS Distributions * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21*c54f35caSApple OSS Distributions * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22*c54f35caSApple OSS Distributions * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23*c54f35caSApple OSS Distributions * Please see the License for the specific language governing rights and
24*c54f35caSApple OSS Distributions * limitations under the License.
25*c54f35caSApple OSS Distributions *
26*c54f35caSApple OSS Distributions * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27*c54f35caSApple OSS Distributions */
28*c54f35caSApple OSS Distributions /*
29*c54f35caSApple OSS Distributions * Compresor and swap benchmarks.
30*c54f35caSApple OSS Distributions */
31*c54f35caSApple OSS Distributions
32*c54f35caSApple OSS Distributions #include <err.h>
33*c54f35caSApple OSS Distributions #include <errno.h>
34*c54f35caSApple OSS Distributions #include <mach/vm_page_size.h>
35*c54f35caSApple OSS Distributions #include <stdio.h>
36*c54f35caSApple OSS Distributions #include <stdlib.h>
37*c54f35caSApple OSS Distributions #include <string.h>
38*c54f35caSApple OSS Distributions #include <sys/mman.h>
39*c54f35caSApple OSS Distributions #include <sys/sysctl.h>
40*c54f35caSApple OSS Distributions #include <sys/types.h>
41*c54f35caSApple OSS Distributions
42*c54f35caSApple OSS Distributions #include "benchmark/helpers.h"
43*c54f35caSApple OSS Distributions
44*c54f35caSApple OSS Distributions /*
45*c54f35caSApple OSS Distributions * There are four different types of benchmarks
46*c54f35caSApple OSS Distributions * Each type can run on a variable size buffer
47*c54f35caSApple OSS Distributions * and with different types of data.
48*c54f35caSApple OSS Distributions */
49*c54f35caSApple OSS Distributions typedef enum test_variant {
50*c54f35caSApple OSS Distributions VARIANT_COMPRESS,
51*c54f35caSApple OSS Distributions VARIANT_COMPRESS_AND_DECOMPRESS,
52*c54f35caSApple OSS Distributions VARIANT_SWAPOUT,
53*c54f35caSApple OSS Distributions VARIANT_SWAPOUT_AND_SWAPIN
54*c54f35caSApple OSS Distributions } test_variant_t;
55*c54f35caSApple OSS Distributions
56*c54f35caSApple OSS Distributions /*
57*c54f35caSApple OSS Distributions * Each benchmark supports buffers filled with different contents.
58*c54f35caSApple OSS Distributions */
59*c54f35caSApple OSS Distributions typedef enum allocation_type {
60*c54f35caSApple OSS Distributions VARIANT_ZEROS,
61*c54f35caSApple OSS Distributions VARIANT_RANDOM,
62*c54f35caSApple OSS Distributions VARIANT_TYPICAL
63*c54f35caSApple OSS Distributions } allocation_type_t;
64*c54f35caSApple OSS Distributions
65*c54f35caSApple OSS Distributions /* Arguments parsed from the command line */
66*c54f35caSApple OSS Distributions typedef struct test_args {
67*c54f35caSApple OSS Distributions uint64_t ta_duration_seconds;
68*c54f35caSApple OSS Distributions uint64_t ta_buffer_size;
69*c54f35caSApple OSS Distributions test_variant_t ta_variant;
70*c54f35caSApple OSS Distributions allocation_type_t ta_alloc_type;
71*c54f35caSApple OSS Distributions bool ta_verbose;
72*c54f35caSApple OSS Distributions } test_args_t;
73*c54f35caSApple OSS Distributions
74*c54f35caSApple OSS Distributions struct perf_compressor_data {
75*c54f35caSApple OSS Distributions user_addr_t buffer;
76*c54f35caSApple OSS Distributions size_t buffer_size;
77*c54f35caSApple OSS Distributions uint64_t benchmark_time;
78*c54f35caSApple OSS Distributions uint64_t bytes_processed;
79*c54f35caSApple OSS Distributions uint64_t compressor_growth;
80*c54f35caSApple OSS Distributions };
81*c54f35caSApple OSS Distributions
82*c54f35caSApple OSS Distributions /* Test Variants */
83*c54f35caSApple OSS Distributions static const char *kCompressArgument = "compress";
84*c54f35caSApple OSS Distributions static const char *kCompressAndDecompressArgument = "compress-and-decompress";
85*c54f35caSApple OSS Distributions
86*c54f35caSApple OSS Distributions /* Allocation types */
87*c54f35caSApple OSS Distributions static const char *kAllocZeroes = "zero";
88*c54f35caSApple OSS Distributions static const char *kAllocRandom = "random";
89*c54f35caSApple OSS Distributions static const char *kAllocTypical = "typical";
90*c54f35caSApple OSS Distributions
91*c54f35caSApple OSS Distributions /*
92*c54f35caSApple OSS Distributions * Failure codes
93*c54f35caSApple OSS Distributions */
94*c54f35caSApple OSS Distributions static int kInvalidArgument = 1;
95*c54f35caSApple OSS Distributions static int kAllocationFailure = 2;
96*c54f35caSApple OSS Distributions static int kCompressionFailure = 3;
97*c54f35caSApple OSS Distributions static int kNYI = 4;
98*c54f35caSApple OSS Distributions
99*c54f35caSApple OSS Distributions static void parse_arguments(int argc, const char **argv, test_args_t *args /* OUT */);
100*c54f35caSApple OSS Distributions static void print_help(const char** argv);
101*c54f35caSApple OSS Distributions static unsigned char *alloc_and_fill_buffer(size_t size, allocation_type_t alloc_type);
102*c54f35caSApple OSS Distributions void fill_with_typical_data(unsigned char *buf, size_t size);
103*c54f35caSApple OSS Distributions static void run_compress_benchmark(const test_args_t *args);
104*c54f35caSApple OSS Distributions static uint64_t decompress_buffer(unsigned char *buf, size_t size);
105*c54f35caSApple OSS Distributions
106*c54f35caSApple OSS Distributions int
main(int argc,const char ** argv)107*c54f35caSApple OSS Distributions main(int argc, const char **argv)
108*c54f35caSApple OSS Distributions {
109*c54f35caSApple OSS Distributions test_args_t args = {0};
110*c54f35caSApple OSS Distributions parse_arguments(argc, argv, &args);
111*c54f35caSApple OSS Distributions switch (args.ta_variant) {
112*c54f35caSApple OSS Distributions case VARIANT_COMPRESS:
113*c54f35caSApple OSS Distributions case VARIANT_COMPRESS_AND_DECOMPRESS:
114*c54f35caSApple OSS Distributions run_compress_benchmark(&args);
115*c54f35caSApple OSS Distributions break;
116*c54f35caSApple OSS Distributions default:
117*c54f35caSApple OSS Distributions err(kNYI, "NYI: Test variant has not been implemented");
118*c54f35caSApple OSS Distributions }
119*c54f35caSApple OSS Distributions }
120*c54f35caSApple OSS Distributions
121*c54f35caSApple OSS Distributions static void
run_compress_benchmark(const test_args_t * args)122*c54f35caSApple OSS Distributions run_compress_benchmark(const test_args_t *args)
123*c54f35caSApple OSS Distributions {
124*c54f35caSApple OSS Distributions uint64_t total_compressor_time = 0;
125*c54f35caSApple OSS Distributions uint64_t total_bytes_compressed = 0;
126*c54f35caSApple OSS Distributions uint64_t total_compressor_bytes_used = 0;
127*c54f35caSApple OSS Distributions uint64_t total_decompressor_time = 0;
128*c54f35caSApple OSS Distributions double compressor_throughput = 0, decompressor_throughput = 0, compression_ratio = 0;
129*c54f35caSApple OSS Distributions while (total_compressor_time < args->ta_duration_seconds * NSEC_PER_SEC) {
130*c54f35caSApple OSS Distributions unsigned char *buf;
131*c54f35caSApple OSS Distributions struct perf_compressor_data sysctl_data = {0};
132*c54f35caSApple OSS Distributions size_t len = sizeof(sysctl_data);
133*c54f35caSApple OSS Distributions
134*c54f35caSApple OSS Distributions benchmark_log(args->ta_verbose, "Start allocation\n");
135*c54f35caSApple OSS Distributions buf = alloc_and_fill_buffer(args->ta_buffer_size, args->ta_alloc_type);
136*c54f35caSApple OSS Distributions if (!buf) {
137*c54f35caSApple OSS Distributions err(kAllocationFailure, "Unable to allocate test buffer\n");
138*c54f35caSApple OSS Distributions }
139*c54f35caSApple OSS Distributions benchmark_log(args->ta_verbose, "Finished allocation\n");
140*c54f35caSApple OSS Distributions
141*c54f35caSApple OSS Distributions sysctl_data.buffer = (user_addr_t) buf;
142*c54f35caSApple OSS Distributions sysctl_data.buffer_size = args->ta_buffer_size;
143*c54f35caSApple OSS Distributions benchmark_log(args->ta_verbose, "Start compression\n");
144*c54f35caSApple OSS Distributions int ret = sysctlbyname("kern.perf_compressor", &sysctl_data, &len, &sysctl_data, sizeof(sysctl_data));
145*c54f35caSApple OSS Distributions if (ret < 0) {
146*c54f35caSApple OSS Distributions fprintf(stderr, "Failed to compress buffer: %s\n", strerror(errno));
147*c54f35caSApple OSS Distributions exit(kCompressionFailure);
148*c54f35caSApple OSS Distributions }
149*c54f35caSApple OSS Distributions if (sysctl_data.bytes_processed != args->ta_buffer_size) {
150*c54f35caSApple OSS Distributions fprintf(stderr, "WARNING: Failed to compress the whole buffer. Only compressed %llu bytes out of %llu bytes\n", sysctl_data.bytes_processed, args->ta_buffer_size);
151*c54f35caSApple OSS Distributions }
152*c54f35caSApple OSS Distributions total_bytes_compressed += sysctl_data.bytes_processed;
153*c54f35caSApple OSS Distributions total_compressor_time += sysctl_data.benchmark_time;
154*c54f35caSApple OSS Distributions total_compressor_bytes_used += sysctl_data.compressor_growth;
155*c54f35caSApple OSS Distributions benchmark_log(args->ta_verbose, "Finished compression\n");
156*c54f35caSApple OSS Distributions
157*c54f35caSApple OSS Distributions if (args->ta_variant == VARIANT_COMPRESS_AND_DECOMPRESS) {
158*c54f35caSApple OSS Distributions benchmark_log(args->ta_verbose, "Start decompression\n");
159*c54f35caSApple OSS Distributions total_decompressor_time += decompress_buffer(buf, args->ta_buffer_size);
160*c54f35caSApple OSS Distributions benchmark_log(args->ta_verbose, "Finished decompression\n");
161*c54f35caSApple OSS Distributions }
162*c54f35caSApple OSS Distributions munmap(buf, args->ta_buffer_size);
163*c54f35caSApple OSS Distributions }
164*c54f35caSApple OSS Distributions compressor_throughput = (double) total_bytes_compressed / total_compressor_time * NSEC_PER_SEC;
165*c54f35caSApple OSS Distributions printf("bytes_compressed=%llu, compressor_bytes_used=%llu\n", total_bytes_compressed, total_compressor_bytes_used);
166*c54f35caSApple OSS Distributions compression_ratio = (double) total_bytes_compressed / total_compressor_bytes_used;
167*c54f35caSApple OSS Distributions if (total_decompressor_time != 0) {
168*c54f35caSApple OSS Distributions decompressor_throughput = (double) total_bytes_compressed / total_decompressor_time * NSEC_PER_SEC;
169*c54f35caSApple OSS Distributions }
170*c54f35caSApple OSS Distributions printf("-----Results-----\n");
171*c54f35caSApple OSS Distributions printf("Compressor Throughput");
172*c54f35caSApple OSS Distributions if (args->ta_variant == VARIANT_COMPRESS_AND_DECOMPRESS) {
173*c54f35caSApple OSS Distributions printf(", Decompressor Throughput");
174*c54f35caSApple OSS Distributions }
175*c54f35caSApple OSS Distributions if (args->ta_alloc_type != VARIANT_ZEROS) {
176*c54f35caSApple OSS Distributions printf(", Compression Ratio\n");
177*c54f35caSApple OSS Distributions } else {
178*c54f35caSApple OSS Distributions printf("\n");
179*c54f35caSApple OSS Distributions }
180*c54f35caSApple OSS Distributions
181*c54f35caSApple OSS Distributions printf("%.0f", compressor_throughput);
182*c54f35caSApple OSS Distributions if (args->ta_variant == VARIANT_COMPRESS_AND_DECOMPRESS) {
183*c54f35caSApple OSS Distributions printf(", %.0f", decompressor_throughput);
184*c54f35caSApple OSS Distributions }
185*c54f35caSApple OSS Distributions if (args->ta_alloc_type != VARIANT_ZEROS) {
186*c54f35caSApple OSS Distributions printf(", %.2f\n", compression_ratio);
187*c54f35caSApple OSS Distributions } else {
188*c54f35caSApple OSS Distributions printf("\n");
189*c54f35caSApple OSS Distributions }
190*c54f35caSApple OSS Distributions }
191*c54f35caSApple OSS Distributions
192*c54f35caSApple OSS Distributions static unsigned char *
alloc_and_fill_buffer(size_t size,allocation_type_t alloc_type)193*c54f35caSApple OSS Distributions alloc_and_fill_buffer(size_t size, allocation_type_t alloc_type)
194*c54f35caSApple OSS Distributions {
195*c54f35caSApple OSS Distributions unsigned char *buf = mmap_buffer(size);
196*c54f35caSApple OSS Distributions if (!buf) {
197*c54f35caSApple OSS Distributions return buf;
198*c54f35caSApple OSS Distributions }
199*c54f35caSApple OSS Distributions switch (alloc_type) {
200*c54f35caSApple OSS Distributions case VARIANT_ZEROS:
201*c54f35caSApple OSS Distributions bzero(buf, size);
202*c54f35caSApple OSS Distributions break;
203*c54f35caSApple OSS Distributions case VARIANT_RANDOM:
204*c54f35caSApple OSS Distributions arc4random_buf(buf, size);
205*c54f35caSApple OSS Distributions break;
206*c54f35caSApple OSS Distributions case VARIANT_TYPICAL:
207*c54f35caSApple OSS Distributions fill_with_typical_data(buf, size);
208*c54f35caSApple OSS Distributions break;
209*c54f35caSApple OSS Distributions default:
210*c54f35caSApple OSS Distributions err(kInvalidArgument, "Unknown allocation variant\n");
211*c54f35caSApple OSS Distributions }
212*c54f35caSApple OSS Distributions
213*c54f35caSApple OSS Distributions return buf;
214*c54f35caSApple OSS Distributions }
215*c54f35caSApple OSS Distributions
216*c54f35caSApple OSS Distributions static uint64_t
decompress_buffer(unsigned char * buf,size_t size)217*c54f35caSApple OSS Distributions decompress_buffer(unsigned char *buf, size_t size)
218*c54f35caSApple OSS Distributions {
219*c54f35caSApple OSS Distributions /*
220*c54f35caSApple OSS Distributions * Fault in the compressed buffer to measure the decompression
221*c54f35caSApple OSS Distributions * throughput.
222*c54f35caSApple OSS Distributions */
223*c54f35caSApple OSS Distributions uint64_t start_time, end_time;
224*c54f35caSApple OSS Distributions start_time = current_timestamp_ns();
225*c54f35caSApple OSS Distributions volatile unsigned char val;
226*c54f35caSApple OSS Distributions for (unsigned char* ptr = buf; ptr < buf + size; ptr += vm_kernel_page_size) {
227*c54f35caSApple OSS Distributions val = *ptr;
228*c54f35caSApple OSS Distributions }
229*c54f35caSApple OSS Distributions end_time = current_timestamp_ns();
230*c54f35caSApple OSS Distributions return end_time - start_time;
231*c54f35caSApple OSS Distributions }
232*c54f35caSApple OSS Distributions
233*c54f35caSApple OSS Distributions /*
234*c54f35caSApple OSS Distributions * Gives us the compression ratio we see in the typical case (~2.5)
235*c54f35caSApple OSS Distributions */
236*c54f35caSApple OSS Distributions void
fill_with_typical_data(unsigned char * buf,size_t size)237*c54f35caSApple OSS Distributions fill_with_typical_data(unsigned char *buf, size_t size)
238*c54f35caSApple OSS Distributions {
239*c54f35caSApple OSS Distributions for (size_t i = 0; i < size / vm_kernel_page_size; i++) {
240*c54f35caSApple OSS Distributions unsigned char val = 0;
241*c54f35caSApple OSS Distributions for (size_t j = 0; j < vm_kernel_page_size; j += 16) {
242*c54f35caSApple OSS Distributions memset(&buf[i * vm_kernel_page_size + j], val, 16);
243*c54f35caSApple OSS Distributions if (i < 3400 * (vm_kernel_page_size / 4096)) {
244*c54f35caSApple OSS Distributions val++;
245*c54f35caSApple OSS Distributions }
246*c54f35caSApple OSS Distributions }
247*c54f35caSApple OSS Distributions }
248*c54f35caSApple OSS Distributions }
249*c54f35caSApple OSS Distributions
250*c54f35caSApple OSS Distributions static void
parse_arguments(int argc,const char ** argv,test_args_t * args)251*c54f35caSApple OSS Distributions parse_arguments(int argc, const char** argv, test_args_t *args)
252*c54f35caSApple OSS Distributions {
253*c54f35caSApple OSS Distributions int current_positional_argument = 0;
254*c54f35caSApple OSS Distributions long duration = -1, size_mb = -1;
255*c54f35caSApple OSS Distributions memset(args, 0, sizeof(test_args_t));
256*c54f35caSApple OSS Distributions for (int current_argument = 1; current_argument < argc; current_argument++) {
257*c54f35caSApple OSS Distributions if (argv[current_argument][0] == '-') {
258*c54f35caSApple OSS Distributions if (strcmp(argv[current_argument], "-v") == 0) {
259*c54f35caSApple OSS Distributions args->ta_verbose = true;
260*c54f35caSApple OSS Distributions } else {
261*c54f35caSApple OSS Distributions fprintf(stderr, "Unknown argument %s\n", argv[current_argument]);
262*c54f35caSApple OSS Distributions print_help(argv);
263*c54f35caSApple OSS Distributions exit(kInvalidArgument);
264*c54f35caSApple OSS Distributions }
265*c54f35caSApple OSS Distributions if (current_argument >= argc) {
266*c54f35caSApple OSS Distributions print_help(argv);
267*c54f35caSApple OSS Distributions exit(kInvalidArgument);
268*c54f35caSApple OSS Distributions }
269*c54f35caSApple OSS Distributions } else {
270*c54f35caSApple OSS Distributions const char *curr = argv[current_argument];
271*c54f35caSApple OSS Distributions if (current_positional_argument == 0) {
272*c54f35caSApple OSS Distributions if (strcasecmp(curr, kCompressArgument) == 0) {
273*c54f35caSApple OSS Distributions args->ta_variant = VARIANT_COMPRESS;
274*c54f35caSApple OSS Distributions } else if (strcasecmp(curr, kCompressAndDecompressArgument) == 0) {
275*c54f35caSApple OSS Distributions args->ta_variant = VARIANT_COMPRESS_AND_DECOMPRESS;
276*c54f35caSApple OSS Distributions } else {
277*c54f35caSApple OSS Distributions print_help(argv);
278*c54f35caSApple OSS Distributions exit(kInvalidArgument);
279*c54f35caSApple OSS Distributions }
280*c54f35caSApple OSS Distributions } else if (current_positional_argument == 1) {
281*c54f35caSApple OSS Distributions if (strcasecmp(curr, kAllocZeroes) == 0) {
282*c54f35caSApple OSS Distributions args->ta_alloc_type = VARIANT_ZEROS;
283*c54f35caSApple OSS Distributions } else if (strcasecmp(curr, kAllocRandom) == 0) {
284*c54f35caSApple OSS Distributions args->ta_alloc_type = VARIANT_RANDOM;
285*c54f35caSApple OSS Distributions } else if (strcasecmp(curr, kAllocTypical) == 0) {
286*c54f35caSApple OSS Distributions args->ta_alloc_type = VARIANT_TYPICAL;
287*c54f35caSApple OSS Distributions } else {
288*c54f35caSApple OSS Distributions print_help(argv);
289*c54f35caSApple OSS Distributions exit(kInvalidArgument);
290*c54f35caSApple OSS Distributions }
291*c54f35caSApple OSS Distributions } else if (current_positional_argument == 2) {
292*c54f35caSApple OSS Distributions duration = strtol(argv[current_argument], NULL, 10);
293*c54f35caSApple OSS Distributions if (duration <= 0) {
294*c54f35caSApple OSS Distributions print_help(argv);
295*c54f35caSApple OSS Distributions exit(kInvalidArgument);
296*c54f35caSApple OSS Distributions }
297*c54f35caSApple OSS Distributions } else if (current_positional_argument == 3) {
298*c54f35caSApple OSS Distributions size_mb = strtol(argv[current_argument], NULL, 10);
299*c54f35caSApple OSS Distributions if (size_mb <= 0) {
300*c54f35caSApple OSS Distributions print_help(argv);
301*c54f35caSApple OSS Distributions exit(kInvalidArgument);
302*c54f35caSApple OSS Distributions }
303*c54f35caSApple OSS Distributions } else {
304*c54f35caSApple OSS Distributions print_help(argv);
305*c54f35caSApple OSS Distributions exit(kInvalidArgument);
306*c54f35caSApple OSS Distributions }
307*c54f35caSApple OSS Distributions current_positional_argument++;
308*c54f35caSApple OSS Distributions }
309*c54f35caSApple OSS Distributions }
310*c54f35caSApple OSS Distributions if (current_positional_argument != 4) {
311*c54f35caSApple OSS Distributions fprintf(stderr, "Expected 4 positional arguments. %d were supplied.\n", current_positional_argument);
312*c54f35caSApple OSS Distributions print_help(argv);
313*c54f35caSApple OSS Distributions exit(kInvalidArgument);
314*c54f35caSApple OSS Distributions }
315*c54f35caSApple OSS Distributions args->ta_duration_seconds = (uint64_t) duration;
316*c54f35caSApple OSS Distributions args->ta_buffer_size = ((uint64_t) size_mb * (1UL << 20));
317*c54f35caSApple OSS Distributions }
318*c54f35caSApple OSS Distributions
319*c54f35caSApple OSS Distributions static void
print_help(const char ** argv)320*c54f35caSApple OSS Distributions print_help(const char** argv)
321*c54f35caSApple OSS Distributions {
322*c54f35caSApple OSS Distributions fprintf(stderr, "%s: [-v] <test-variant> allocation-type duration_seconds buffer_size_mb\n", argv[0]);
323*c54f35caSApple OSS Distributions fprintf(stderr, "\ntest variants:\n");
324*c54f35caSApple OSS Distributions fprintf(stderr, " %s Measure compressor throughput.\n", kCompressArgument);
325*c54f35caSApple OSS Distributions fprintf(stderr, " %s Measure compressor and decompressor throughput.\n", kCompressAndDecompressArgument);
326*c54f35caSApple OSS Distributions fprintf(stderr, "\n allocation types:\n");
327*c54f35caSApple OSS Distributions fprintf(stderr, " %s All zeros.\n", kAllocZeroes);
328*c54f35caSApple OSS Distributions fprintf(stderr, " %s Random bytes.\n", kAllocRandom);
329*c54f35caSApple OSS Distributions fprintf(stderr, " %s Typical compression ratio (~2.5:1).\n", kAllocTypical);
330*c54f35caSApple OSS Distributions }
331