]> git.saurik.com Git - apple/xnu.git/blob - tools/tests/perf_index/perf_index.h
xnu-2422.115.4.tar.gz
[apple/xnu.git] / tools / tests / perf_index / perf_index.h
1 #ifndef __PERF_INDEX_H_
2 #define __PERF_INDEX_H_
3
4 #include <stdint.h>
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <string.h>
8 #include <unistd.h>
9 #include <assert.h>
10 #include <sys/types.h>
11
12 #define DECL_VALIDATE(validatetest) int validatetest(int test_argc, const char **test_argv)
13 #define DECL_INIT(inittest) void inittest(int num_threads, long long length, int test_argc, const char **test_argv)
14 #define DECL_TEST(test) void test(int thread_id, int num_threads, long long length, int test_argc, const char **test_argv)
15 #define DECL_CLEANUP(cleanuptest) void cleanuptest(int num_threads, long long length)
16
17 #define MAXPATHLEN 1024
18
19 typedef DECL_INIT((*init_func));
20 typedef DECL_TEST((*stress_func));
21 typedef DECL_CLEANUP((*cleanup_func));
22 typedef DECL_VALIDATE((*validate_func));
23
24 typedef struct {
25 char *name;
26 init_func init;
27 stress_func stress;
28 cleanup_func cleanup;
29 validate_func validate;
30 } stress_test_t;
31
32 extern const stress_test_t cpu_test;
33 extern const stress_test_t memory_test;
34 extern const stress_test_t syscall_test;
35 extern const stress_test_t fault_test;
36 extern const stress_test_t zfod_test;
37 extern const stress_test_t file_local_create_test;
38 extern const stress_test_t file_local_write_test;
39 extern const stress_test_t file_local_read_test;
40 extern const stress_test_t file_ram_create_test;
41 extern const stress_test_t file_ram_write_test;
42 extern const stress_test_t file_ram_read_test;
43 extern const stress_test_t iperf_test;
44 extern const stress_test_t compile_test;
45
46 DECL_VALIDATE(no_validate);
47 DECL_VALIDATE(validate_iperf);
48
49 DECL_INIT(stress_memory_init);
50 DECL_INIT(stress_syscall_init);
51 DECL_INIT(stress_fault_init);
52 DECL_INIT(stress_file_local_create_init);
53 DECL_INIT(stress_file_local_read_init);
54 DECL_INIT(stress_file_local_write_init);
55 DECL_INIT(stress_file_ram_create_init);
56 DECL_INIT(stress_file_ram_read_init);
57 DECL_INIT(stress_file_ram_write_init);
58 DECL_INIT(compile_init);
59 DECL_INIT(stress_general_init);
60
61 DECL_TEST(stress_memory);
62 DECL_TEST(stress_cpu);
63 DECL_TEST(stress_syscall);
64 DECL_TEST(stress_fault);
65 DECL_TEST(stress_zfod);
66 DECL_TEST(stress_file_local_create);
67 DECL_TEST(stress_file_local_read);
68 DECL_TEST(stress_file_local_write);
69 DECL_TEST(stress_file_ram_create);
70 DECL_TEST(stress_file_ram_read);
71 DECL_TEST(stress_file_ram_write);
72 DECL_TEST(iperf);
73 DECL_TEST(compile);
74 DECL_TEST(stress_general);
75
76 DECL_CLEANUP(stress_general_cleanup);
77 DECL_CLEANUP(stress_file_local_create_cleanup);
78 DECL_CLEANUP(stress_file_local_read_cleanup);
79 DECL_CLEANUP(stress_file_local_write_cleanup);
80 DECL_CLEANUP(stress_file_ram_create_cleanup);
81 DECL_CLEANUP(stress_file_ram_read_cleanup);
82 DECL_CLEANUP(stress_file_ram_write_cleanup);
83 DECL_CLEANUP(compile_cleanup);
84
85 void stress_file_create(const char *fs_path, int thread_id, int num_threads, long long length);
86
87 void stress_file_write_init(const char *fs_path, int num_threads, long long length);
88 void stress_file_write(const char *fs_path, int thread_id, int num_threads, long long length, long long max_file_size);
89
90 void stress_file_read_init(const char *fs_path, int num_threads, long long length, long long max_file_size);
91 void stress_file_read(const char *fs_path, int thread_id, int num_threads, long long length, long long max_file_size);
92 void stress_file_read_cleanup(const char *fs_path, int num_threads, long long length);
93
94 void md5_hash(uint8_t *message, uint64_t len, uint32_t *hash);
95
96 #endif