40#define PERF_IOC_MAGIC 'T'
41#define PERF_START _IO(PERF_IOC_MAGIC, 1)
42#define PERF_STOP _IO(PERF_IOC_MAGIC, 2)
46 printf(
"\nUsage: ./perf start [id]. Start perf.\n");
47 printf(
"\nUsage: ./perf stop. Stop perf.\n");
48 printf(
"\nUsage: ./perf read <nBytes>. Read nBytes raw data from perf buffer and print out.\n");
49 printf(
"\nUsage: ./perf list. List events to be used in -e.\n");
50 printf(
"\nUsage: ./perf stat/record [option] <command>. \n"
51 "-e, event selector. use './perf list' to list available events.\n"
53 "-o, perf data output filename.\n"
54 "-t, taskId filter(allowlist), if not set perf will sample all tasks.\n"
55 "-s, type of data to sample defined in PerfSampleType los_perf.h.\n"
56 "-P, processId filter(allowlist), if not set perf will sample all processes.\n"
57 "-d, whether to prescaler (once every 64 counts),"
58 "which only take effect on cpu cycle hardware event.\n"
72#define BYTES_PER_LINE 4
74 for (i = 0; i < num; i++) {
75 printf(
" %02x", (
unsigned char)buf[i]);
76 if (((i + 1) % BYTES_PER_LINE) == 0) {
92 printf_debug(
"attr->sampleType: 0x%x\n", attr->
sampleType);
95 printf_debug(
"attr->taskIds[%d]: %d\n", i, attr->
taskIds[i]);
99 printf_debug(
"attr->processIds[%d]: %d\n", i, attr->
processIds[i]);
102 printf_debug(
"attr->needSample: %d\n", attr->
needSample);
108 (
void)ioctl(fd, PERF_START, sectionId);
113 (
void)ioctl(fd, PERF_STOP, NULL);
130 printf(
"Read buffer is null.\n");
134 len = read(fd, buf, size);
void PerfStart(int fd, size_t sectionId)
void PerfPrintBuffer(const char *buf, ssize_t num)
void PerfDumpAttr(PerfConfigAttr *attr)
static void PerfSetPeriod(PerfConfigAttr *attr)
int PerfConfig(int fd, PerfConfigAttr *attr)
ssize_t PerfRead(int fd, char *buf, size_t size)
unsigned int processIdsNr
PerfEventConfig eventsCfg
unsigned int processIds[PERF_MAX_FILTER_TSKS]
unsigned int taskIds[PERF_MAX_FILTER_TSKS]
struct PerfEventConfig::@0 events[PERF_MAX_EVENT]
ARG_NUM_3 ARG_NUM_1 ARG_NUM_2 ARG_NUM_2 ARG_NUM_3 ARG_NUM_1 ARG_NUM_4 ARG_NUM_2 ARG_NUM_2 ARG_NUM_5 ARG_NUM_2 void