Linux Perf
attr.c File Reference
#include <debug.h>
#include <errno.h>
#include <inttypes.h>
#include <stdlib.h>
#include <stdio.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <sys/param.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include "../perf.h"
#include <subcmd/exec-cmd.h>
#include "tests.h"
Include dependency graph for attr.c:

Go to the source code of this file.

Macros

#define ENV   "PERF_TEST_ATTR"
 
#define BUFSIZE   1024
 
#define __WRITE_ASS(str, fmt, data)
 
#define WRITE_ASS(field, fmt)   __WRITE_ASS(field, fmt, attr->field)
 

Functions

void test_attr__init (void)
 
static int store_event (struct perf_event_attr *attr, pid_t pid, int cpu, int fd, int group_fd, unsigned long flags)
 
void test_attr__open (struct perf_event_attr *attr, pid_t pid, int cpu, int fd, int group_fd, unsigned long flags)
 
void test_attr__ready (void)
 
static int run_dir (const char *d, const char *perf)
 
int test__attr (struct test *test __maybe_unused, int subtest __maybe_unused)
 

Variables

static char * dir
 
static bool ready
 

Macro Definition Documentation

◆ __WRITE_ASS

#define __WRITE_ASS (   str,
  fmt,
  data 
)
Value:
do { \
char buf[BUFSIZE]; \
size_t size; \
\
size = snprintf(buf, BUFSIZE, #str "=%"fmt "\n", data); \
if (1 != fwrite(buf, size, 1, file)) { \
perror("test attr - failed to write event file"); \
fclose(file); \
return -1; \
} \
\
} while (0)
size_t size
Definition: evsel.c:60
dictionary data
Definition: stat-cpi.py:4
#define BUFSIZE
Definition: attr.c:48
const char * fmt
Definition: dso.c:193
static int str(yyscan_t scanner, int token)

Definition at line 50 of file attr.c.

◆ BUFSIZE

#define BUFSIZE   1024

Definition at line 48 of file attr.c.

◆ ENV

#define ENV   "PERF_TEST_ATTR"

Definition at line 37 of file attr.c.

◆ WRITE_ASS

#define WRITE_ASS (   field,
  fmt 
)    __WRITE_ASS(field, fmt, attr->field)

Definition at line 64 of file attr.c.

Function Documentation

◆ run_dir()

static int run_dir ( const char *  d,
const char *  perf 
)
static

Definition at line 164 of file attr.c.

◆ store_event()

static int store_event ( struct perf_event_attr *  attr,
pid_t  pid,
int  cpu,
int  fd,
int  group_fd,
unsigned long  flags 
)
static

Definition at line 66 of file attr.c.

◆ test__attr()

int test__attr ( struct test *test  __maybe_unused,
int subtest  __maybe_unused 
)

Definition at line 179 of file attr.c.

Here is the call graph for this function:

◆ test_attr__init()

void test_attr__init ( void  )

Definition at line 42 of file attr.c.

◆ test_attr__open()

void test_attr__open ( struct perf_event_attr *  attr,
pid_t  pid,
int  cpu,
int  fd,
int  group_fd,
unsigned long  flags 
)

Definition at line 145 of file attr.c.

Here is the call graph for this function:

◆ test_attr__ready()

void test_attr__ready ( void  )

Definition at line 158 of file attr.c.

Variable Documentation

◆ dir

char* dir
static

Definition at line 39 of file attr.c.

◆ ready

bool ready
static

Definition at line 40 of file attr.c.