perf: overflow test

Change-Id: Ic7aa0d99ae9a5b7d3ce4436129a360275e6937ca
refs: #1358
This commit is contained in:
TOIDA,Suguru
2019-12-16 13:35:52 +09:00
parent 305511b48f
commit 1a204b6674
18 changed files with 907 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
/* perf_common.h COPYRIGHT FUJITSU LIMITED 2019 */
#ifndef _PERF_COMMON_H_
#define _PERF_COMMON_H_
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <linux/perf_event.h>
#include <sys/ioctl.h>
#include <asm/unistd.h>
#define SAMPLE_PERIOD 30
#define nop10 do { \
asm volatile("nop;nop;nop;nop;nop;" \
"nop;nop;nop;nop;nop"); \
} while (0)
//usage
extern const char *the_app;
void print_usage(void);
//system call
long perf_event_open(struct perf_event_attr *event_attr, pid_t pid,
int cpu, int group_fd, unsigned long flags);
int init_perf_event_attr(struct perf_event_attr *event_attr);
int asm_ioctl3(int fd, unsigned long arg1, unsigned long arg2);
int asm_read(int fd, void *buf, size_t size);
//command
struct command {
void *args;
void (*release)(struct command *cmd);
int (*do_cmd)(int fd, void *args);
void (*print)(void *args);
};
#define MAX_COMBINATION 256
struct command_set {
int nr_cmds;
struct command cmds[MAX_COMBINATION];
};
int build_command(const char *cmd_src, struct command *cmd);
#endif /* _PERF_COMMON_H_ */