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 19typedef DECL_INIT((*init_func)); 20typedef DECL_TEST((*stress_func)); 21typedef DECL_CLEANUP((*cleanup_func)); 22typedef DECL_VALIDATE((*validate_func)); 23 24typedef 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 32extern const stress_test_t cpu_test; 33extern const stress_test_t memory_test; 34extern const stress_test_t syscall_test; 35extern const stress_test_t fault_test; 36extern const stress_test_t zfod_test; 37extern const stress_test_t file_local_create_test; 38extern const stress_test_t file_local_write_test; 39extern const stress_test_t file_local_read_test; 40extern const stress_test_t file_ram_create_test; 41extern const stress_test_t file_ram_write_test; 42extern const stress_test_t file_ram_read_test; 43extern const stress_test_t iperf_test; 44extern const stress_test_t compile_test; 45 46DECL_VALIDATE(no_validate); 47DECL_VALIDATE(validate_iperf); 48 49DECL_INIT(stress_memory_init); 50DECL_INIT(stress_syscall_init); 51DECL_INIT(stress_fault_init); 52DECL_INIT(stress_file_local_create_init); 53DECL_INIT(stress_file_local_read_init); 54DECL_INIT(stress_file_local_write_init); 55DECL_INIT(stress_file_ram_create_init); 56DECL_INIT(stress_file_ram_read_init); 57DECL_INIT(stress_file_ram_write_init); 58DECL_INIT(compile_init); 59DECL_INIT(stress_general_init); 60 61DECL_TEST(stress_memory); 62DECL_TEST(stress_cpu); 63DECL_TEST(stress_syscall); 64DECL_TEST(stress_fault); 65DECL_TEST(stress_zfod); 66DECL_TEST(stress_file_local_create); 67DECL_TEST(stress_file_local_read); 68DECL_TEST(stress_file_local_write); 69DECL_TEST(stress_file_ram_create); 70DECL_TEST(stress_file_ram_read); 71DECL_TEST(stress_file_ram_write); 72DECL_TEST(iperf); 73DECL_TEST(compile); 74DECL_TEST(stress_general); 75 76DECL_CLEANUP(stress_general_cleanup); 77DECL_CLEANUP(stress_file_local_create_cleanup); 78DECL_CLEANUP(stress_file_local_read_cleanup); 79DECL_CLEANUP(stress_file_local_write_cleanup); 80DECL_CLEANUP(stress_file_ram_create_cleanup); 81DECL_CLEANUP(stress_file_ram_read_cleanup); 82DECL_CLEANUP(stress_file_ram_write_cleanup); 83DECL_CLEANUP(compile_cleanup); 84 85void stress_file_create(const char *fs_path, int thread_id, int num_threads, long long length); 86 87void stress_file_write_init(const char *fs_path, int num_threads, long long length); 88void stress_file_write(const char *fs_path, int thread_id, int num_threads, long long length, long long max_file_size); 89 90void stress_file_read_init(const char *fs_path, int num_threads, long long length, long long max_file_size); 91void stress_file_read(const char *fs_path, int thread_id, int num_threads, long long length, long long max_file_size); 92void stress_file_read_cleanup(const char *fs_path, int num_threads, long long length); 93 94void md5_hash(uint8_t *message, uint64_t len, uint32_t *hash); 95 96#endif 97