Linux Perf
hists_common.c File Reference
#include <inttypes.h>
#include "perf.h"
#include "util/debug.h"
#include "util/symbol.h"
#include "util/sort.h"
#include "util/evsel.h"
#include "util/evlist.h"
#include "util/machine.h"
#include "util/thread.h"
#include "tests/hists_common.h"
#include <linux/kernel.h>
Include dependency graph for hists_common.c:

Go to the source code of this file.

Classes

struct  fake_sym
 

Functions

struct machinesetup_fake_machine (struct machines *machines)
 
void print_hists_in (struct hists *hists)
 
void print_hists_out (struct hists *hists)
 

Variables

struct {
   u32   pid
 
   const char *   comm
 
fake_threads []
 
struct {
   u32   pid
 
   u64   start
 
   const char *   filename
 
fake_mmap_info []
 
static struct fake_sym perf_syms []
 
static struct fake_sym bash_syms []
 
static struct fake_sym libc_syms []
 
static struct fake_sym kernel_syms []
 
struct {
   const char *   dso_name
 
   struct fake_sym *   syms
 
   size_t   nr_syms
 
fake_symbols []
 

Function Documentation

◆ print_hists_in()

void print_hists_in ( struct hists hists)

Definition at line 161 of file hists_common.c.

Here is the call graph for this function:

◆ print_hists_out()

void print_hists_out ( struct hists hists)

Definition at line 191 of file hists_common.c.

Here is the call graph for this function:

◆ setup_fake_machine()

struct machine* setup_fake_machine ( struct machines machines)

Definition at line 83 of file hists_common.c.

Here is the call graph for this function:

Variable Documentation

◆ bash_syms

struct fake_sym bash_syms[]
static
Initial value:
= {
}
#define FAKE_SYM_LENGTH
Definition: hists_common.h:21
#define FAKE_SYM_OFFSET3
Definition: hists_common.h:20
#define FAKE_SYM_OFFSET1
Definition: hists_common.h:18
#define FAKE_SYM_OFFSET2
Definition: hists_common.h:19

Definition at line 51 of file hists_common.c.

◆ comm

const char* comm

Definition at line 16 of file hists_common.c.

◆ dso_name

const char* dso_name

Definition at line 73 of file hists_common.c.

◆ fake_mmap_info

struct { ... } fake_mmap_info[]
Initial value:
= {
{ FAKE_PID_PERF1, FAKE_MAP_KERNEL, "[kernel]" },
{ FAKE_PID_PERF2, FAKE_MAP_KERNEL, "[kernel]" },
{ FAKE_PID_BASH, FAKE_MAP_KERNEL, "[kernel]" },
}
#define FAKE_MAP_LIBC
Definition: hists_common.h:14
#define FAKE_PID_PERF2
Definition: hists_common.h:9
#define FAKE_MAP_BASH
Definition: hists_common.h:13
#define FAKE_PID_PERF1
Definition: hists_common.h:8
#define FAKE_MAP_PERF
Definition: hists_common.h:12
#define FAKE_MAP_KERNEL
Definition: hists_common.h:15
#define FAKE_PID_BASH
Definition: hists_common.h:10

◆ fake_symbols

struct { ... } fake_symbols[]
Initial value:
= {
{ "perf", perf_syms, ARRAY_SIZE(perf_syms) },
{ "bash", bash_syms, ARRAY_SIZE(bash_syms) },
{ "libc", libc_syms, ARRAY_SIZE(libc_syms) },
{ "[kernel]", kernel_syms, ARRAY_SIZE(kernel_syms) },
}
static struct fake_sym perf_syms[]
Definition: hists_common.c:45
static struct fake_sym libc_syms[]
Definition: hists_common.c:57
static struct fake_sym kernel_syms[]
Definition: hists_common.c:66
static struct fake_sym bash_syms[]
Definition: hists_common.c:51

◆ fake_threads

struct { ... } fake_threads[]
Initial value:
= {
{ FAKE_PID_PERF1, "perf" },
{ FAKE_PID_PERF2, "perf" },
{ FAKE_PID_BASH, "bash" },
}
#define FAKE_PID_PERF2
Definition: hists_common.h:9
#define FAKE_PID_PERF1
Definition: hists_common.h:8
#define FAKE_PID_BASH
Definition: hists_common.h:10

◆ filename

const char* filename

Definition at line 26 of file hists_common.c.

◆ kernel_syms

struct fake_sym kernel_syms[]
static
Initial value:
= {
{ FAKE_SYM_OFFSET2, FAKE_SYM_LENGTH, "page_fault" },
{ FAKE_SYM_OFFSET3, FAKE_SYM_LENGTH, "sys_perf_event_open" },
}
#define FAKE_SYM_LENGTH
Definition: hists_common.h:21
#define FAKE_SYM_OFFSET3
Definition: hists_common.h:20
#define FAKE_SYM_OFFSET1
Definition: hists_common.h:18
#define FAKE_SYM_OFFSET2
Definition: hists_common.h:19

Definition at line 66 of file hists_common.c.

◆ libc_syms

struct fake_sym libc_syms[]
static
Initial value:
= {
{ 700, 100, "malloc" },
{ 800, 100, "free" },
{ 900, 100, "realloc" },
}
#define FAKE_SYM_LENGTH
Definition: hists_common.h:21
#define FAKE_SYM_OFFSET3
Definition: hists_common.h:20
#define FAKE_SYM_OFFSET1
Definition: hists_common.h:18
#define FAKE_SYM_OFFSET2
Definition: hists_common.h:19

Definition at line 57 of file hists_common.c.

◆ nr_syms

size_t nr_syms

Definition at line 75 of file hists_common.c.

◆ perf_syms

struct fake_sym perf_syms[]
static
Initial value:
= {
{ FAKE_SYM_OFFSET2, FAKE_SYM_LENGTH, "run_command" },
{ FAKE_SYM_OFFSET3, FAKE_SYM_LENGTH, "cmd_record" },
}
#define FAKE_SYM_LENGTH
Definition: hists_common.h:21
#define FAKE_SYM_OFFSET3
Definition: hists_common.h:20
#define FAKE_SYM_OFFSET1
Definition: hists_common.h:18
#define FAKE_SYM_OFFSET2
Definition: hists_common.h:19

Definition at line 45 of file hists_common.c.

◆ pid

u32 pid

Definition at line 15 of file hists_common.c.

◆ start

u64 start

Definition at line 25 of file hists_common.c.

◆ syms

struct fake_sym* syms

Definition at line 74 of file hists_common.c.