Linux Perf
sample-parsing.c File Reference
#include <stdbool.h>
#include <inttypes.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include "util.h"
#include "event.h"
#include "evsel.h"
#include "debug.h"
#include "tests.h"
Include dependency graph for sample-parsing.c:

Go to the source code of this file.

Macros

#define COMP(m)
 
#define MCOMP(m)
 

Functions

static bool samples_same (const struct perf_sample *s1, const struct perf_sample *s2, u64 type, u64 read_format)
 
static int do_test (u64 sample_type, u64 sample_regs, u64 read_format)
 
int test__sample_parsing (struct test *test __maybe_unused, int subtest __maybe_unused)
 

Macro Definition Documentation

◆ COMP

#define COMP (   m)
Value:
do { \
if (s1->m != s2->m) { \
pr_debug("Samples differ at '"#m"'\n"); \
return false; \
} \
} while (0)

Definition at line 14 of file sample-parsing.c.

◆ MCOMP

#define MCOMP (   m)
Value:
do { \
if (memcmp(&s1->m, &s2->m, sizeof(s1->m))) { \
pr_debug("Samples differ at '"#m"'\n"); \
return false; \
} \
} while (0)

Definition at line 21 of file sample-parsing.c.

Function Documentation

◆ do_test()

static int do_test ( u64  sample_type,
u64  sample_regs,
u64  read_format 
)
static

Definition at line 151 of file sample-parsing.c.

Here is the call graph for this function:

◆ samples_same()

static bool samples_same ( const struct perf_sample s1,
const struct perf_sample s2,
u64  type,
u64  read_format 
)
static

Definition at line 28 of file sample-parsing.c.

Here is the call graph for this function:

◆ test__sample_parsing()

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

test__sample_parsing - test sample parsing.

This function implements a test that synthesizes a sample event, parses it and then checks that the parsed sample matches the original sample. The test checks sample format bits separately and together. If the test passes %0 is returned, otherwise %-1 is returned.

Definition at line 300 of file sample-parsing.c.

Here is the call graph for this function: