Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Copyright 2013, Michael Ellerman, IBM Corp.
0004  */
0005 
0006 #ifndef _SELFTESTS_POWERPC_PMU_EVENT_H
0007 #define _SELFTESTS_POWERPC_PMU_EVENT_H
0008 
0009 #include <unistd.h>
0010 #include <linux/perf_event.h>
0011 
0012 #include "utils.h"
0013 
0014 
0015 struct event {
0016     struct perf_event_attr attr;
0017     char *name;
0018     int fd;
0019     /* This must match the read_format we use */
0020     struct {
0021         u64 value;
0022         u64 running;
0023         u64 enabled;
0024     } result;
0025     /*
0026      * mmap buffer used while recording sample.
0027      * Accessed as "struct perf_event_mmap_page"
0028      */
0029     void *mmap_buffer;
0030 };
0031 
0032 void event_init(struct event *e, u64 config);
0033 void event_init_named(struct event *e, u64 config, char *name);
0034 void event_init_opts(struct event *e, u64 config, int type, char *name);
0035 void event_init_sampling(struct event *e, u64 config);
0036 int event_open_with_options(struct event *e, pid_t pid, int cpu, int group_fd);
0037 int event_open_with_group(struct event *e, int group_fd);
0038 int event_open_with_pid(struct event *e, pid_t pid);
0039 int event_open_with_cpu(struct event *e, int cpu);
0040 int event_open(struct event *e);
0041 void event_close(struct event *e);
0042 int event_enable(struct event *e);
0043 int event_disable(struct event *e);
0044 int event_reset(struct event *e);
0045 int event_read(struct event *e);
0046 void event_report_justified(struct event *e, int name_width, int result_width);
0047 void event_report(struct event *e);
0048 
0049 #endif /* _SELFTESTS_POWERPC_PMU_EVENT_H */